Hi folks,
This report is working fine.But it is taking lot of time if i enter only company code.Could any one suggest me where is the problem.
kaki
REPORT Z1F_RFKEPL00 no standard page heading
line-size 140
line-count 65
message-id Z1.
TABLES: LFA1,t005t,bsak,bseg,t001,skat.
data: begin of t_bsak occurs 0,
bukrs like bsak-bukrs, "company code
lifnr like bsak-lifnr, "Vendor acc number
augdt like bsak-augdt, "Clearing date
AUGBL like bsak-AUGBL, "Clearing Document
GJAHR like bsak-GJAHR, "year
belnr like bsak-belnr, "Document number
BUZEI like bsak-BUZEI, "Line Item
budat like bsak-budat, "Posting Date in the Document
bldat like bsak-bldat, "Document date in document
blart like bsak-blart, "Document type
BSCHL like bsak-BSCHL, "Posting key
WAERS like bsak-WAERS, "Currency key
CPUDT like bsak-cpudt, "Accounting Document Entry Date
SHKZG like bsak-shkzg, "Debit/Credit Indicator
DMBTR like bsak-dmbtr, "Amount in local currency
WRBTR like bsak-wrbtr, "Amount in document currency
SGTXT like bsak-sgtxt, "Item Text
SAKNR LIKE bsak-saknr, "G/L Account Number
hkont like bsak-hkont, "General Ledger Account
SKFBT LIKE BSAK-SKFBT, "Amount Eligible for Cash Discount
KOSTL LIKE BSEG-KOSTL, "Cost center
ktopl like t001-ktopl, "chart of accounts
txt20 like skat-txt20, "Short test for the GL acc
name1 like lfa1-name1,
land1 like lfa1-land1,
landx like t005t-landx,
end of t_bsak.
data: begin of t_header occurs 0,
bukrs like bsak-bukrs,
hkont like bsak-hkont,
lifnr like bsak-lifnr,
waers like bsak-waers,
land1 like lfa1-land1,
name1 like lfa1-name1,
landx like t005t-landx,
end of t_header.
data: begin of t_lfa1 occurs 0,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
land1 like lfa1-land1,
landx like t005t-landx,
end of t_lfa1.
data: t_bseg like t_bsak occurs 0 with header line.
data: t_data like t_bsak occurs 0 with header line.
selection-screen begin of block blk1 with frame title text-001.
select-options: s_lifnr for bsak-lifnr,
s_bukrs for bsak-bukrs.
selection-screen end of block blk1.
selection-screen begin of block blk2 with frame title text-002.
parameters s_budat like bsik-budat default sy-datum.
select-options: s_augdt for bsak-augdt.
selection-screen end of block blk2.
selection-screen begin of block blk3 with frame title text-003.
parameters: stand as checkbox default 'X',
park as checkbox.
selection-screen end of block blk3.
start-of-selection.
perform process_data.
top-of-page.
perform set_page_header.
&----
*& Form process_data
&----
text
----
form process_data.
data: line like t_bsak occurs 0 with header line.
data: l_wrbtr(10) type c.
data: l_debit type bsak-wrbtr,l_credit type bsak-wrbtr,
l_balance type bsak-wrbtr.
data:l_hkont(10) type n.
select BUKRS LIFNR AUGDT AUGBL GJAHR BELNR BUZEI BUDAT BLDAT
CPUDT WAERS BLART BSCHL SHKZG DMBTR WRBTR SGTXT HKONT SKFBT
from bsak
into corresponding fields of table t_bsak
where
lifnr in s_lifnr and
BUKRS in s_bukrs and
budat le s_budat and " Open items
augdt in s_augdt order by lifnr.
if sy-subrc ne 0.
message i016.
leave list-processing.
endif.
sort t_bsak by BUDAT.
CHECK NOT t_bsak[] IS INITIAL.
select MANDT BUKRS LIFNR AUGDT AUGBL GJAHR BELNR
SHKZG DMBTR WRBTR SGTXT SKFBT KOSTL BSCHL hkont BUZEI
into corresponding fields of table t_bseg from bseg
FOR ALL ENTRIES IN t_bsak
where belnr = t_bsak-belnr and
bukrs = t_bsak-bukrs and
gjahr = t_bsak-gjahr
ORDER BY PRIMARY KEY .
loop at t_bsak.
to get vendor name
select single * from lfa1 where lifnr = t_bsak-lifnr.
move lfa1-lifnr to t_header-lifnr.
move lfa1-name1 to t_header-name1.
move lfa1-land1 to t_header-land1.
move t_bsak-bukrs to t_header-bukrs.
move t_bsak-hkont to t_header-hkont.
move t_bsak-waers to t_header-waers.
if sy-subrc = 0.
append t_header.
clear t_header.
endif.
to get vendor country
loop at t_header.
select single * from t005t where land1 = t_header-land1 and
SPRAS = 'E'.
move t005t-landx to t_header-landx.
if sy-subrc = 0.
modify t_header.
clear t_header.
endif.
endloop.
loop at t_bseg where belnr = t_bsak-belnr and
bukrs = t_bsak-bukrs and
gjahr = t_bsak-gjahr.
l_hkont = t_bseg-hkont.
*To get chart of accounts
select single * from t001 where bukrs = t_bseg-bukrs.
move t001-ktopl to t_bseg-ktopl.
*To get short text for the chart of accounts
select single * from skat where ktopl = t_bseg-ktopl and
saknr = l_hkont and
spras = 'E'.
t_data-bukrs = t_bsak-bukrs.
t_data-lifnr = t_bsak-lifnr.
t_data-augdt = t_bseg-augdt.
t_data-AUGBL = t_bseg-AUGBL.
t_data-GJAHR = t_bseg-GJAHR.
t_data-belnr = t_bsak-belnr.
t_data-BUZEI = t_bseg-BUZEI.
t_data-budat = t_bsak-budat.
t_data-bldat = t_bsak-bldat.
t_data-blart = t_bsak-blart.
t_data-BSCHL = t_bseg-BSCHL.
t_data-WAERS = t_bsak-WAERS.
t_data-CPUDT = t_bsak-cpudt.
t_data-SHKZG = t_bseg-shkzg.
t_data-DMBTR = t_bseg-dmbtr.
t_data-WRBTR = t_bseg-wrbtr.
t_data-SGTXT = t_bsak-sgtxt.
t_data-SAKNR = t_bseg-saknr.
t_data-hkont = t_bseg-hkont.
t_data-SKFBT = t_bseg-SKFBT.
t_data-KOSTL = t_bseg-KOSTL.
t_data-ktopl = t_bseg-ktopl.
t_data-txt20 = skat-txt20.
append t_data.
clear t_data.
endloop.
endloop.
sort t_header by lifnr.
delete adjacent duplicates from t_header.
*Display----
*to display header
data: l_buzei type bseg-buzei.
loop at t_header.
write:/1(6) t_header-bukrs color 2,
7(8) t_header-hkont color 2,
18(10) t_header-lifnr color 2.
write:/30(10) t_header-name1.
write:/30(10) t_header-landx.
uline.
loop at t_data where lifnr = t_header-lifnr.
l_wrbtr = t_data-wrbtr.
if t_data-wrbtr = t_data-skfbt.
concatenate l_wrbtr '-' into l_wrbtr.
endif.
write:/15(11) t_data-BUDAT no-zero color 7,
26(5) t_data-BLART color 7,
30(12) t_data-belnr color 7,
42(16) t_data-BLDAT color 7,
58(5) t_data-buzei color 7,
63(12) t_data-BSCHL color 7,
75(9) t_data-AUGDT color 7,
84(35) t_data-AUGBL color 7,
119(7) t_data-WAERS color 7,
126(12) l_wrbtr color 7.
write:/55 t_data-sgtxt.
write:/60(10) t_data-kostl,
70(10) t_data-hkont,
80(20) t_data-txt20.
clear l_wrbtr.
endloop.
write:/1(6) t_data-bukrs color 2,
7(8) t_data-hkont color 2,
18(10) t_data-lifnr color 2.
uline.
line[] = t_data[].
loop at line where lifnr = t_header-lifnr.
if line-shkzg = 'H'.
l_debit = l_debit + line-wrbtr.
endif.
if line-shkzg = 'S'.
l_credit = l_credit + line-wrbtr.
endif.
endloop.
write:/1(6) t_data-bukrs color 3,
7(8) t_data-hkont color 3,
18(10) t_data-lifnr color 3.
write:/1(6) t_data-bukrs color 3,
7(11) t_data-hkont color 3,
18(102) t_data-lifnr color 3.
l_balance = l_debit - l_credit.
write:115(15) l_debit color 3. write:135(1) 'D' color 3.
write:/115(15) l_credit color 3. write:135(1) 'C' color 3.
for balnce
write:/90(25) 'Bal.:' color 3.
write:115(15) l_balance color 3.
*
write:120(15) l_debit color 3.
write:138(2) 'D' color 3.
write:/120(15) l_credit color 3.
write:138(2) 'C' color 3.
for balnce
write:/90(00) 'Bal.:' color 3.
write:120(15) l_balance color 3.
clear: l_debit,l_credit,l_balance.
uline.
endloop.
endform. "process_data
&----
*& Form set_page_header
&----
text
----
FORM set_page_header.
call function 'Z_REPORT_TITLE'
EXPORTING
line_size = sy-linsz
sy_title = 'List of Vendor Line Items'
uline = 'X'
first_page_only = ' '.
write :1(15) 'Allocation' color col_heading,
15(10) 'Pstng' color col_heading,
25(5) 'Do' color col_heading,
30(10) 'Documnet' color col_heading,
40(10) 'Doc' color col_heading,
50(8) 'BusA' color col_heading,
58(5) 'LIm' color col_heading,
63(4) 'PK' color col_heading,
67(4) 'S' color col_heading,
71(4) 'P' color col_heading,
75(7) 'Clrg' color col_heading,
82(10) 'Clearing' color col_heading,
92(20) 'D/c discount Amnt' color col_heading,
112(5) 'Rsn' color col_heading,
117(2) 'G' color col_heading,
119(7) 'Curr-' color col_heading,
126(12) 'Amount in' color col_heading,
138(2) 'T' color col_heading.
write space.
write :1(15) 'number' color col_heading,
15(10) 'date' color col_heading,
25(5) 'ty' color col_heading,
30(10) 'number' color col_heading,
40(18) 'date' color col_heading,
58(5) '' color col_heading,
63(4) '' color col_heading,
67(4) 'I' color col_heading,
71(4) 'K' color col_heading,
75(7) 'date' color col_heading,
82(24) 'doc.no' color col_heading,
105(20) 'in LC' color col_heading,
112(5) 'code' color col_heading,
117(2) 'L' color col_heading,
119(7) 'ency' color col_heading,
126(12) 'doc.curr.' color col_heading,
138(2) 'X' color col_heading.
write space.
uline.
ENDFORM. " set_page_header