REPORT Z_FI_AR_CASH_RECPT LINE-SIZE 186 NO STANDARD PAGE HEADING
MESSAGE-ID 38.
*** Tables ----------------------------------------------------------***
TABLES: BSID, "Accounting: Secondary Index for Customers
BSAD, "Accounting: Secondary Index for Customers
BSEG, "Included only for select options to show the F4 values
BKPF, "Included only for select options to show the F4 values
KNA1, "General Data in Customer Master
KNB1, "Customer Master (Company Code)
VBRK, "Billing: Header Data
SKB1,
BSIS,
BSAS,
t001.
* PA0002."HR Master Record: Infotype 0002 (Personal Data)
DATA W_LINE TYPE I.
"(Cleared Items)
*** General Data ----------------------------------------------------***
TYPE-POOLS: SLIS.
DATA:
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
G_EXIT_CAUSED_BY_CALLER,
GS_EXIT_CAUSED_BY_USER TYPE SLIS_EXIT_BY_USER,
G_REPID LIKE SY-REPID,
I_CAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
I_CAT1 TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
I_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE.
* type lvc_t_fcat with header line.
*"Callback
DATA:
GT_EVENTS TYPE SLIS_T_EVENT,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
G_STATUS_SET TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',
G_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
G_TOP_OF_LIST TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST',
G_END_OF_LIST TYPE SLIS_FORMNAME VALUE 'END_OF_LIST',
G_AT_LINE_SELECTION TYPE SLIS_FORMNAME VALUE 'AT_LINE_SELECTION'.
*"Variants
DATA: GS_VARIANT LIKE DISVARIANT,
G_SAVE,
gs_LVC_S_GLAY like LVC_S_GLAY.
DATA WA_FCAT TYPE SLIS_FIELDCAT_ALV.
data: wa_bseg like bseg,
wa1_bseg like bseg,
wa3_bseg like bseg.
DATA: BEGIN OF EXPDAT,
OKCOD(4) TYPE C,
END OF EXPDAT,
HEADG1(20),
VALUE1(60),
HEADG2(40),
VALUE2(60),
VALUE3(60),
VALUE4(60),
VALUE5(60),
VALUE6(60).
*** Variable -----------------------------------------------------****
*** Internal Tables for First and Seconday List ------------------****
* <<>> 18.09.2003
DATA: BEGIN OF I_FTAB_M OCCURS 0,
BUKRS LIKE BSAD-BUKRS, "Company Code
KUNNR LIKE BSAD-KUNNR, "Customer Number
ZUONR LIKE BSAD-ZUONR, "Assignment Number
BELNR LIKE BSAD-BELNR, "Document Number
BUDAT LIKE BSAD-BUDAT, "Posting Date
XBLNR LIKE BKPF-XBLNR, "Reference No.
WAERS LIKE BSAD-WAERS, "Currency Key
KIDNO LIKE BSAD-KIDNO, "Payment Reference
BLART LIKE BSAD-BLART, "Document Type
BSCHL LIKE BSAD-BSCHL, "Posting Key
DMBTR LIKE BSAD-DMBTR, "Amount in Loc
WRBTR LIKE BSAD-WRBTR, "Amount in Doc
ZFBDT LIKE BSAD-ZFBDT, "Bline Date
AUGBL LIKE BSAD-AUGBL, "Clearing Doc no.
AUGDT LIKE BSAD-AUGDT, "Clearing Date
SHKZG LIKE BSAD-SHKZG, "Debit/ Credit Indicator
BUZEI LIKE BSAD-BUZEI, "Line item Number
GJAHR LIKE BSAD-GJAHR, "Fiscal Year
REBZG LIKE BSID-REBZG, "Number of the Invoice the Transaction
"Belongs to
REBZJ LIKE BSID-REBZJ,
MONAT LIKE BSID-MONAT,
CPUDT LIKE BSID-CPUDT,
BLDAT LIKE BSID-BLDAT,
FLAG(1) TYPE C,
TCODE LIKE BKPF-TCODE,
NAME1 LIKE KNA1-NAME1, "Customer Name
ORT01 LIKE KNA1-ORT01, "Customer City
PERNR LIKE KNB1-PERNR, "Account Manager Code
CNAME LIKE PA0002-CNAME,"Account Manager Name
INV_DMBTR LIKE BSAD-DMBTR, "Invoice Amount in LOC
INV_WRBTR LIKE BSAD-WRBTR, "Invoice Amount in DOC
VALUT LIKE BSEG-VALUT,
MON1 LIKE BSAD-WRBTR,
MON2 LIKE BSAD-WRBTR,
MON3 LIKE BSAD-WRBTR,
MON4 LIKE BSAD-WRBTR,
MON5 LIKE BSAD-WRBTR,
MON6 LIKE BSAD-WRBTR,
MON7 LIKE BSAD-WRBTR,
MON8 LIKE BSAD-WRBTR,
MON9 LIKE BSAD-WRBTR,
MON10 LIKE BSAD-WRBTR,
MON11 LIKE BSAD-WRBTR,
MON12 LIKE BSAD-WRBTR,
CALFLAG(1) TYPE C,
GTOTAL LIKE BSAD-WRBTR,
VBELN LIKE VBRK-VBELN,
FKDAT LIKE VBRK-FKDAT,
ACNO LIKE BSIS-HKONT,
BKTXT LIKE BKPF-BKTXT,
BWAERS LIKE BSIS-WAERS,
BAMTLC LIKE BSIS-DMBTR,
BAMTDC LIKE BSIS-WRBTR,
BBUDAT LIKE BSIS-BUDAT,
KURSF LIKE BKPF-KURSF,
DUPFLAG(3) TYPE C,
HBKID LIKE SKB1-HBKID,
LINECOLOR(4) TYPE C,
END OF I_FTAB_M.
DATA : I_FTAB_MC LIKE I_FTAB_M OCCURS 0 WITH HEADER LINE,
I_TEMP LIKE I_FTAB_M OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_BSAD OCCURS 0,
BUKRS LIKE BSAD-BUKRS, "Company Code
KUNNR LIKE BSAD-KUNNR, "Customer Number
ZUONR LIKE BSAD-ZUONR, "Assignment Number
BELNR LIKE BSAD-BELNR, "Document Number
BUDAT LIKE BSAD-BUDAT, "Posting Date
XBLNR LIKE BKPF-XBLNR,
WAERS LIKE BSAD-WAERS, "Currency Key
KIDNO LIKE BSAD-KIDNO, "Payment Reference
BLART LIKE BSAD-BLART, "Document Type
BSCHL LIKE BSAD-BSCHL, "Posting Key
DMBTR LIKE BSAD-DMBTR, "Amount in Loc
WRBTR LIKE BSAD-WRBTR, "Amount in Doc
ZFBDT LIKE BSAD-ZFBDT, "Bline Date
AUGBL LIKE BSAD-AUGBL, "Clearing Doc no.
AUGDT LIKE BSAD-AUGDT, "Clearing Date
SHKZG LIKE BSAD-SHKZG, "Debit/ Credit Indicator
BUZEI LIKE BSAD-BUZEI, "Line item Number
GJAHR LIKE BSAD-GJAHR, "Fiscal Year
REBZG LIKE BSID-REBZG, "Number of the Invoice the Transaction
"Belongs to
REBZJ LIKE BSID-REBZJ,
MONAT LIKE BSID-MONAT,
CPUDT LIKE BSID-CPUDT,
BLDAT LIKE BSID-BLDAT,
FLAG(1) TYPE C,
TCODE LIKE BKPF-TCODE,
BKTXT LIKE BKPF-BKTXT,
END OF I_BSAD.
DATA : I_BSAD_TEMP LIKE I_bsad OCCURS 0 WITH HEADER LINE,
BEGIN OF I_BKPF OCCURS 10,
BUKRS LIKE BSAD-BUKRS,
BELNR LIKE BSAD-BELNR,
GJAHR LIKE BSAD-GJAHR,
END OF I_BKPF,
BEGIN OF I_BSID_TEMP OCCURS 10,
BUKRS LIKE BSID-BUKRS,
KUNNR LIKE BSID-KUNNR,
GJAHR LIKE BSID-GJAHR,
BELNR LIKE BSID-BELNR,
DMBTR LIKE BSID-DMBTR,
WRBTR LIKE BSID-WRBTR,
END OF I_BSID_TEMP,
begin of i_kna1 occurs 25,
kunnr like kna1-kunnr,
name1 like kna1-name1,
ort01 like kna1-ort01,
end of i_kna1,
begin of i_knb1 occurs 25,
kunnr like knb1-kunnr,
bukrs like knb1-bukrs,
pernr like knb1-pernr,
end of i_knb1,
begin of i_pa0002 occurs 25,
pernr like pa0002-pernr,
vnamc like pa0002-vnamc,
nchmc like pa0002-nchmc,
end of i_pa0002.
DATA : BEGIN OF I_DATES OCCURS 0,
CTR TYPE I,
DATES LIKE SY-DATUM,
DATEE LIKE SY-DATUM,
FORMAT(8) TYPE C,
COL(14),
END OF I_DATES.
FIELD-SYMBOLS:
DATA : W_FORMAT(8),
W_COL TYPE I,
W_COLC(2) TYPE C,
W_MON1 LIKE BSAD-WRBTR,
W_MON2 LIKE BSAD-WRBTR,
W_MON3 LIKE BSAD-WRBTR,
W_MON4 LIKE BSAD-WRBTR,
W_MON5 LIKE BSAD-WRBTR,
W_MON6 LIKE BSAD-WRBTR,
W_MON7 LIKE BSAD-WRBTR,
W_MON8 LIKE BSAD-WRBTR,
W_MON9 LIKE BSAD-WRBTR,
W_MON10 LIKE BSAD-WRBTR,
W_MON11 LIKE BSAD-WRBTR,
W_MON12 LIKE BSAD-WRBTR.
DATA : W_BUDATL LIKE SY-DATUM,
W_LIN TYPE I.
DATA : W_BSAD LIKE I_BSAD,
W_TABIX LIKE SY-TABIX,
W_INDEX LIKE SY-TABIX,
W_IDEX LIKE SY-TABIX,
W_IND LIKE SY-TABIX,
W_DATES(100),
W_DATE1(10),
W_DATE2(10),
W_DMBTR LIKE BSID-DMBTR,
W_WRBTR LIKE BSID-WRBTR.
DATA: BEGIN OF I_FTAB_S OCCURS 0,
XXXX TYPE C,
END OF I_FTAB_S.
DATA : P_DEL(1) TYPE C,
W_DOWN_DATE LIKE SY-DATUM,
W_DOWN_TIME LIKE SY-UZEIT.
*DATA: I_TAB LIKE ZST_MAX_LINE OCCURS 0 WITH HEADER LINE.
data: begin of i_tab occurs 0,
line(2500),
end of i_tab.
data: begin of i_augbl occurs 0,
augbl like bseg-augbl,
* ACNO LIKE BSIS-HKONT,
end of i_augbl.
data: wa2_bseg like bseg,
wa_vbrk like vbrk.
data: v_dmbtr like bseg-dmbtr,
v_wrbtr like bseg-wrbtr.
*** Select-options -----------------------------------------------***
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
*SELECT-OPTIONS : S_HKONT FOR BSEG-HKONT,
* DEFAULT '252001' OBLIGATORY,
SELECT-OPTIONS : S_BUDAT FOR BSAD-BUDAT OBLIGATORY,
S_BUKRS FOR BSAD-BUKRS OBLIGATORY,
S_KUNNR FOR BSAD-KUNNR.
* S_BLART FOR BKPF-BLART.
parameters: S_BHKONT like BSIS-HKONT.
* S_HBKID FOR SKB1-HBKID.
SELECTION-SCREEN SKIP.
*SELECTION-SCREEN BEGIN OF BLOCK DETAILS WITH FRAME.
*PARAMETERS : P_DET RADIOBUTTON GROUP RAD1,
* P_CUS RADIOBUTTON GROUP RAD1.
*SELECTION-SCREEN END OF BLOCK DETAILS.
SELECTION-SCREEN BEGIN OF BLOCK BANK WITH FRAME.
*PARAMETERS : CH_BANK AS CHECKBOX.
PARAMETERS : P_DOWN AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK BANK.
SELECTION-SCREEN END OF BLOCK B1.
*** initialization -----------------------------------------------***
INITIALIZATION.
* ALV Processing
G_REPID = SY-REPID.
PERFORM LAYOUT_INIT USING GS_LAYOUT.
PERFORM EVENTTAB_BUILD USING GT_EVENTS[].
GS_VARIANT-REPORT = G_REPID.
G_SAVE = 'A'.
gs_LVC_S_GLAY-TOP_P_ONLY = 'X'.
* append gs_LVC_S_GLAY.
AT SELECTION-SCREEN.
*Building Field Catalogue
CLEAR: I_DATES, I_CAT.
REFRESH: I_DATES, I_CAT.
* IF P_DET EQ 'X'.
PERFORM BUILD_FIELD_CATALOGUE.
* ELSE.
** PERFORM FORMAT_FOR_CUSTOMER_WISE_DATA.
** PERFORM BUILD_FIELD_CATALOGUE_CUSTOMER.
* ENDIF.
DESCRIBE TABLE I_DATES LINES W_LIN.
IF W_LIN > 12.
MESSAGE E000 WITH 'The Period Gap sould be of one year only'.
ENDIF.
IF P_DOWN = ''.
IF S_BUDAT-HIGH IS INITIAL.
MESSAGE E000 WITH 'Pls. fill the To Date also'.
ENDIF.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_DOWN' OR SCREEN-NAME = '%_P_DOWN_%_APP_%-TEXT'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
IF P_DOWN = 'X'.
LOOP AT S_BUDAT.
S_BUDAT-HIGH = SY-DATUM.
MODIFY S_BUDAT.
ENDLOOP.
ENDIF.
START-OF-SELECTION.
PERFORM GET_DATA.
*** BM by Vanitha 21.06.2005
PERFORM DELETE_NOT_IN_BANKGL.
*** EM by Vanitha 21.06.2005
* IF P_DET EQ 'X'.
PERFORM SORT_DATA.
* ELSE.
** PERFORM ARRANGE_CUSTOMER_WISE_DATA.
* ENDIF.
IF P_DOWN = 'X'.
PERFORM TRANSFER_DATA.
EXIT.
ENDIF.
* IF P_DET EQ 'X'.
PERFORM DISPLAY.
* ELSE.
* PERFORM DISPLAY_CUSTOMER.
* ENDIF.
*top-of-page.
*perform TOP_OF_PAGE.
*---------------------------------------------------------------------*
* FORM comment_build *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> lt_top_of_page *
*---------------------------------------------------------------------*
FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE
SLIS_T_LISTHEADER.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
HEADG1 = 'Collection Report'.
VALUE1 = ''.
CONCATENATE S_BUDAT-LOW+6(2) '.' S_BUDAT-LOW+4(2) '.' S_BUDAT-LOW+0(4)
INTO W_DATE1.
CONCATENATE S_BUDAT-HIGH+6(2) '.' S_BUDAT-HIGH+4(2) '.'
S_BUDAT-HIGH+0(4) INTO W_DATE2.
CONCATENATE W_DATE1 'to' W_DATE2 INTO W_DATES
SEPARATED BY SPACE.
HEADG2 = 'From Posting Period'.
VALUE2 = W_DATES.
* VALUE3 = 'P - Partially Cleared Remittance'.
* VALUE4 = 'F - Fully Cleared Remittance'.
* VALUE5 = 'X - Fully Cleared Invoice'.
* VALUE6 = 'U - Unassigned'.
FREE LT_TOP_OF_PAGE.
* LIST HEADING LINE: TYPE H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
LS_LINE-INFO = 'Mattson Technologies Inc,'.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
* STATUS LINE: TYPE S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = HEADG1.
LS_LINE-INFO = VALUE1.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
LS_LINE-KEY = HEADG2.
LS_LINE-INFO = VALUE2.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-INFO = VALUE3.
* APPEND LS_LINE TO LT_TOP_OF_PAGE.
*
* LS_LINE-INFO = VALUE4.
* APPEND LS_LINE TO LT_TOP_OF_PAGE.
*
* LS_LINE-INFO = VALUE5.
* APPEND LS_LINE TO LT_TOP_OF_PAGE.
*
* LS_LINE-INFO = VALUE6.
* APPEND LS_LINE TO LT_TOP_OF_PAGE.
ENDFORM. " COMMENT_BUILD
*---------------------------------------------------------------------*
* FORM layout_init *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> rs_layout *
*---------------------------------------------------------------------*
FORM LAYOUT_INIT USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.
RS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
RS_LAYOUT-DETAIL_POPUP = 'X'.
RS_LAYOUT-ZEBRA = 'X'.
RS_LAYOUT-DETAIL_INITIAL_LINES = 'X'.
* rs_layout-f2code = '&ETA'.
ENDFORM. " LAYOUT_INIT
*---------------------------------------------------------------------*
* FORM eventtab_build *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> rt_events *
*---------------------------------------------------------------------*
FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.
*"Registration of events to happen during list display
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
*
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = RT_EVENTS.
READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE G_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO RT_EVENTS.
ENDIF.
READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE G_USER_COMMAND TO LS_EVENT-FORM.
APPEND LS_EVENT TO RT_EVENTS.
ENDIF.
ENDFORM. " EVENTTAB_BUILD
*---------------------------------------------------------------------*
* FORM build_field_catalogue *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM BUILD_FIELD_CATALOGUE.
PERFORM ADD_FIELDCAT USING:
1 'KUNNR' 'I_FTAB_M' 'BSID' 'KUNNR' '' 'Customer Code' '' 'L' '' '' ''
'',
2 'NAME1' 'I_FTAB_M' 'KNA1' 'NAME1' '' 'Customer Name' '' 'L' '' '' ''
'',
3 'BELNR' 'I_FTAB_M' 'BSID' 'BELNR' '' 'Document Number' '' 'L' 'X'
'' '' '',
4 'AUGBL' 'I_FTAB_M' 'BSID' 'AUGBL' '' 'Clearing Document' '' 'L' ''
'' '' '',
5 'BLDAT' 'I_FTAB_M' 'BSID' 'BLDAT' '' 'Document Date' '' 'L' '' ''
'' '',
6 'BUDAT' 'I_FTAB_M' 'BSID' 'BUDAT' '' 'Posting Date' '' 'L' '' '' ''
'',
7 'XBLNR' 'I_FTAB_M' 'BKPF' 'XBLNR' '' 'Bill. Doc. Number' '' 'L' ''
'' '' '',
8 'BWAERS' 'I_FTAB_M' 'BSIS' 'WAERS' '' 'Loc. Curr' '' 'L' '' '' ''
'',
9 'WAERS' 'I_FTAB_M' 'BSID' 'WAERS' '' 'Doc. Curr' '' 'L' '' '' '' '',
* 10 'DMBTR' 'I_FTAB_M' 'BSID' 'DMBTR' '' 'Chk.Amt. in Loc' 'X' 'R' ''
*''
* '' '',
10 'DMBTR' 'I_FTAB_M' 'BSID' 'DMBTR' '' 'Chk.Amt. in Loc' 'X' 'R' ''
'' 'BWAERS' 'I_FTAB_M',
11 'WRBTR' 'I_FTAB_M' 'BSID' 'WRBTR' '' 'Chk.Amt. in Doc' 'X' 'R' '' ''
'WAERS' 'BSID',
* 12 'INV_DMBTR' 'I_FTAB_M' 'BSID' 'WRBTR' '' 'Inv. Amt. in Loc' 'X'
*'R'
* '' '' '' '',
12 'INV_DMBTR' 'I_FTAB_M' 'BSID' 'WRBTR' '' 'Inv. Amt. in Loc' 'X' 'R'
'' ''
'BWAERS' 'I_FTAB_M',
13 'INV_WRBTR' 'I_FTAB_M' 'BSID' 'WRBTR' '' 'Inv. Amt in Doc' 'X' 'R'
'' '' 'WAERS' 'BSID',
14 'ACNO' 'I_FTAB_M' 'BSID' 'HKONT' '' 'Bank GL A/c' '' 'L' '' '' ''
'',
15 'BKTXT' 'I_FTAB_M' 'BKPF' 'BKTXT' '' 'Check Number' '' 'L' '' ''
''
'',
16 'BAMTLC' 'I_FTAB_M' 'BSID' 'DMBTR' '' 'Bank Charges' 'X' 'R' '' ''
'' '',
17 'BAMTDC' 'I_FTAB_M' 'BSID' 'DMBTR' '' 'Net Amt.' 'X' 'R' '' ''
'' ''.
* 17 'BAMTDC' 'I_FTAB_M' 'BSID' 'WRBTR' '' 'Bank Amt. DC' 'X' 'R' '' ''
* 'WAERS' 'BSIS'.
* PERFORM ADD_FIELDCAT USING:
* 1 'BUKRS' 'I_FTAB_M' 'BSID' 'BUKRS' '' 'Company Code' '' 'L' '' '' ''
*'',
* 2 'KUNNR' 'I_FTAB_M' 'BSID' 'KUNNR' '' 'Customer Code' '' 'L' '' ''
*'' '',
* 3 'NAME1' 'I_FTAB_M' 'KNA1' 'NAME1' '' 'Customer Name' '' 'L' '' ''
*'' '',
* 4 'ORT01' 'I_FTAB_M' 'KNA1' 'ORT01' '' 'Customer City' '' 'L' '' 'X'
*'' '',
* 5 'PERNR' 'I_FTAB_M' 'KNB1' 'PERNR' '' 'A/c Manager' '' 'L' '' '' ''
*'',
* 6 'CNAME' 'I_FTAB_M' 'PA0002' 'CNAME' '' 'A/c Mgr. Name' '' 'L' '' ''
*'' '',
* 7 'KIDNO' 'I_FTAB_M' 'BSID' 'KIDNO' '' 'Inv. Ref. Number' '' 'L' ''
*'' '' '',
* 8 'FKDAT' 'I_FTAB_M' 'VBRK' 'FKDAT' '' 'Inv. Date' '' 'L' '' '' ''
*'',
* 9 'ZUONR' 'I_FTAB_M' 'BSID' 'ZUONR' '' 'Assignment Number' '' 'L' ''
*'' '' '',
* 10 'BELNR' 'I_FTAB_M' 'BSID' 'BELNR' '' 'Document Number' '' 'L' 'X'
*'' '' '',
* 11 'BLDAT' 'I_FTAB_M' 'BSID' 'BLDAT' '' 'Document Date' '' 'L' '' 'X'
* '' '',
* 12 'CPUDT' 'I_FTAB_M' 'BSID' 'CPUDT' '' 'Entry Date' '' 'L' '' 'X'
* '' '',
* 13 'BUDAT' 'I_FTAB_M' 'BSID' 'BUDAT' '' 'Posting Date' '' 'L' '' ''
*'' '',
* 14 'GJAHR' 'I_FTAB_M' 'BSID' 'GJAHR' '' 'Fiscal Year' '' 'L' '' '' ''
*'',
* 15 'AUGBL' 'I_FTAB_M' 'BSID' 'AUGBL' '' 'Clearing Document' '' 'L' ''
*'' '' '',
* 16 'AUGDT' 'I_FTAB_M' 'BSID' 'AUGDT' '' 'Clearing Date' '' 'L' '' ''
*'' '',
* 17 'BLART' 'I_FTAB_M' 'BSID' 'BLART' '' 'Document Type' '' 'L' '' ''
*'' '',
* 18 'BSCHL' 'I_FTAB_M' 'BSID' 'BSCHL' '' 'Posting Key' '' 'L' '' 'X'
*'' '',
* 19 'WAERS' 'I_FTAB_M' 'BSID' 'WAERS' '' 'Currency' '' 'L' '' '' ''
*'',
* 20 'DMBTR' 'I_FTAB_M' 'BSID' 'DMBTR' '' 'Amount in Loc' 'X' 'R' '' ''
*'' '',
* 21 'WRBTR' 'I_FTAB_M' 'BSID' 'WRBTR' '' 'Amount in Doc' 'X' 'R' '' ''
*'WAERS' 'BSID',
* 22 'INV_DMBTR' 'I_FTAB_M' 'BSID' 'WRBTR' '' 'Inv. Amt. in Loc' 'X'
*'R' '' '' '' '',
* 23 'INV_WRBTR' 'I_FTAB_M' 'BSID' 'WRBTR' '' 'Inv. Amt in Doc' 'X' 'R'
*'' '' 'WAERS' 'BSID',
* 24 'ZFBDT' 'I_FTAB_M' 'BSID' 'ZFBDT' '' 'Bline Date' '' 'L' '' '' ''
*'',
* 25 'FLAG' 'I_FTAB_M' '' '' '' 'Status' '' 'L' '' '' '' '',
* 26 'MONAT' 'I_FTAB_M' 'BSID' 'MONAT' '' 'Period' '' 'L' '' 'X' '' ''.
** IF CH_BANK = 'X'.
* PERFORM ADD_FIELDCAT USING:
* 27 'ACNO' 'I_FTAB_M' 'BSID' 'HKONT' '' 'Bank GL A/c' '' 'L' '' '' ''
* '',
* 28 'BWAERS' 'I_FTAB_M' 'BSIS' 'WAERS' '' 'Doc. Curr' '' 'L' '' '' ''
* '',
* 29 'KURSF' 'I_FTAB_M' 'BKPF' 'KURSF' '' 'Exchange Rate' '' 'R' '' ''
* '' '',
* 30 'BAMTLC' 'I_FTAB_M' 'BSID' 'DMBTR' '' 'Bank Amt. LC' 'X' 'R' '' ''
* '' '',
* 31 'BAMTDC' 'I_FTAB_M' 'BSID' 'WRBTR' '' 'Bank Amt. DC' 'X' 'R' '' ''
* 'WAERS' 'BSIS',
* 32 'BBUDAT' 'I_FTAB_M' 'BSIS' 'BUDAT' '' 'Posting Date' 'X' 'R' '' ''
*'' '',
* 33 'HBKID' 'I_FTAB_M' 'SKB1' 'HBKID' '' 'House Bank' 'X' 'R' '' '' ''
*'',
* 34 'DUPFLAG' 'I_FTAB_M' '' '' '' 'Duplicate Flag' 'X' 'L' '' '' ''
*''.
* ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM add_fieldcat *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> &01 *
* --> &02 *
* --> &03 *
* --> &04 *
* --> &05 *
* --> &06 *
* --> &07 *
* --> &08 *
* --> &09 *
* --> &10 *
*---------------------------------------------------------------------*
FORM ADD_FIELDCAT USING &01 &02 &03 &04 &05
&06 &07 &08 &09 &10 &11 &12 &13.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = &01.
WA_FCAT-FIELDNAME = &02.
WA_FCAT-TABNAME = &03.
WA_FCAT-REF_TABNAME = &04.
WA_FCAT-REF_FIELDNAME = &05.
WA_FCAT-KEY = &06.
* Field Lable's
WA_FCAT-SELTEXT_M = &07.
WA_FCAT-REPTEXT_DDIC = &07.
WA_FCAT-DDICTXT = 'M'.
WA_FCAT-DO_SUM = &08.
WA_FCAT-JUST = &09.
IF &10 = 'X'.
* C: Color (coding must begin with C)
* x: color number
* y: bold
* z: inverse
WA_FCAT-EMPHASIZE = 'C410'.
ENDIF.
WA_FCAT-NO_OUT = &11.
WA_FCAT-CFIELDNAME = &12.
WA_FCAT-CTABNAME = &13.
APPEND WA_FCAT TO I_CAT.
ENDFORM.
*---------------------------------------------------------------------*
* FORM top_of_page *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM.
*---------------------------------------------------------------------*
* FORM display *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM DISPLAY.
PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
*"Display List
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BYPASSING_BUFFER = 'X'
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_USER_COMMAND = G_USER_COMMAND
I_GRID_SETTINGS = gs_LVC_S_GLAY
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = I_CAT[]
I_SAVE = G_SAVE
IS_VARIANT = GS_VARIANT
IT_EVENTS = GT_EVENTS[]
IT_SORT = I_SORT[]
IMPORTING
E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = I_FTAB_M[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC = 0.
IF G_EXIT_CAUSED_BY_CALLER = 'X'.
*" Forced Exit by calling program
*"
ELSE.
*" User left list via F3, F12 or F15
IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'. "F3
*"
ELSE.
IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'. "F15
*"
ELSE.
IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12
*"
ELSE.
*" should not occur!
*"
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
*"Fatal error callin ALV
* MESSAGE AXXX(XY) WITH ...
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM get_data *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM GET_DATA.
*---------------------------------------------------------------------*
* WHOLE LOGIC OF THE REPORT IS AS FOLLOWS.
* data from BSID table is selected with corresponding values from
* selection screen where posting key is 5 and 15 the same thing is done
* for BSAD table also.
SELECT BUKRS KUNNR ZUONR BELNR BUDAT WAERS KIDNO BLART BSCHL
DMBTR WRBTR ZFBDT AUGBL AUGDT SHKZG BUZEI GJAHR REBZG
REBZJ MONAT CPUDT BLDAT
INTO CORRESPONDING FIELDS OF TABLE I_FTAB_M
FROM BSID
WHERE BUKRS IN S_BUKRS AND
KUNNR IN S_KUNNR AND
BUDAT IN S_BUDAT AND
* BLART IN S_BLART and
( ( BSCHL IN ('05', '15') ) OR
( BSCHL IN ('09', '19') ) ).
* AND UMSKZ = 'D' ) ).
*
* ( ( HKONT IN S_HKONT AND
* BSCHL IN ('05', '15') ) OR
* ( SAKNR IN S_HKONT AND
* BSCHL IN ('09', '19') AND
* UMSKZ = 'D' ) ).
REFRESH I_TEMP.
CLEAR I_TEMP.
I_TEMP[] = I_FTAB_M[].
DELETE I_TEMP WHERE BSCHL NE '09' AND
BSCHL NE '19'.
DELETE I_FTAB_M WHERE BSCHL EQ '09' OR
BSCHL EQ '19'.
DESCRIBE TABLE I_TEMP LINES W_LINE.
IF W_LINE GT 0.
LOOP AT I_TEMP.
I_TEMP-TCODE = 'FBZ1'.
MODIFY I_TEMP TRANSPORTING TCODE.
ENDLOOP.
SELECT BUKRS BELNR GJAHR INTO TABLE I_BKPF FROM BKPF
FOR ALL ENTRIES IN I_TEMP
WHERE BUKRS = I_TEMP-BUKRS AND
BELNR = I_TEMP-BELNR AND
GJAHR = I_TEMP-GJAHR AND
TCODE = I_TEMP-TCODE.
ENDIF.
CLEAR W_LINE.
DESCRIBE TABLE I_BKPF LINES W_LINE.
IF W_LINE EQ 0.
REFRESH I_TEMP. CLEAR I_TEMP.
ELSE.
LOOP AT I_BKPF.
DO.
READ TABLE I_TEMP WITH KEY BUKRS = I_BKPF-BUKRS
BELNR = I_BKPF-BELNR
GJAHR = I_BKPF-GJAHR
FLAG = ' '.
W_IND = SY-TABIX.
IF SY-SUBRC = 0.
I_TEMP-FLAG = 'X'.
MODIFY I_TEMP INDEX W_IND.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
DELETE I_TEMP WHERE FLAG NE 'X'.
ENDIF.
* move-corresponding i_temp to i_ftab_m.
* append i_ftab_m.
APPEND LINES OF I_TEMP TO I_FTAB_M.
REFRESH: I_TEMP, I_BKPF.
CLEAR : I_TEMP, I_BKPF.
I_TEMP[] = I_FTAB_M[].
DELETE I_TEMP WHERE KIDNO IS INITIAL.
DELETE I_FTAB_M WHERE NOT KIDNO IS INITIAL.
DESCRIBE TABLE I_TEMP LINES W_LINE.
IF W_LINE GT 0.
SELECT BUKRS KUNNR GJAHR BELNR DMBTR WRBTR
INTO TABLE I_BSID_TEMP FROM BSID
FOR ALL ENTRIES IN I_TEMP
WHERE BUKRS EQ I_TEMP-BUKRS AND
KUNNR EQ I_TEMP-KUNNR AND
GJAHR EQ I_TEMP-REBZJ AND "Rajit
BELNR EQ I_TEMP-REBZG.
LOOP AT I_TEMP.
READ TABLE I_BSID_TEMP WITH KEY BUKRS = I_TEMP-BUKRS
KUNNR = I_TEMP-KUNNR
GJAHR = I_TEMP-REBZJ
BELNR = I_TEMP-REBZG.
IF SY-SUBRC = 0.
I_TEMP-INV_DMBTR = I_BSID_TEMP-DMBTR.
I_TEMP-INV_WRBTR = I_BSID_TEMP-WRBTR.
ENDIF.
I_TEMP-FLAG = 'P'.
MODIFY I_TEMP TRANSPORTING INV_DMBTR INV_WRBTR FLAG.
ENDLOOP.
ENDIF.
APPEND LINES OF I_TEMP TO I_FTAB_M.
REFRESH: I_TEMP, I_BSID_TEMP.
CLEAR : I_TEMP, I_BSID_TEMP.
SELECT BUKRS KUNNR ZUONR BELNR BUDAT WAERS KIDNO BLART BSCHL
DMBTR WRBTR ZFBDT AUGBL AUGDT SHKZG BUZEI GJAHR REBZG
REBZJ MONAT CPUDT BLDAT
INTO CORRESPONDING FIELDS OF TABLE I_TEMP
FROM BSAD
WHERE BUKRS IN S_BUKRS AND
KUNNR IN S_KUNNR AND
BUDAT IN S_BUDAT AND
* BLART IN S_BLART and
( ( BSCHL IN ('05', '15') ) OR
( BSCHL IN ('09', '19') ) ).
* AND UMSKZ = 'D' ) ).
* ( ( HKONT IN S_HKONT AND
* BSCHL IN ('05', '15') ) OR
* ( SAKNR IN S_HKONT AND
* BSCHL IN ('09', '19') AND
* UMSKZ = 'D' ) ).
I_BSAD_TEMP[] = I_TEMP[].
DELETE I_BSAD_TEMP WHERE BSCHL NE '09' AND
BSCHL NE '19'.
DELETE I_TEMP WHERE BSCHL EQ '09' OR
BSCHL EQ '19'.
DESCRIBE TABLE I_BSAD_TEMP LINES W_LINE.
IF W_LINE GT 0.
LOOP AT I_BSAD_TEMP.
I_BSAD_TEMP-TCODE = 'FBZ1'.
MODIFY I_BSAD_TEMP TRANSPORTING TCODE.
ENDLOOP.
BUKRS BELNR GJAHR INTO TABLE I_BKPF FROM BKPF
FOR ALL ENTRIES IN I_BSAD_TEMP
WHERE BUKRS = I_BSAD_TEMP-BUKRS AND
BELNR = I_BSAD_TEMP-BELNR AND
GJAHR = I_BSAD_TEMP-GJAHR AND
TCODE = I_BSAD_TEMP-TCODE.
ENDIF.
CLEAR W_LINE.
DESCRIBE TABLE I_BKPF LINES W_LINE.
IF W_LINE EQ 0.
REFRESH I_BSAD_TEMP. CLEAR I_BSAD_TEMP.
ELSE.
LOOP AT I_BKPF.
DO.
READ TABLE I_BSAD_TEMP WITH KEY BUKRS = I_BKPF-BUKRS
BELNR = I_BKPF-BELNR
GJAHR = I_BKPF-GJAHR
FLAG = ''.
W_IND = SY-TABIX.
IF SY-SUBRC = 0.
I_BSAD_TEMP-FLAG = 'X'.
MODIFY I_BSAD_TEMP INDEX W_IND.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
DELETE I_BSAD_TEMP WHERE FLAG NE 'X'.
ENDIF.
APPEND LINES OF I_BSAD_TEMP TO I_TEMP.
REFRESH: I_BSAD_TEMP, I_BKPF.
CLEAR : I_BSAD_TEMP, I_BKPF.
LOOP AT I_TEMP.
MOVE 'F' TO I_TEMP-FLAG.
MOVE ' ' TO I_TEMP-TCODE.
MODIFY I_TEMP TRANSPORTING FLAG TCODE.
ENDLOOP.
DESCRIBE TABLE I_TEMP LINES W_LINE.
IF W_LINE GT 0.
SELECT BUKRS KUNNR ZUONR BELNR BUDAT WAERS KIDNO BLART BSCHL
DMBTR WRBTR ZFBDT AUGBL AUGDT SHKZG BUZEI GJAHR REBZG
REBZJ MONAT CPUDT BLDAT
INTO CORRESPONDING FIELDS OF TABLE I_BSAD
FROM BSAD
FOR ALL ENTRIES IN I_TEMP
WHERE BUKRS EQ I_TEMP-BUKRS AND
AUGDT EQ I_TEMP-AUGDT AND
AUGBL EQ I_TEMP-AUGBL AND
BSCHL NE I_TEMP-BSCHL.
ENDIF.
LOOP AT I_BSAD.
READ TABLE I_TEMP WITH KEY AUGBL = I_BSAD-AUGBL
BELNR = I_BSAD-BELNR.
IF SY-SUBRC = 0.
MOVE 'F' TO I_BSAD-FLAG.
ELSE.
MOVE 'X' TO I_BSAD-FLAG.
ENDIF.
MODIFY I_BSAD TRANSPORTING FLAG.
ENDLOOP.
APPEND LINES OF I_TEMP TO I_BSAD.
REFRESH I_TEMP. CLEAR I_TEMP.
FREE : I_BSAD_TEMP, I_BSID_TEMP, I_BKPF.
SORT I_BSAD BY BUKRS
KUNNR
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
FLAG
BSCHL ASCENDING.
DELETE ADJACENT DUPLICATES FROM I_BSAD COMPARING ALL FIELDS.
SORT I_BSAD BY BUKRS KUNNR AUGBL FLAG BSCHL ASCENDING.
APPEND LINES OF I_BSAD TO I_FTAB_M.
*describe table s_blart lines w_line.
*if w_line gt 0.
*delete i_ftab_m where not blart in s_blart.
*endif.
describe table i_ftab_m lines w_line.
if w_line gt 0.
* Customer name and city
SELECT kunnr NAME1 ORT01
INTO corresponding fields of table i_kna1
FROM KNA1
for all entries in i_ftab_m
WHERE KUNNR EQ I_FTAB_M-KUNNR.
* Account Manager Details
* SELECT kunnr bukrs pernr
* into corresponding fields of table i_knb1
* FROM KNB1
* for all entries in i_ftab_m
* WHERE KUNNR EQ I_FTAB_M-KUNNR AND
* BUKRS EQ I_FTAB_M-BUKRS.
* describe table i_knb1 lines w_line.
* if w_line gt 0.
* SELECT pernr vnamc nchmc
* into corresponding fields of table i_pa0002
* FROM PA0002
* for all entries in i_knb1
* WHERE PERNR EQ i_knb1-PERNR.
* endif.
endif.
* moving Debit Credit Indicator
LOOP AT I_FTAB_M.
CLEAR: I_FTAB_M-BAMTLC, I_FTAB_M-BAMTDC, I_FTAB_M-KURSF.
W_TABIX = SY-TABIX.
IF I_FTAB_M-SHKZG EQ 'H'.
I_FTAB_M-DMBTR = I_FTAB_M-DMBTR * -1.
I_FTAB_M-WRBTR = I_FTAB_M-WRBTR * -1.
ENDIF.
* Customer name and city
Read table i_kna1 with key kunnr = i_ftab_m-kunnr.
if sy-subrc = 0.
I_FTAB_M-NAME1 = i_kna1-name1.
I_FTAB_M-ORT01 = i_kna1-ort01.
endif.
* Account Manager Details
* Read table i_knb1 with key KUNNR = I_FTAB_M-KUNNR
* BUKRS = I_FTAB_M-BUKRS.
* if sy-subrc = 0.
* I_FTAB_M-PERNR = i_KNB1-PERNR.
* read table i_pa0002 with key PERNR = I_FTAB_M-PERNR.
* if sy-subrc = 0.
* CONCATENATE i_PA0002-VNAMC i_PA0002-NCHMC
* INTO I_FTAB_M-CNAME SEPARATED BY SPACE.
* endif.
* endif.
* IF I_FTAB_M-FLAG IS INITIAL.
* I_FTAB_M-FLAG = 'U'.
* ENDIF.
* IF I_FTAB_M-FLAG EQ 'X' AND
* ( i_ftab_m-blart <> 'DZ' or i_ftab_m-blart <> 'DQ' ).
* if I_FTAB_M-BLART EQ 'RV'.
if I_FTAB_M-BLART ne 'DZ'.
I_FTAB_M-INV_DMBTR = I_FTAB_M-DMBTR.
I_FTAB_M-INV_WRBTR = I_FTAB_M-WRBTR.
CLEAR: I_FTAB_M-DMBTR, I_FTAB_M-WRBTR.
ELSE.
CLEAR : I_FTAB_M-INV_DMBTR, I_FTAB_M-INV_WRBTR.
ENDIF.
* SELECT SINGLE FKDAT INTO I_FTAB_M-FKDAT FROM VBRK
* WHERE VBELN = I_FTAB_M-KIDNO.
select single * from bseg
into corresponding fields of wa2_bseg
where bukrs eq i_ftab_m-bukrs and
belnr eq i_ftab_m-belnr and
gjahr eq i_ftab_m-gjahr and
buzei eq i_ftab_m-buzei and
bschl eq '15'.
if sy-subrc eq 0.
if wa2_bseg-augbl is initial.
* i_ftab_m-xblnr = wa2_bseg-vbeln.
select single * from bkpf
into corresponding fields of bkpf
where bukrs eq wa2_bseg-bukrs and
belnr eq wa2_bseg-rebzg and
gjahr eq wa2_bseg-rebzj.
if sy-subrc eq 0.
i_ftab_m-xblnr = bkpf-xblnr.
else.
clear bkpf.
endif.
select * from bseg
into corresponding fields of wa3_bseg
where bukrs eq wa2_bseg-bukrs and
belnr eq wa2_bseg-rebzg and
gjahr eq wa2_bseg-rebzj and
bschl eq '50'.
v_dmbtr = v_dmbtr + wa3_bseg-dmbtr.
v_wrbtr = v_wrbtr + wa3_bseg-wrbtr.
endselect.
move v_dmbtr to i_ftab_m-INV_DMBTR.
move v_wrbtr to i_ftab_m-INV_wrbtr.
clear: v_dmbtr, v_wrbtr.
endif.
else.
clear wa2_bseg.
endif.
if i_ftab_m-blart eq 'DZ'.
select single bktxt into i_ftab_m-bktxt from bkpf
where bukrs eq i_ftab_m-bukrs and
belnr eq i_ftab_m-belnr and
gjahr eq i_ftab_m-gjahr.
select * from bseg
into corresponding fields of wa_bseg
where bukrs eq i_ftab_m-bukrs and
belnr eq i_ftab_m-belnr and
gjahr eq i_ftab_m-gjahr.
if wa_bseg-bschl eq '40' or
wa_bseg-bschl eq '50'.
if wa_bseg-hkont+0(6) eq '000010'.
move wa_bseg-hkont to i_ftab_m-acno.
endif.
endif.
endselect.
i_ftab_m-dmbtr = i_ftab_m-dmbtr * -1.
i_ftab_m-wrbtr = i_ftab_m-wrbtr * -1.
select single * from bseg
into corresponding fields of wa1_bseg
where bukrs eq i_ftab_m-bukrs and
belnr eq i_ftab_m-belnr and
gjahr eq i_ftab_m-gjahr and
hkont eq '0000680090'.
if sy-subrc eq 0.
i_ftab_m-bamtlc = wa1_bseg-dmbtr.
if wa1_bseg-bschl eq '40'.
i_ftab_m-bamtdc = i_ftab_m-dmbtr - i_ftab_m-bamtlc.
* i_ftab_m-bamtdc = i_ftab_m-bamtdc * -1.
elseif wa1_bseg-bschl eq '50'.
i_ftab_m-bamtdc = i_ftab_m-dmbtr + i_ftab_m-bamtlc.
i_ftab_m-bamtlc = i_ftab_m-bamtlc * -1.
* i_ftab_m-bamtdc = i_ftab_m-bamtdc * -1.
endif.
else.
i_ftab_m-bamtdc = i_ftab_m-dmbtr.
endif.
else.
select single xblnr into i_ftab_m-xblnr from bkpf
where bukrs eq i_ftab_m-bukrs and
belnr eq i_ftab_m-belnr and
gjahr eq i_ftab_m-gjahr.
clear i_ftab_m-belnr.
endif.
select single * from t001
into corresponding fields of t001
where bukrs eq i_ftab_m-bukrs.
if sy-subrc ne 0.
clear t001.
else.
move t001-waers to i_ftab_m-bwaers.
endif.
MODIFY I_FTAB_M INDEX W_TABIX.
ENDLOOP.
* << info_fieldname =" 'LINECOLOR'.">> 18.09.2003
ENDFORM.
*---------------------------------------------------------------------*
* FORM user_command *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> rf_ucomm *
* --> rs_selfield *
*---------------------------------------------------------------------*
FORM USER_COMMAND USING RF_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
IF RF_UCOMM = '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'BELNR'.
IF SY-SUBRC = 0.
READ TABLE I_FTAB_M INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
SET PARAMETER ID 'BLN' FIELD I_FTAB_M-BELNR.
SET PARAMETER ID 'BUK' FIELD I_FTAB_M-BUKRS.
SET PARAMETER ID 'GJR' FIELD I_FTAB_M-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDIF.
IF RS_SELFIELD-FIELDNAME = 'XXXXX'.
REFRESH: I_CAT1.
CLEAR: I_CAT1.
PERFORM BUILD_FIELD_CATALOGUE1.
PERFORM GET_DATA1 USING RS_SELFIELD-TABINDEX.
PERFORM DISPLAY1.
ENDIF.
ENDIF.
ENDFORM.
*************** Secondary List ***********
FORM BUILD_FIELD_CATALOGUE1.
PERFORM ADD_FIELDCAT1 USING:
1 'Internal table Field name(M)' 'I_FTAB_M'
'Sap Table Name(O)' 'Sap Field Name(O)'
'Primary Key (X or Blank)' 'Field Caption'
'Sum Flag (X or Blank)' 'Justified (L-left,R-Right,C-Centered)'
'Colour'.
ENDFORM.
*---------------------------------------------------------------------*
* FORM get_data1 *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> p_tabindex *
*---------------------------------------------------------------------*
FORM GET_DATA1 USING P_TABINDEX.
READ TABLE I_FTAB_M INDEX P_TABINDEX.
IF SY-SUBRC = 0.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM display1 *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM DISPLAY1.
PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
*"Display List
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_BACKGROUND_ID = 'BROWN_1' "QBJ50
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_USER_COMMAND = G_USER_COMMAND
* I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = I_CAT1[]
I_SAVE = G_SAVE
IS_VARIANT = GS_VARIANT
IT_EVENTS = GT_EVENTS[]
* I_SCREEN_START_COLUMN = 0 "Use coordinates for
* I_SCREEN_START_LINE = 0 "display as dialog box
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = I_FTAB_S[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC = 0.
IF G_EXIT_CAUSED_BY_CALLER = 'X'.
*" Forced Exit by calling program
*"
ELSE.
*" User left list via F3, F12 or F15
IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'. "F3
*"
ELSE.
IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'. "F15
*"
ELSE.
IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12
*"
ELSE.
*" should not occur!
*"
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
*"Fatal error callin ALV
* MESSAGE AXXX(XY) WITH ...
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM add_fieldcat1 *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> &01 *
* --> &02 *
* --> &03 *
* --> &04 *
* --> &05 *
* --> &06 *
* --> &07 *
* --> &08 *
* --> &09 *
* --> &10 *
*---------------------------------------------------------------------*
FORM ADD_FIELDCAT1 USING &01 &02 &03 &04 &05
&06 &07 &08 &09 &10.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = &01.
WA_FCAT-FIELDNAME = &02.
WA_FCAT-TABNAME = &03.
WA_FCAT-REF_TABNAME = &04.
WA_FCAT-REF_FIELDNAME = &05.
WA_FCAT-KEY = &06.
* Field Lable's
WA_FCAT-SELTEXT_M = &07.
WA_FCAT-REPTEXT_DDIC = &07.
WA_FCAT-DDICTXT = 'M'.
WA_FCAT-DO_SUM = &08.
WA_FCAT-JUST = &09.
IF &10 = 'X'.
* C: Color (coding must begin with C)
* x: color number
* y: bold
* z: inverse
WA_FCAT-EMPHASIZE = 'C500'.
ENDIF.
APPEND WA_FCAT TO I_CAT1.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form SORT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM SORT_DATA. I_SORT-SPOS = 1. I_SORT-FIELDNAME = 'AUGBL'. I_SORT-TABNAME = 'BSAD'. I_SORT-GROUP = 1. I_SORT-UP = 'X'. APPEND I_SORT. ENDFORM. " SORT_DATA *&---------------------------------------------------------------------* *& Form BUILD_FIELD_CATALOGUE_CUSTOMER *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM BUILD_FIELD_CATALOGUE_CUSTOMER. PERFORM ADD_FIELDCAT USING: 1 'BUKRS' 'I_FTAB_MC' 'BSID' 'BUKRS' '' 'Company Code' '' 'L' '' '' '' '', 2 'KUNNR' 'I_FTAB_MC' 'BSID' 'KUNNR' '' 'Customer Code' '' 'L' '' '' '' '', 3 'NAME1' 'I_FTAB_MC' 'KNA1' 'NAME1' '' 'Customer Name' '' 'L' '' '' '' '', 4 'ORT01' 'I_FTAB_MC' 'KNA1' 'ORT01' '' 'Customer City' '' 'L' '' '' '' '', 5 'PERNR' 'I_FTAB_MC' 'KNB1' 'PERNR' '' 'A/c Manager' '' 'L' '' 'X' '' '', 6 'CNAME' 'I_FTAB_MC' 'PA0002' 'CNAME' '' 'A/c Mgr. Name' '' 'L' '' 'X' '' '', 7 'WAERS' 'I_FTAB_MC' 'BSID' 'WAERS' '' 'Currency' '' 'L' '' '' '' ''. LOOP AT I_DATES. PERFORM ADD_FIELDCAT USING: I_DATES-CTR I_DATES-COL+9(5) 'I_FTAB_MC' 'BSID' 'WRBTR' '' I_DATES-FORMAT 'X' 'R' '' '' 'WAERS' 'BSID'. ENDLOOP. PERFORM ADD_FIELDCAT USING: 21 'GTOTAL' 'I_FTAB_MC' 'BSID' 'WRBTR' '' 'Total' 'X' 'R' '' '' 'WAERS' 'BSID'. ENDFORM. " BUILD_FIELD_CATALOGUE_CUSTOMER *&---------------------------------------------------------------------* *& Form ARRANGE_CUSTOMER_WISE_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* *FORM ARRANGE_CUSTOMER_WISE_DATA. * SORT I_FTAB_M BY BUKRS KUNNR WAERS. * LOOP AT I_FTAB_M. * CLEAR: I_FTAB_M-MON1,I_FTAB_M-MON2,I_FTAB_M-MON3,I_FTAB_M-MON4, * I_FTAB_M-MON5,I_FTAB_M-MON6,I_FTAB_M-MON7,I_FTAB_M-MON8, * I_FTAB_M-MON9,I_FTAB_M-MON10,I_FTAB_M-MON11,I_FTAB_M-MON12, * I_FTAB_M-GTOTAL. * MODIFY I_FTAB_M INDEX SY-TABIX. * ENDLOOP. * * LOOP AT I_DATES. * LOOP AT I_FTAB_M. * W_IDEX = SY-TABIX. * IF I_FTAB_M-BUDAT BETWEEN I_DATES-DATES AND I_DATES-DATEE. * ASSIGN (I_DATES-COL) TO
*
* MODIFY I_FTAB_M INDEX W_IDEX.
* ENDIF.
* ENDLOOP.
* ENDLOOP.
*
* DELETE I_FTAB_M WHERE BSCHL <> '05' AND
* BSCHL <> '15' AND
* BSCHL <> '09' AND
* BSCHL <> '19'.
* SORT I_FTAB_M BY BUKRS KUNNR WAERS PERNR BUDAT.
*
* LOOP AT I_FTAB_M.
* ON CHANGE OF I_FTAB_M-BUKRS OR I_FTAB_M-KUNNR OR I_FTAB_M-WAERS.
* I_FTAB_M-CALFLAG = 'C'.
* MODIFY I_FTAB_M INDEX SY-TABIX.
* ENDON.
* ENDLOOP.
*
* SORT I_FTAB_M BY BUKRS KUNNR WAERS CALFLAG.
* LOOP AT I_FTAB_M.
* IF I_FTAB_M-CALFLAG EQ 'C'.
* W_MON1 = W_MON1 + I_FTAB_M-MON1.
* W_MON2 = W_MON2 + I_FTAB_M-MON2.
* W_MON3 = W_MON3 + I_FTAB_M-MON3.
* W_MON4 = W_MON4 + I_FTAB_M-MON4.
* W_MON5 = W_MON5 + I_FTAB_M-MON5.
* W_MON6 = W_MON6 + I_FTAB_M-MON6.
* W_MON7 = W_MON7 + I_FTAB_M-MON7.
* W_MON8 = W_MON8 + I_FTAB_M-MON8.
* W_MON9 = W_MON9 + I_FTAB_M-MON9.
* W_MON10 = W_MON10 + I_FTAB_M-MON10.
* W_MON11 = W_MON11 + I_FTAB_M-MON11.
* W_MON12 = W_MON12 + I_FTAB_M-MON12.
* MOVE-CORRESPONDING I_FTAB_M TO I_FTAB_MC.
* I_FTAB_MC-MON1 = W_MON1.
* I_FTAB_MC-MON2 = W_MON2.
* I_FTAB_MC-MON3 = W_MON3.
* I_FTAB_MC-MON4 = W_MON4.
* I_FTAB_MC-MON5 = W_MON5.
* I_FTAB_MC-MON6 = W_MON6.
* I_FTAB_MC-MON7 = W_MON7.
* I_FTAB_MC-MON8 = W_MON8.
* I_FTAB_MC-MON9 = W_MON9.
* I_FTAB_MC-MON10 = W_MON10.
* I_FTAB_MC-MON11 = W_MON11.
* I_FTAB_MC-MON12 = W_MON12.
* APPEND I_FTAB_MC.
* CLEAR: I_FTAB_MC, W_MON1,W_MON2,W_MON3,W_MON4,W_MON5,
* W_MON6,W_MON7,W_MON8,W_MON9,W_MON10,W_MON11,W_MON12.
* ELSE.
* W_MON1 = W_MON1 + I_FTAB_M-MON1.
* W_MON2 = W_MON2 + I_FTAB_M-MON2.
* W_MON3 = W_MON3 + I_FTAB_M-MON3.
* W_MON4 = W_MON4 + I_FTAB_M-MON4.
* W_MON5 = W_MON5 + I_FTAB_M-MON5.
* W_MON6 = W_MON6 + I_FTAB_M-MON6.
* W_MON7 = W_MON7 + I_FTAB_M-MON7.
* W_MON8 = W_MON8 + I_FTAB_M-MON8.
* W_MON9 = W_MON9 + I_FTAB_M-MON9.
* W_MON10 = W_MON10 + I_FTAB_M-MON10.
* W_MON11 = W_MON11 + I_FTAB_M-MON11.
* W_MON12 = W_MON12 + I_FTAB_M-MON12.
* ENDIF.
* ENDLOOP.
*
* LOOP AT I_FTAB_MC.
* I_FTAB_MC-GTOTAL = I_FTAB_MC-MON1 + I_FTAB_MC-MON2 + I_FTAB_MC-MON3 +
* I_FTAB_MC-MON4 + I_FTAB_MC-MON5 + I_FTAB_MC-MON6 +
* I_FTAB_MC-MON7 + I_FTAB_MC-MON8 + I_FTAB_MC-MON9 +
* I_FTAB_MC-MON10 + I_FTAB_MC-MON11 +
* I_FTAB_MC-
*MON12.
* MODIFY I_FTAB_MC INDEX SY-TABIX.
* ENDLOOP.
*ENDFORM. " ARRANGE_CUSTOMER_WISE_DATA
*
**&---------------------------------------------------------------------
*
**& Form FORMAT_FOR_CUSTOMER_WISE_DATA
**&---------------------------------------------------------------------
*
** text
**----------------------------------------------------------------------
*
** --> p1 text
** <-- p2 text **---------------------------------------------------------------------- * *FORM FORMAT_FOR_CUSTOMER_WISE_DATA. * W_BUDATL = S_BUDAT-LOW. * I_DATES-CTR = 8. * W_COL = 1. * WHILE W_BUDATL <= S_BUDAT-HIGH. * CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE' * EXPORTING * IV_DATE = W_BUDATL * IMPORTING * EV_MONTH_BEGIN_DATE = I_DATES-DATES * EV_MONTH_END_DATE = I_DATES-DATEE. * * W_BUDATL = I_DATES-DATES. * CONCATENATE I_DATES-DATES+4(2) '.' I_DATES-DATES+0(4) INTO *W_FORMAT. * I_DATES-FORMAT = W_FORMAT. * MOVE W_COL TO W_COLC. * CONCATENATE 'I_FTAB_M-MON' W_COLC INTO I_DATES-COL. * APPEND I_DATES. * CALL FUNCTION 'MONTH_PLUS_DETERMINE' * EXPORTING * MONTHS = 1 * OLDDATE = W_BUDATL * IMPORTING * NEWDATE = W_BUDATL. * I_DATES-CTR = I_DATES-CTR + 1. * W_COL = W_COL + 1. * ENDWHILE. * CLEAR: I_DATES. *ENDFORM. " FORMAT_FOR_CUSTOMER_WISE_DATA *&---------------------------------------------------------------------* *& Form DISPLAY_CUSTOMER *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM DISPLAY_CUSTOMER. PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[]. *"Display List CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = G_REPID I_CALLBACK_USER_COMMAND = G_USER_COMMAND IS_LAYOUT = GS_LAYOUT IT_FIELDCAT = I_CAT[] I_SAVE = G_SAVE IS_VARIANT = GS_VARIANT IT_EVENTS = GT_EVENTS[] IT_SORT = I_SORT[] IMPORTING E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER TABLES T_OUTTAB = I_FTAB_MC[] EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2. IF SY-SUBRC = 0. IF G_EXIT_CAUSED_BY_CALLER = 'X'. *" Forced Exit by calling program *"
ELSE.
*" User left list via F3, F12 or F15
IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'. "F3
*"
ELSE.
IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'. "F15
*"
ELSE.
IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12
*"
ELSE.
*" should not occur!
*"
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
*"Fatal error callin ALV
* MESSAGE AXXX(XY) WITH ...
ENDIF.
ENDFORM. " DISPLAY_CUSTOMER
*&---------------------------------------------------------------------*
*& Form BANK_ADDITIONAL_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM BANK_ADDITIONAL_DATA. RANGES: R_BELNR FOR BSIS-BELNR. CLEAR: W_IND. * CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' * EXPORTING * INPUT = '242101' * IMPORTING * OUTPUT = w_hkont. * r_belnr-sign = 'I'. * r_belnr-option = 'EQ'. * r_belnr-low = '9898'. * append r_belnr. LOOP AT I_FTAB_M WHERE ACNO IS INITIAL. W_IND = SY-TABIX. IF NOT I_FTAB_M-BELNR IN R_BELNR OR R_BELNR IS INITIAL. CLEAR: I_BSIS, I_BSAS, I_BSASM, I_BSISM, I_FTAB_M-BAMTLC, I_FTAB_M-BAMTDC, I_FTAB_M-DMBTR, I_FTAB_M-WRBTR, I_FTAB_M-INV_DMBTR, I_FTAB_M-INV_WRBTR, I_FTAB_M-FLAG, I_FTAB_M-KURSF. REFRESH: I_BSIS, I_BSAS, I_BSASM, I_BSISM. IF I_FTAB_M-BLART = 'DZ' OR I_FTAB_M-BLART = 'DQ'. * create ranges to check for the rept. of doc no. R_BELNR-SIGN = 'I'. R_BELNR-OPTION = 'EQ'. R_BELNR-LOW = I_FTAB_M-BELNR. APPEND R_BELNR. * BSIS SELECT * INTO TABLE I_BSISM FROM BSIS WHERE BUKRS = I_FTAB_M-BUKRS AND * ( HKONT LIKE '0000243%' OR HKONT LIKE '0000244%' OR * HKONT LIKE '0000245%' OR HKONT LIKE '00002421%' ) AND GJAHR = I_FTAB_M-GJAHR AND BELNR = I_FTAB_M-BELNR. IF SY-SUBRC = 0. * DELETE I_BSISM WHERE HKONT+0(7) <> '0000243' AND
* HKONT+0(7) <> '0000244' AND
* HKONT+0(7) <> '0000245' AND
* HKONT <> '0000242101'.
LOOP AT I_BSISM.
IF NOT I_BSISM-AUGBL IS INITIAL.
* internal BSIS
SELECT * INTO TABLE I_BSIS FROM BSIS
WHERE BUKRS = I_FTAB_M-BUKRS AND
* ( HKONT LIKE '0000243%' OR HKONT LIKE '0000244%' OR
* HKONT LIKE '0000245%' OR HKONT LIKE '00002421%' ) AND
GJAHR = I_FTAB_M-GJAHR AND
BELNR = I_BSASM-AUGBL.
IF SY-SUBRC = 0.
* here the entry with GL code 2421 will get deleted
* DELETE I_BSIS WHERE HKONT+0(7) <> '0000243' AND
* HKONT+0(7) <> '0000244' AND
* HKONT+0(7) <> '0000245'.
*** BM by Vanitha 21.06.2005
* IF NOT S_BHKONT IS INITIAL.
* DELETE I_BSIS WHERE NOT HKONT IN S_BHKONT.
* ENDIF.
*** EM by Vanitha 21.06.2005
LOOP AT I_BSIS.
* Exchange Rate and movement of data to I_FTAB_M
SELECT SINGLE * FROM BKPF
WHERE BUKRS = I_BSIS-BUKRS AND
BELNR = I_BSIS-BELNR AND
GJAHR = I_BSIS-GJAHR.
IF SY-SUBRC = 0.
MOVE BKPF-KURSF TO I_FTAB_M-KURSF.
ENDIF.
MOVE I_BSIS-HKONT TO I_FTAB_M-ACNO.
** House bank
SELECT SINGLE * FROM SKB1
WHERE BUKRS = I_BSIS-BUKRS AND
SAKNR = I_FTAB_M-ACNO.
IF SY-SUBRC = 0.
MOVE SKB1-HBKID TO I_FTAB_M-HBKID.
ENDIF.
MOVE I_BSIS-WAERS TO I_FTAB_M-BWAERS.
MOVE I_BSIS-DMBTR TO I_FTAB_M-BAMTLC.
MOVE I_BSIS-WRBTR TO I_FTAB_M-BAMTDC.
MOVE I_BSIS-BUDAT TO I_FTAB_M-BBUDAT.
I_FTAB_M-LINECOLOR = 'C014'.
* check if House bank is in the selection range
* IF I_FTAB_M-HBKID IN S_HBKID.
* APPEND I_FTAB_M.
* ENDIF.
ENDLOOP.
ENDIF.
* internal BSAS
SELECT * INTO TABLE I_BSAS FROM BSAS
WHERE BUKRS = I_FTAB_M-BUKRS AND
* ( HKONT LIKE '0000243%' OR HKONT LIKE '0000244%' OR
* HKONT LIKE '0000245%' OR HKONT LIKE '00002421%' ) AND
GJAHR = I_FTAB_M-GJAHR AND
BELNR = I_BSASM-AUGBL.
IF SY-SUBRC = 0.
* here the entry with GL code 2421 will get deleted
* DELETE I_BSAS WHERE HKONT+0(7) <> '0000243' AND
* HKONT+0(7) <> '0000244' AND
* HKONT+0(7) <> '0000245'.
*** BM by Vanitha 21.06.2005
* IF NOT S_BHKONT IS INITIAL.
* DELETE I_BSAS WHERE NOT HKONT IN S_BHKONT.
* ENDIF.
*** EM by Vanitha 21.06.2005
LOOP AT I_BSAS.
* Exchange Rate and movement of data to I_FTAB_M
SELECT SINGLE * FROM BKPF
WHERE BUKRS = I_BSAS-BUKRS AND
BELNR = I_BSAS-BELNR AND
GJAHR = I_BSAS-GJAHR.
IF SY-SUBRC = 0.
MOVE BKPF-KURSF TO I_FTAB_M-KURSF.
ENDIF.
MOVE I_BSAS-HKONT TO I_FTAB_M-ACNO.
* House bank
SELECT SINGLE * FROM SKB1
WHERE BUKRS = I_BSAS-BUKRS AND
SAKNR = I_FTAB_M-ACNO.
IF SY-SUBRC = 0.
MOVE SKB1-HBKID TO I_FTAB_M-HBKID.
ENDIF.
MOVE I_BSAS-WAERS TO I_FTAB_M-BWAERS.
MOVE I_BSAS-DMBTR TO I_FTAB_M-BAMTLC.
MOVE I_BSAS-WRBTR TO I_FTAB_M-BAMTDC.
MOVE I_BSAS-BUDAT TO I_FTAB_M-BBUDAT.
I_FTAB_M-LINECOLOR = 'C014'.
* check if House bank is in the selection range
* IF I_FTAB_M-HBKID IN S_HBKID.
* APPEND I_FTAB_M.
* ENDIF.
ENDLOOP.
ENDIF.
* if clearing doc is blank. move from main values of 242101.
ELSE.
* DELETE I_BSISM WHERE HKONT+0(7) <> '0000243' AND
* HKONT+0(7) <> '0000244' AND
* HKONT+0(7) <> '0000245' AND
* HKONT <> '0000242101'.
*** BM by Vanitha 21.06.2005
* IF NOT S_BHKONT IS INITIAL.
* DELETE I_BSISM WHERE NOT HKONT IN S_BHKONT.
* ENDIF.
*** EM by Vanitha 21.06.2005
LOOP AT I_BSISM.
* Exchange Rate and movement of data to I_FTAB_M
SELECT SINGLE * FROM BKPF
WHERE BUKRS = I_BSISM-BUKRS AND
BELNR = I_BSISM-BELNR AND
GJAHR = I_BSISM-GJAHR.
IF SY-SUBRC = 0.
MOVE BKPF-KURSF TO I_FTAB_M-KURSF.
ENDIF.
MOVE I_BSISM-HKONT TO I_FTAB_M-ACNO.
* House bank
SELECT SINGLE * FROM SKB1
WHERE BUKRS = I_BSISM-BUKRS AND
SAKNR = I_FTAB_M-ACNO.
IF SY-SUBRC = 0.
MOVE SKB1-HBKID TO I_FTAB_M-HBKID.
ENDIF.
MOVE I_BSISM-WAERS TO I_FTAB_M-BWAERS.
MOVE I_BSISM-DMBTR TO I_FTAB_M-BAMTLC.
MOVE I_BSISM-WRBTR TO I_FTAB_M-BAMTDC.
MOVE I_BSISM-BUDAT TO I_FTAB_M-BBUDAT.
I_FTAB_M-LINECOLOR = 'C014'.
* check if House bank is in the selection range
* IF I_FTAB_M-HBKID IN S_HBKID.
* APPEND I_FTAB_M.
* ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR: I_BSIS, I_BSAS.
REFRESH: I_BSIS, I_BSAS.
* BSAS
SELECT * INTO TABLE I_BSASM FROM BSAS
WHERE BUKRS = I_FTAB_M-BUKRS AND
* ( HKONT LIKE '0000243%' OR HKONT LIKE '0000244%' OR
* HKONT LIKE '0000245%' OR HKONT LIKE '00002421%' ) AND
GJAHR = I_FTAB_M-GJAHR AND
BELNR = I_FTAB_M-BELNR.
IF SY-SUBRC = 0.
* DELETE I_BSASM WHERE HKONT+0(7) <> '0000243' AND
* HKONT+0(7) <> '0000244' AND
* HKONT+0(7) <> '0000245' AND
* HKONT <> '0000242101'.
* If found Check Clearing doc. no. in BSIS and BSAS both and move values
LOOP AT I_BSASM.
IF NOT I_BSASM-AUGBL IS INITIAL.
* internal BSIS
SELECT * INTO TABLE I_BSIS FROM BSIS
WHERE BUKRS = I_FTAB_M-BUKRS AND
* ( HKONT LIKE '0000243%' OR HKONT LIKE '0000244%' OR
* HKONT LIKE '0000245%' OR HKONT LIKE '00002421%' ) AND
GJAHR = I_FTAB_M-GJAHR AND
BELNR = I_BSASM-AUGBL.
IF SY-SUBRC = 0.
* DELETE I_BSIS WHERE HKONT+0(7) <> '0000243' AND
* HKONT+0(7) <> '0000244' AND
* HKONT+0(7) <> '0000245'.
*** BM by Vanitha 21.06.2005
* IF NOT S_BHKONT IS INITIAL.
* DELETE I_BSIS WHERE NOT HKONT IN S_BHKONT.
* ENDIF.
*** EM by Vanitha 21.06.2005
LOOP AT I_BSIS.
* Exchange Rate and movement of data to I_FTAB_M
SELECT SINGLE * FROM BKPF
WHERE BUKRS = I_BSIS-BUKRS AND
BELNR = I_BSIS-BELNR AND
GJAHR = I_BSIS-GJAHR.
IF SY-SUBRC = 0.
MOVE BKPF-KURSF TO I_FTAB_M-KURSF.
ENDIF.
MOVE I_BSIS-HKONT TO I_FTAB_M-ACNO.
* House bank
SELECT SINGLE * FROM SKB1
WHERE BUKRS = I_BSIS-BUKRS AND
SAKNR = I_FTAB_M-ACNO.
IF SY-SUBRC = 0.
MOVE SKB1-HBKID TO I_FTAB_M-HBKID.
ENDIF.
MOVE I_BSIS-WAERS TO I_FTAB_M-BWAERS.
MOVE I_BSIS-DMBTR TO I_FTAB_M-BAMTLC.
MOVE I_BSIS-WRBTR TO I_FTAB_M-BAMTDC.
MOVE I_BSIS-BUDAT TO I_FTAB_M-BBUDAT.
I_FTAB_M-LINECOLOR = 'C014'.
* check if House bank is in the selection range
* IF I_FTAB_M-HBKID IN S_HBKID.
* APPEND I_FTAB_M.
* ENDIF.
ENDLOOP.
ENDIF.
* internal BSAS
SELECT * INTO TABLE I_BSAS FROM BSAS
WHERE BUKRS = I_FTAB_M-BUKRS AND
* ( HKONT LIKE '0000243%' OR HKONT LIKE '0000244%' OR
* HKONT LIKE '0000245%' OR HKONT LIKE '00002421%' ) AND
GJAHR = I_FTAB_M-GJAHR AND
BELNR = I_BSASM-AUGBL.
IF SY-SUBRC = 0.
* DELETE I_BSAS WHERE HKONT+0(7) <> '0000243' AND
* HKONT+0(7) <> '0000244' AND
* HKONT+0(7) <> '0000245'.
**** BM by Vanitha 21.06.2005
* IF NOT S_BHKONT IS INITIAL.
* DELETE I_BSAS WHERE NOT HKONT IN S_BHKONT.
* ENDIF.
*** EM by Vanitha 21.06.2005
LOOP AT I_BSAS.
* Exchange Rate and movement of data to I_FTAB_M
SELECT SINGLE * FROM BKPF
WHERE BUKRS = I_BSAS-BUKRS AND
BELNR = I_BSAS-BELNR AND
GJAHR = I_BSAS-GJAHR.
IF SY-SUBRC = 0.
MOVE BKPF-KURSF TO I_FTAB_M-KURSF.
ENDIF.
MOVE I_BSAS-HKONT TO I_FTAB_M-ACNO.
* House bank
SELECT SINGLE * FROM SKB1
WHERE BUKRS = I_BSAS-BUKRS AND
SAKNR = I_FTAB_M-ACNO.
IF SY-SUBRC = 0.
MOVE SKB1-HBKID TO I_FTAB_M-HBKID.
ENDIF.
MOVE I_BSAS-WAERS TO I_FTAB_M-BWAERS.
MOVE I_BSAS-DMBTR TO I_FTAB_M-BAMTLC.
MOVE I_BSAS-WRBTR TO I_FTAB_M-BAMTDC.
MOVE I_BSAS-BUDAT TO I_FTAB_M-BBUDAT.
I_FTAB_M-LINECOLOR = 'C014'.
* check if House bank is in the selection range
* IF I_FTAB_M-HBKID IN S_HBKID.
* APPEND I_FTAB_M.
* ENDIF.
ENDLOOP.
ENDIF.
* if clearing doc is blank. move from main values of 242101.
ELSE.
* DELETE I_BSASM WHERE HKONT+0(7) <> '0000243' AND
* HKONT+0(7) <> '0000244' AND
* HKONT+0(7) <> '0000245' AND
* HKONT <> '0000242101'.
*** BM by Vanitha 21.06.2005
* IF NOT S_BHKONT IS INITIAL.
* DELETE I_BSASM WHERE NOT HKONT IN S_BHKONT.
* ENDIF.
*** EM by Vanitha 21.06.2005
LOOP AT I_BSASM.
* Exchange Rate and movement of data to I_FTAB_M
SELECT SINGLE * FROM BKPF
WHERE BUKRS = I_BSASM-BUKRS AND
BELNR = I_BSASM-BELNR AND
GJAHR = I_BSASM-GJAHR.
IF SY-SUBRC = 0.
MOVE BKPF-KURSF TO I_FTAB_M-KURSF.
ENDIF.
MOVE I_BSASM-HKONT TO I_FTAB_M-ACNO.
* House bank
SELECT SINGLE * FROM SKB1
WHERE BUKRS = I_BSASM-BUKRS AND
SAKNR = I_FTAB_M-ACNO.
IF SY-SUBRC = 0.
MOVE SKB1-HBKID TO I_FTAB_M-HBKID.
ENDIF.
MOVE I_BSASM-WAERS TO I_FTAB_M-BWAERS.
MOVE I_BSASM-DMBTR TO I_FTAB_M-BAMTLC.
MOVE I_BSASM-WRBTR TO I_FTAB_M-BAMTDC.
MOVE I_BSASM-BUDAT TO I_FTAB_M-BBUDAT.
I_FTAB_M-LINECOLOR = 'C014'.
* check if House bank is in the selection range
* IF I_FTAB_M-HBKID IN S_HBKID.
* APPEND I_FTAB_M.
* ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ELSEIF NOT R_BELNR IS INITIAL. "For Duplicates
MOVE 'DUP' TO I_FTAB_M-DUPFLAG.
MODIFY I_FTAB_M INDEX W_IND.
ENDIF.
ENDLOOP.
* to put dupflag in the first line item
I_TEMP[] = I_FTAB_M[].
LOOP AT I_TEMP WHERE DUPFLAG = 'DUP'.
READ TABLE I_FTAB_M WITH KEY BELNR = I_TEMP-BELNR
DUPFLAG = ''
ACNO = ''.
IF SY-SUBRC = 0.
W_IND = SY-TABIX.
MOVE 'DUP' TO I_FTAB_M-DUPFLAG.
MODIFY I_FTAB_M INDEX W_IND.
ENDIF.
ENDLOOP.
ENDFORM. " BANK_ADDITIONAL_DATA
*&---------------------------------------------------------------------*
*& Form TRANSFER_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM TRANSFER_DATA. DATA : C_DMBTR(30) TYPE C, B_DMBTR LIKE BAPICURR-BAPICURR, C_WRBTR(30) TYPE C, B_WRBTR LIKE BAPICURR-BAPICURR, C_INV_DMBTR(30) TYPE C, B_INV_DMBTR LIKE BAPICURR-BAPICURR, C_INV_WRBTR(30) TYPE C, B_INV_WRBTR LIKE BAPICURR-BAPICURR, C_BAMTLC(30) TYPE C, B_BAMTLC LIKE BAPICURR-BAPICURR, C_BAMTDC(30) TYPE C, B_BAMTDC LIKE BAPICURR-BAPICURR. DATA: C_KURSF(20) TYPE C. W_DOWN_DATE = SY-DATUM. W_DOWN_TIME = SY-UZEIT. IMPORT P_DEL FROM MEMORY ID 'DELIMIT'. LOOP AT I_FTAB_M. W_TABIX = SY-TABIX. CLEAR C_KURSF. C_KURSF = I_FTAB_M-KURSF. IF I_FTAB_M-BUKRS = 8000. CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL' EXPORTING CURRENCY = I_FTAB_M-WAERS AMOUNT_INTERNAL = I_FTAB_M-DMBTR IMPORTING AMOUNT_EXTERNAL = B_DMBTR. CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL' EXPORTING CURRENCY = I_FTAB_M-WAERS AMOUNT_INTERNAL = I_FTAB_M-WRBTR IMPORTING AMOUNT_EXTERNAL = B_WRBTR. CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL' EXPORTING CURRENCY = I_FTAB_M-WAERS AMOUNT_INTERNAL = I_FTAB_M-INV_DMBTR IMPORTING AMOUNT_EXTERNAL = B_INV_DMBTR. CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL' EXPORTING CURRENCY = I_FTAB_M-WAERS AMOUNT_INTERNAL = I_FTAB_M-INV_WRBTR IMPORTING AMOUNT_EXTERNAL = B_INV_WRBTR. CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL' EXPORTING CURRENCY = I_FTAB_M-BWAERS AMOUNT_INTERNAL = I_FTAB_M-BAMTLC IMPORTING AMOUNT_EXTERNAL = B_BAMTLC. CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL' EXPORTING CURRENCY = I_FTAB_M-BWAERS AMOUNT_INTERNAL = I_FTAB_M-BAMTDC IMPORTING AMOUNT_EXTERNAL = B_BAMTDC. MOVE B_DMBTR TO C_DMBTR. MOVE B_WRBTR TO C_WRBTR. MOVE B_INV_DMBTR TO C_INV_DMBTR. MOVE B_INV_WRBTR TO C_INV_WRBTR. MOVE B_BAMTLC TO C_BAMTLC. MOVE B_BAMTDC TO C_BAMTDC. ELSE. C_DMBTR = I_FTAB_M-DMBTR. C_WRBTR = I_FTAB_M-WRBTR. C_INV_DMBTR = I_FTAB_M-INV_DMBTR. C_INV_WRBTR = I_FTAB_M-INV_WRBTR. C_BAMTLC = I_FTAB_M-BAMTLC. C_BAMTDC = I_FTAB_M-BAMTDC. ENDIF. CONDENSE : C_DMBTR, C_WRBTR, C_INV_DMBTR, C_INV_WRBTR , C_BAMTLC, C_BAMTDC, C_KURSF, I_FTAB_M-BUKRS, I_FTAB_M-KUNNR, I_FTAB_M-NAME1, I_FTAB_M-ORT01, I_FTAB_M-PERNR, I_FTAB_M-CNAME, I_FTAB_M-KIDNO, I_FTAB_M-FKDAT, I_FTAB_M-ZUONR, I_FTAB_M-BELNR, I_FTAB_M-BLDAT, I_FTAB_M-CPUDT, I_FTAB_M-BUDAT, I_FTAB_M-GJAHR, I_FTAB_M-AUGBL, I_FTAB_M-AUGDT, I_FTAB_M-BLART, I_FTAB_M-BSCHL, I_FTAB_M-WAERS, I_FTAB_M-ZFBDT, I_FTAB_M-FLAG, I_FTAB_M-MONAT, I_FTAB_M-SHKZG, I_FTAB_M-REBZG , I_FTAB_M-REBZJ, I_FTAB_M-VALUT, I_FTAB_M-CALFLAG, I_FTAB_M-ACNO, I_FTAB_M-BWAERS, I_FTAB_M-BBUDAT, I_FTAB_M-DUPFLAG, I_FTAB_M-HBKID, I_FTAB_M-LINECOLOR. MODIFY I_FTAB_M INDEX W_TABIX. CONCATENATE I_FTAB_M-BUKRS I_FTAB_M-KUNNR I_FTAB_M-NAME1 I_FTAB_M-ORT01 I_FTAB_M-PERNR I_FTAB_M-CNAME I_FTAB_M-KIDNO I_FTAB_M-FKDAT I_FTAB_M-ZUONR I_FTAB_M-BELNR I_FTAB_M-BLDAT I_FTAB_M-CPUDT I_FTAB_M-BUDAT I_FTAB_M-GJAHR I_FTAB_M-AUGBL I_FTAB_M-AUGDT I_FTAB_M-BLART I_FTAB_M-BSCHL I_FTAB_M-WAERS C_DMBTR C_WRBTR C_INV_DMBTR C_INV_WRBTR I_FTAB_M-ZFBDT I_FTAB_M-FLAG I_FTAB_M-MONAT I_FTAB_M-SHKZG I_FTAB_M-REBZG I_FTAB_M-REBZJ I_FTAB_M-VALUT I_FTAB_M-CALFLAG I_FTAB_M-ACNO I_FTAB_M-BWAERS C_BAMTLC C_BAMTDC I_FTAB_M-BBUDAT C_KURSF I_FTAB_M-DUPFLAG I_FTAB_M-HBKID I_FTAB_M-LINECOLOR SY-UNAME W_DOWN_DATE W_DOWN_TIME INTO I_TAB-LINE SEPARATED BY P_DEL. APPEND I_TAB. ENDLOOP. EXPORT I_TAB TO MEMORY ID 'ITABDT'. ENDFORM. " TRANSFER_DATA *&---------------------------------------------------------------------* *& Form DELETE_NOT_IN_BANKGL *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DELETE_NOT_IN_BANKGL .
**** If Ban G/L is given on the screen.
IF NOT S_BHKONT IS INITIAL.
*** First delete those records whose clearing doc. no. is blank.
*** Ie those records which are partially cleared
delete I_FTAB_M WHERE augbl is initial and
ACNO ne S_BHKONT.
*** Check for bank g/l and if it is not equal to the bank g/l
*** on the screen, then move corrresponding clearing document
*** and and bank a/c into seperate table i_augbl.
loop at i_ftab_m.
if i_ftab_m-acno ne s_bhkont and
i_ftab_m-acno ne space.
move i_ftab_m-augbl to i_augbl-augbl.
* move i_ftab_m-acno to i_augbl-acno.
append i_augbl.
endif.
endloop.
clear i_augbl.
sort i_augbl by augbl.
delete adjacent duplicates from i_augbl comparing augbl.
*** Delete those record from i_augbl where bank a/c not equal to
*** that given on the selection screen.
* delete i_augbl where acno ne s_bhkont.
*** Finally delete those records whose clearing document eq i_augbl.
loop at i_augbl.
delete i_ftab_m where augbl eq i_augbl-augbl.
* and acno eq i_augbl-acno.
endloop.
clear i_ftab_m.
ENDIF.
ENDFORM. " DELETE_NOT_IN_BANKGL