You are on page 1of 5

REPORT zfi_brs_data_transfer

NO STANDARD PAGE HEADING LINE-SIZE 255.


INCLUDE bdcrecx1.
TYPES:
BEGIN OF st_brst,
**----------------------------->> SCREEN NUMBER 8000
vgman
TYPE bdc_fval,
" Transaction
valut
TYPE bdc_fval,
" Value date of the item to be cleared
kwbtr
TYPE bdc_fval,
" Amount in account currency
gsber_kf TYPE bdc_fval,
" Business area to which an account is assigned
belnr
TYPE bdc_fval,
" Accounting document number
zuonr
TYPE bdc_fval,
" Allocation number of the item to be cleared
END OF st_brst.
DATA: temp_counter TYPE
i ,
temp_chr(2)
,
check
TYPE char50 .
DATA: itab_brst
itab_first
itab_second
itab_excel

TYPE
TYPE
TYPE
TYPE

STANDARD TABLE
STANDARD TABLE
STANDARD TABLE
alsmex_tabline

OF st_brst INITIAL SIZE 0 WITH HEADER LINE,


OF st_brst INITIAL SIZE 0 WITH HEADER LINE,
OF st_brst INITIAL SIZE 0 WITH HEADER LINE,
OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN: BEGIN OF BLOCK b0 WITH FRAME TITLE text-002.


PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK b0.
**-------------------------------------------------**
**--------->> SELECTION SCREEN DEFINE
**
SELECTION-SCREEN: SKIP.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: pa_bukrs
TYPE febmka-bukrs,
" Company Code
pa_hbkid
TYPE febmka-hbkid,
" Short Key for a House Bank
pa_hktid
TYPE febmka-hktid,
" ID for account details
pa_aznum
TYPE char5,
" Statement number
pa_azdat
TYPE febmka-azdat,
" Statement Date
pa_ssald
TYPE char16,
" Bank statement beginning balance
pa_esald
TYPE char16,
" Bank statement ending balance
pa_budtm
TYPE febmka-budtm,
" Posting date in the document
pa_mnam1
TYPE febmka-mnam1,
" Session name for bank postings
pa_mnam2
TYPE febmka-mnam2.
" Session name for subledger accounting
SELECTION-SCREEN: END OF BLOCK b1.
**-------------------------------------------------**

**------>> AT SELECTION-SCREEN ON VALUE REQUEST


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.

**

**-------------------------------------------------**
**------>> END OF SELECTION -----------------------**
END-OF-SELECTION.
PERFORM upload_file.
PERFORM upload_data.

" DATA UPLOAD FROM EXCEL FILE.


" DATA UPLOAD FROM INTERNAL TABLE TO DATABASE TABLE.

*&---------------------------------------------------------------------*
*&
Form upload_file
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM upload_file .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename
= p_file
i_begin_col
= 1
i_begin_row
= 3
i_end_col
= 6
i_end_row
= 4000
TABLES
intern
= itab_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole
= 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT itab_excel.
CASE itab_excel-col.
**----------------------------->> SCREEN NUMBER 8000
WHEN '0001'. itab_brst-vgman
= itab_excel-value.
WHEN '0002'. itab_brst-valut
= itab_excel-value.
WHEN '0003'. itab_brst-kwbtr
= itab_excel-value.
WHEN '0004'. itab_brst-gsber_kf = itab_excel-value.

"
"
"
"

Transaction
Value date of the item to be cleared
Amount in account currency
Business area to which an account is assigned

WHEN '0005'. itab_brst-belnr


WHEN '0006'. itab_brst-zuonr
ENDCASE.

= itab_excel-value.
= itab_excel-value.

" Accounting document number


" Allocation number of the item to be cleared

AT END OF row.
APPEND itab_brst.
CLEAR itab_brst.
ENDAT.
ENDLOOP.
ENDFORM.
" upload_file
*&---------------------------------------------------------------------*
*&
Form upload_data
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM upload_data .
DATA : l_bldat TYPE char10
l_budat TYPE char10
WRITE pa_azdat TO l_bldat.
WRITE pa_budtm TO l_budat.
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM

bdc_dynpro
bdc_field
bdc_field
bdc_field
bdc_field
bdc_field
bdc_field
bdc_field
bdc_field
bdc_field
bdc_field
bdc_field
bdc_field
bdc_field

,
.

" Statement Date


" Posting Date
" Statement Date
" Posting Date

USING
USING
USING
USING
USING
USING
USING
USING
USING
USING
USING
USING
USING
USING

'SAPMF40K' '0101'.
'BDC_CURSOR'
'BDC_OKCODE'
'FEBMKA-BUKRS'
'FEBMKA-HBKID'
'FEBMKA-HKTID'
'FEBMKA-AZNUM'
'FEBMKA-AZDAT'
'FEBMKA-SSALD'
'FEBMKA-ESALD'
'FEBMKA-BUDTM'
'FEBMKA-NM1VB'
'FEBMKA-MNAM1'
'FEBMKA-MNAM2'

'FEBMKA-MNAM2'.
'/00'.
pa_bukrs.
pa_hbkid.
pa_hktid.
pa_aznum.
l_bldat.
pa_ssald.
pa_esald.
l_budat.
'X'.
pa_mnam1.
pa_mnam2.

USING
USING
USING
USING

'SAPMF40K' '8000'.
'BDC_CURSOR'
'BDC_OKCODE'
'FEBMKA-VGMAN(01)'

'FEBMKK-ZUONR(01)'.
'/00'.
itab_brst-vgman.

"
"
"
"
"
"
"
"

'L001'.
'HDFC1'.
'CA1'.
'47'.
'16.03.2010'.
'0'.
'500,000.00'.
'16.03.2010'.

" 'NEEL1'.
" 'NEEL2'.

"
"
"
"
"
"
"
"

Company code
Short Key for a House Bank
ID for account details
Statement number
Statement Date
Bank statement beginning balance
Bank statement ending balance
Posting date in the document

" Session name for bank postings


" Session name for subledger accounting

LOOP AT itab_brst.
PERFORM
PERFORM
PERFORM
PERFORM

bdc_dynpro
bdc_field
bdc_field
bdc_field

" 'L007'.

" Transaction

PERFORM
PERFORM
PERFORM
igned
PERFORM
PERFORM
red

bdc_field
bdc_field
bdc_field

USING 'FEBEP-VALUT(01)'
USING 'FEBMKA-KWBTR(01)'
USING 'FEBMKK-GSBER_KF(01)'

itab_brst-valut.
itab_brst-kwbtr.
itab_brst-gsber_kf.

" '11.03.2010'.
" '-100000'.
" '1001'.

" Value date of the item to be cleared


" Amount in account currency
" Business area to which an account is ass

bdc_field
bdc_field

USING 'FEBMKK-BELNR(01)'
USING 'FEBMKK-ZUONR(01)'

itab_brst-belnr.
itab_brst-zuonr.

" '1500001816'.
" '553211'.

" Accounting document number


" Allocation number of the item to be clea

USING 'SAPMF40K' '8000'.


USING 'BDC_CURSOR'
USING 'BDC_OKCODE'

'FEBMKK-ZUONR(01)'.
'=P+'.

PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field

USING 'SAPMF40K' '8000'.


USING 'BDC_CURSOR'
USING 'BDC_OKCODE'

'FEBMKK-ZUONR(01)'.
'=SICH'.

PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field

USING 'SAPMF40K' '0101'.


USING 'BDC_CURSOR'
USING 'BDC_OKCODE'

'FEBMKA-BUKRS'.
'=BUCH'.

PERFORM bdc_dynpro
PERFORM bdc_field

USING 'SAPMSSY0' '0120'.


USING 'BDC_OKCODE'

'=BACK'.

PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field

USING 'SAPMF40K' '0101'.


USING 'BDC_CURSOR'
USING 'BDC_OKCODE'

'FEBMKA-BUKRS'.
'=BACK'.

PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
ENDLOOP.

PERFORM bdc_transaction USING 'FF67'.


ENDFORM.

" upload_data

UPLOADED FILE FORMAT:


1
TRANSACTION

L008
L008
L008

3.00

VAL DATE

AMOUNT

03.02.2010
23.02.2010
01.09.2009

2059.20
100000.00
1740001.00

4
BUSINESS
AREA

1001
1001
1001

5
DOCU.
NUMNER

6
ALLOCATION
NO.

2100000164
2100000184
556644

L008

09.11.2009

SELECTION-SCREEN:

1480000.00

1001

1500002872