12-28-2006 2:09 PM
I have report Fi , dot have output.
data: begin of ls_nalog,
POZ type BUZEI, "pozicija
KUNNR type KUNNR, " Kupac
BELNR type BELNR_D, " Broj dokumenta sap-a
BLDAT type BLDAT, " Datum dokumenta
DUG type ZDUG, " Duguje
POT type ZPOT, " Potrazuje
SAL type ZSAL, " Saldo
VAL type WAERS, " Valuta
AUGBL type AUGBL, " broj dokumenta veze
BROJ type XBLNR, " Broj
end of ls_nalog.
SELECTION-SCREEN: BEGIN OF BLOCK EKR1 WITH FRAME.
parameters: p_bukrs type knb1-bukrs DEFAULT 'ZS01'.
start-of-selection.
elect * from bkpf into table lt_bkpf
where bukrs = p_bukrs
and gjahr = gjahr
and budat = budat
and blart in s_blart.
loop at lt_bkpf into ls_bkpf.
select * from bseg into table lt_bseg
where belnr = bkpf-belnr
and gjahr = bkpf-gjahr.
endloop.
loop at lt_bseg into ls_bseg.
move ls_bseg-BUZEI to ls_nalog-poz.
move ls_bseg-lifnr to ls_nalog-dug.
move ls_bkpf-bldat to ls_nalog-bldat.
endloop.
***************************don have in otput ls_nalog nothing...
loop at lt_nalog into ls_nalog. " output screen.
WRITE: / ls_nalog-poz,
...
.
..
12-28-2006 2:18 PM
Check here....
loop at lt_bseg into ls_bseg.
move ls_bseg-BUZEI to <b>lt_nalog-poz</b>.
move ls_bseg-lifnr to <b>lt_nalog-dug</b>.
move ls_bkpf-bldat to <b>lt_nalog-bldat</b>.
endloop.
ur moving to wrong int'table...
Also, before loop check whether the previous int'table is empty or not which will be good programming.
12-28-2006 2:29 PM
Considering this <b>loop at lt_nalog into ls_nalog.</b>
loop at lt_bseg into ls_bseg.
move ls_bseg-BUZEI to ls_nalog-poz.
move ls_bseg-lifnr to ls_nalog-dug.
move ls_bkpf-bldat to ls_nalog-bldat.
<b>* Append is missing here</b>
<b>Append ls_nalog to lt_nalog.</b>
endloop.
if lt_nalog is a table with header line then you can use,
loop at lt_bseg into ls_bseg.
move ls_bseg-BUZEI to lt_nalog-poz.
move ls_bseg-lifnr to lt_nalog-dug.
move ls_bkpf-bldat to lt_nalog-bldat.
<b>* Append is missing here</b>
<b>Append lt_nalog.</b>
endloop.
Regards
Kathirvel
12-28-2006 5:10 PM
Make the following change:
select * from bseg into table lt_bseg
where bukrs = bkpf-bukrs <===
and belnr = bkpf-belnr
and gjahr = bkpf-gjahr.
Rob
12-28-2006 7:44 PM
Hi
Append statement solves your problem, but other things to be noted in your code is:
loop at lt_bkpf into ls_bkpf.
select * from bseg into table lt_bseg
where belnr = bkpf-belnr
and gjahr = bkpf-gjahr.
endloop.
1) In where condition, you should have ls_bkpf-belnr and ls_bkpf-gjahr.
2) In the loop, the internal table will be refreshed everytime when the SELECT statement is executed. You need to add the line 'appending into table' or put the endloop at the end of report.
Regards,
Navneet
12-28-2006 7:53 PM
HI Nick,
I have a suggestion for your FI report, I see you querying directly to BSEG table.
BSEG is one of the heavy tables and should avoid querying BSEG directly.
Instead of using BSEG table which is a cluster table, trying querying other tables like
"I" stands for Open Items,
BSIS = G/L
BSIK = Vendor
BSID = Customer
"A" for Cleared Items
BSAS = G/L
BSAK = Vendor
BSAD = Customer.
Which is as good as querying BSEG, but runs a lot faster.
Regards,
-Venkat.
12-28-2006 11:24 PM
Venkat - so long as you use at least BUKRS, BELNR and GJAHR, there is nothing wrong with going directly against BSEG. The index tables quite often have many records for the keys you have (BUKRS and HKONT for BSIS, say). Querying these tables can therefore be much slower than querying BSEG directly.
Try it out.
Rob