Go on link..

link us with ...

Friday, December 31, 2010

OUTFLOW

*&---------------------------------------------------------------------*
*& Report ZVVF_FIRO_OUTFLOW *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

REPORT ZVVF_FIRO_OUTFLOW
no standard page heading
line-size 1023
line-count 59(2).


tables: lfa1, skat, payr, bseg.

select-options: s_hkont for bseg-hkont, " GL account
s_valut for bseg-valut obligatory, " Payement Date
s_gjahr for bseg-gjahr no-extension
no intervals obligatory. " Year Code

parameters: p_bukrs like bseg-bukrs
default 'VVF' obligatory. " Comp Code

*--- Amit Gore --- Table Maintainance for Cash Mgmt Group
selection-screen: skip,
begin of block b1 with frame title text-003,
pushbutton /15(20) text-001 user-command onetime,
pushbutton 40(20) text-002 user-command glaccount,
end of block b1.

data: begin of raw_itab occurs 0,
bukrs like bseg-bukrs,
gjahr like bseg-gjahr,
belnr like bseg-belnr, " Voucher doc no.
hkont like bseg-hkont, " G/L account No.
shkzg like bseg-shkzg, " Debit Credit Flag
" dmbtr like bseg-dmbtr, " Value
dmbtr type f,
sgtxt like bseg-sgtxt, " Description (Not used)
chect like payr-chect, " Cheque No
rzawe like payr-rzawe, " Payement Mode
" rwbtr like payr-rwbtr, " Value
rwbtr type f,
znme1 like payr-znme1, " Description
lifnr like bseg-lifnr, " Vendor code
txt50 like skat-txt50, " G/L account description
b_hkont like bseg-hkont, " Base G/L account No
name1 like lfa1-name1, " Vendor Description
zlsch like bseg-zlsch, " Payment Type
kunnr like bseg-kunnr, " Customer code
c_name1 like kna1-name1, " Customer Name
fdgrv like knb1-fdgrv,
cmgt_text like t036t-ltext, " Cash management text
end of raw_itab.

data: begin of i_hkont occurs 0,
hkont like bseg-hkont,
contr type i,
end of i_hkont.

data: cntr type i value -1, " Counter
coln type i value 1, " Column variable for cross-tab
v_dmbtr type f, " Value for the document
v_toggle type i value 0,
account_total type f. " Total for the account.

data: begin of i_glname occurs 0,
txt50 like skat-txt50,
contr type i,
end of i_glname.

data: begin of i_belnr occurs 0,
bukrs like bseg-bukrs,
gjahr like bseg-gjahr,
belnr like bseg-belnr,
hkont like bseg-hkont,
end of i_belnr.

*-- Customer Cash management group
data: begin of *knb1 occurs 0,
kunnr like knb1-kunnr,
fdgrv like knb1-fdgrv,
ebene like t036t-ebene,
ltext like t036t-ltext,
end of *knb1.

data: begin of *t036t occurs 0,
ebene like t036t-ebene,
ltext like t036t-ltext,
end of *t036t.

*-- Vendor Cash management group
data: begin of *lfb1 occurs 0,
lifnr like lfb1-lifnr,
fdgrv like lfb1-fdgrv,
grupp like t035t-grupp,
textl like t035t-textl,
end of *lfb1.

data: begin of *t035t occurs 0,
grupp like t035t-grupp,
textl like t035t-textl,
end of *t035t.

*--------------------------------------
* One Time Vendor Cash Management Group --- Amit Gore
*--------------------------------------
data: begin of i_one_time_vendor occurs 0,
lifnr like zfi_onetimecash-lifnr, " One Time Vendor A/c
fdgrv like zfi_onetimecash-fdgrv, " Planning Group
grupp like t035t-grupp, " Planning group
textl like t035t-textl, " Planning Group Texts
end of i_one_time_vendor.

*-------------------------------------------------------
* Cash Mgmt. Group Text (Used only for one time vendors) --- Amit Gore
*-------------------------------------------------------
data: begin of i_t035t occurs 0,
grupp like t035t-grupp,
textl like t035t-textl,
end of i_t035t.

*----------------------------------
* G/L Account Cash Management Group --- Amit Gore
*----------------------------------
data: begin of i_glaccount occurs 0,
saknr like zfi_gl_cashmgmt-saknr,
fdgrv like zfi_gl_cashmgmt-fdgrv, " Planning Group
grupp like t035t-grupp, " Planning group
textl like t035t-textl, " Planning Group Texts
end of i_glaccount.

*--------------------------------------------------------
* Cash Mgmt. Group Text (Used onmly for one time vendors) --- Amit Gore
*--------------------------------------------------------
data: begin of i_t035t_gl occurs 0,
grupp like t035t-grupp,
textl like t035t-textl,
end of i_t035t_gl.

*---------------*
initialization.
*---------------*
data: v_gjahr like bkpf-gjahr.
if sy-datum+4(2) < '04'.
v_gjahr = sy-datum+0(4) - 1.
else.
v_gjahr = sy-datum+0(4).
endif.

s_gjahr-sign = 'I'.
s_gjahr-option = 'EQ'.
s_gjahr-low = v_gjahr.
append s_gjahr.
clear s_gjahr.


data: begin of i_temp occurs 0,
bukrs like bkpf-bukrs,
gjahr like bkpf-gjahr,
belnr like bkpf-belnr,
budat like bkpf-budat,
end of i_temp.

*-------------------
at selection-screen.
*-------------------
*--- Call transaction for table maintainance
case sy-ucomm.
when 'ONETIME'.
call transaction 'ZFI_ONETIME_CASH'.
when 'GLACCOUNT'.
call transaction 'ZFI_GL_CASH_MGMT'.
endcase.

*---------------*
start-of-selection.
*---------------*

*
*select belnr hkont into table i_belnr
* from bseg
* where valut in s_valut
* and hkont in s_hkont
* and bukrs = p_bukrs.
*
* Bijoy - 27Sep2001
* Document type condition added - Ignore F1 Documents

select
belnr
bukrs
gjahr
budat
into
corresponding fields of
table i_temp
from bkpf
where cpudt in s_valut
and bukrs = p_bukrs
and gjahr in s_gjahr
and blart not in ('F1') .

if i_temp[] is initial.
message 'No data found for the selection' TYPE 'E'.
exit.
endif.

select bukrs gjahr
belnr hkont into
corresponding fields of table i_belnr
from bseg
for all entries in i_temp
where hkont in s_hkont
and bukrs = i_temp-bukrs
and belnr = i_temp-belnr
and gjahr = i_temp-gjahr.


sort i_belnr by bukrs gjahr belnr hkont.
delete adjacent duplicates from i_belnr
comparing bukrs gjahr belnr hkont.

loop at i_belnr.

select bukrs gjahr
belnr hkont dmbtr sgtxt shkzg lifnr zlsch kunnr
into corresponding fields of raw_itab
from bseg
where bukrs = i_belnr-bukrs
and belnr = i_belnr-belnr
and hkont ne i_belnr-hkont
and gjahr = i_belnr-gjahr.

raw_itab-b_hkont = i_belnr-hkont.

append raw_itab.

endselect.

endloop.

*--- Get Cash management group of all customers/Vendor
perform get_cash_manage.



sort raw_itab by belnr.

loop at raw_itab.

*--- Update the cash management text
if raw_itab-lifnr ne space.
read table *lfb1 with key lifnr = raw_itab-lifnr.
if sy-subrc eq 0.
raw_itab-fdgrv = *lfb1-fdgrv.
raw_itab-cmgt_text = *lfb1-textl.
endif.
*--- One Time Vendor
read table i_one_time_vendor with key lifnr = raw_itab-lifnr.
if sy-subrc = 0.
raw_itab-fdgrv = i_one_time_vendor-fdgrv.
raw_itab-cmgt_text = i_one_time_vendor-textl.
endif.
endif.

if raw_itab-kunnr ne space.
read table *knb1 with key kunnr = raw_itab-kunnr.
if sy-subrc eq 0.
raw_itab-fdgrv = *knb1-fdgrv.
raw_itab-cmgt_text = *knb1-ltext.
endif.
endif.

*--- G/L Account
if raw_itab-fdgrv = space.
read table i_glaccount with key saknr = raw_itab-hkont.
if sy-subrc = 0.
raw_itab-fdgrv = i_glaccount-fdgrv.
raw_itab-cmgt_text = i_glaccount-textl.
endif.
endif.



select chect rwbtr znme1 rzawe
into corresponding fields of raw_itab
from payr where zbukr = raw_itab-bukrs
and vblnr = raw_itab-belnr
and ubhkt = raw_itab-b_hkont
and gjahr = raw_itab-gjahr.

endselect.

select txt50 into raw_itab-txt50
from skat
where saknr = raw_itab-hkont.

endselect.

clear raw_itab-name1.

select name1 into raw_itab-name1
from lfa1
where lifnr = raw_itab-lifnr.

endselect.

clear raw_itab-c_name1.

select name1 into raw_itab-name1
from kna1
where kunnr = raw_itab-kunnr.

endselect.

modify raw_itab.

i_hkont-hkont = raw_itab-b_hkont.
append i_hkont.

endloop.

sort i_hkont by hkont.
delete adjacent duplicates from i_hkont comparing hkont.

loop at i_hkont.
i_hkont-contr = cntr + 1.
modify i_hkont.
cntr = cntr + 1.
endloop.

**** Displaying the main data
perform display_data.
write:/ sy-uline.

**** Displaying the totals
perform total_data.

top-of-page.
if sy-pagno = 1.
format reset.
write:/4 'User Id :'.
write:20 sy-uname.

write: 40 'Date :'.
write: 55 sy-datum .

write :/4 'From Date :'.
write :20 s_valut-low .

write :40 'To Date :'.
write :55 s_valut-high.

write :/4 'From G/L Ac:'.
write :20 s_hkont-low.

write :40 'To G/L Ac :'.
write :55 s_hkont-high.
endif.
perform header_data.

end-of-page.
format reset.
write:/ sy-uline.
write:/240 'Page No.:', sy-pagno.

*---------------------------------------------------------------------*
* FORM header_data *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form header_data.
format color col_heading.
write:/ sy-uline.
write:/ sy-vline.
write:2 'Voucher No'.
write:13 sy-vline.
write:14 'Account'.
write:35 sy-vline.
write:36 'Paid To'.
write:57 sy-vline.
write:58 'Cheque No'.
write:69 sy-vline.
write:70 'Mode'.
write:75 sy-vline.
write:76 'Cash Management Group'.
write:111 sy-vline.
write:112 'Posting Date'.
write:125 sy-vline.

loop at i_hkont.
coln = 0.
coln = ( 21 * i_hkont-contr ) + 126.
write at coln i_hkont-hkont.
coln = coln + 20.
write at coln sy-vline.

select single txt50
into i_glname-txt50
from skat where saknr = i_hkont-hkont.

i_glname-contr = i_hkont-contr.
append i_glname.


endloop.
write:/ sy-vline.
write:13 sy-vline.
write:35 sy-vline.
write:57 sy-vline.
write:69 sy-vline.
write:75 sy-vline.
write:111 sy-vline.
write:125 sy-vline.

loop at i_glname.
coln = 0.
coln = ( 21 * i_glname-contr ) + 126.
write at coln i_glname-txt50+0(20).
coln = coln + 20.
write at coln sy-vline.
endloop.

write:/ sy-uline.
format reset.
endform.

*---------------------------------------------------------------------*
* FORM display_data *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form display_data.

loop at raw_itab.
format reset.
if v_toggle = 0.
format color col_normal.
v_toggle = 1.
else.
format color col_normal intensified.
v_toggle = 0.
endif.

write:/ sy-vline.
* SKIP 0.
write:2 raw_itab-belnr.
* write:13 sy-vline.
write:14 raw_itab-txt50+0(20).
* write:35 sy-vline.

" Display either Vendor or
" Customer Name
if not ( raw_itab-name1 is initial ).
write:36 raw_itab-name1+0(20).
else.
write:36 raw_itab-c_name1+0(20).
endif.

* write:57 sy-vline.
write:58 raw_itab-chect.
* write:69 sy-vline.
write:70 raw_itab-zlsch.
write:76 raw_itab-fdgrv,
raw_itab-cmgt_text.

************************Mandar*******************************
read table i_temp with key belnr = raw_itab-belnr
bukrs = raw_itab-bukrs
gjahr = raw_itab-gjahr.
if sy-subrc = 0.
write at 112 i_temp-budat.
endif.
*************************************************************

* write:75 sy-vline.

loop at i_hkont where hkont = raw_itab-b_hkont.
coln = 0.
coln = ( 21 * i_hkont-contr ) + 126.
if raw_itab-shkzg = 'H'. " Credit
v_dmbtr = ( -1 * raw_itab-dmbtr ).
write at coln v_dmbtr decimals 2 exponent 0 left-justified.
else.
v_dmbtr = raw_itab-dmbtr.
write at coln v_dmbtr
decimals 2 exponent 0 left-justified.
endif.
endloop.

loop at i_hkont.
coln = 0.
coln = ( 21 * i_hkont-contr ) + 126 + 20.
* write at coln sy-vline.

endloop.

endloop.
endform.

*---------------------------------------------------------------------*
* FORM total_data *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form total_data.
format reset.
format color col_total.
write:/.
write: sy-uline.
write:/.
*write:1 sy-vline.
write:2 'Total'.
*write:75 sy-vline.

loop at i_hkont.
account_total = 0.
loop at raw_itab where b_hkont = i_hkont-hkont.
if raw_itab-shkzg = 'H'. " Credit
account_total = account_total + ( -1 * ( raw_itab-dmbtr / 100 ) ).
else.
account_total = account_total + ( raw_itab-dmbtr / 100 ).
endif.
endloop.

coln = 0.
coln = ( 21 * i_hkont-contr ) + 126.
write at coln account_total decimals 2 exponent 0 left-justified.
coln = coln + 20.
* write at coln sy-vline.

endloop.
write:/ sy-uline.
format reset.
endform.

*-----Get cash management group
*-----------------------*
form get_cash_manage.
*-----------------------*
*******------------------- CUSTOMER
* Query for Cash management for each customer
select kunnr
fdgrv
fdgrv as ebene
into corresponding
fields of table *knb1
from knb1
for all entries in raw_itab
where kunnr = raw_itab-kunnr.

* Get Customer group wise description
select ebene
ltext
into corresponding fields of table *t036t
from t036t
for all entries in *knb1
where ebene = *knb1-ebene
and spras = 'EN'.

* Update the description at Customer - Cash Mgmt group level
sort *t036t by ebene.
loop at *knb1.
read table *t036t with key ebene = *knb1-ebene.
if sy-subrc eq 0.
*knb1-ltext = *t036t-ltext.
modify *knb1.
endif.

endloop.

*******------------------- VENDOR
* Query for Cash management for each vendor
select lifnr
fdgrv
fdgrv as grupp
into corresponding
fields of table *lfb1
from lfb1
for all entries in raw_itab
where lifnr = raw_itab-lifnr.

* Get Vendor group wise description
select grupp
textl
into corresponding fields of table *t035t
from t035t
for all entries in *lfb1
where grupp = *lfb1-grupp
and spras = 'EN'.

* Update the description at Vendor - Cash Mgmt group level
sort *t035t by grupp.
loop at *lfb1.
read table *t035t with key grupp = *lfb1-grupp.
if sy-subrc eq 0.
*lfb1-textl = *t035t-textl.
modify *lfb1.
endif.

endloop.

*--- One Time Vendor - Cash Mgmt. Group --- Amit Gore
select lifnr fdgrv fdgrv as grupp
into corresponding fields of table i_one_time_vendor
from zfi_onetimecash
for all entries in raw_itab
where lifnr = raw_itab-lifnr.
*--- Get Vendor group wise description --- Amit Gore
if not i_one_time_vendor[] is initial.
select grupp textl
into corresponding fields of table i_t035t
from t035t
for all entries in i_one_time_vendor
where spras eq 'EN' and
grupp eq i_one_time_vendor-grupp.
endif.
*--- Update the description at Vendor - Cash Mgmt group level
sort i_t035t by grupp.
loop at i_one_time_vendor.
read table i_t035t with key grupp = i_one_time_vendor-grupp.
if sy-subrc eq 0.
i_one_time_vendor-textl = i_t035t-textl.
modify i_one_time_vendor.
endif.
endloop.

*--- G/L Account - Cash Mgmt. Group
select saknr fdgrv fdgrv as grupp
into corresponding fields of table i_glaccount
from zfi_gl_cashmgmt
for all entries in raw_itab
where saknr = raw_itab-hkont.
*--- Get Vendor group wise description
if not i_glaccount[] is initial.
select grupp textl
into corresponding fields of table i_t035t_gl
from t035t
for all entries in i_glaccount
where spras eq 'EN' and
grupp eq i_glaccount-grupp.
endif.
*--- Update the description at Vendor - Cash Mgmt group level
sort i_t035t_gl by grupp.
loop at i_glaccount.
read table i_t035t_gl with key grupp = i_glaccount-grupp.
if sy-subrc eq 0.
i_glaccount-textl = i_t035t_gl-textl.
modify i_glaccount.
endif.
endloop.


*---- Post fetch sor the Vendor Customer groups
sort: *knb1 by kunnr,
*lfb1 by lifnr,
i_one_time_vendor by lifnr,
i_glaccount by saknr.
endform.

No comments:

link us...

For Visitors

if you want to publish or Add something on ERP, SAP , SAP FUNCTIONAL, SAP ABAP then mail us along with your email-id. contain must be yours

email-id :- avinashkr_raj@yahoo.com(any email)

email-id :- avinaskr_raj.abap@blogger.com ( use only gmail)