function z_fill_bnka_fields_us1. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(I_BANKS) LIKE BNKA-BANKS *" VALUE(I_VERS) LIKE T005BU-VERS *" VALUE(I_XPC) LIKE RF02B-BANKXFPR *" VALUE(I_MAX_REC) LIKE RFPDO_BF-MAX_REC *" EXPORTING *" VALUE(CNT_SREADTO) LIKE RF02B-COUNTER *" TABLES *" ITAB_BNKA STRUCTURE BNKA *" TAB_FILE STRUCTURE RLGRAP *"---------------------------------------------------------------------- data: begin of file_all occurs 0, all(1000) type c, end of file_all. ********* Upload datafile ***************************** ************************************************************************ * Author: Clay Molinari * CREATED FOR HR EXPERT * READERS ARE GRANTED RIGHTS TO USE THIS CODE AS IS OR TO * EXPLOIT THE CODE IN ANY MANNER. THE AUTHOR DOES NOT EXTEND * ANY WARRANTY AS TO THE RELIABILITY OF THIS CODE. IT IS * PROVIDED AS AN ILLUSTRATION ONLY. * Date: 07/01/2006 * Purpose: This loads the FED ACH file from the Federal Reserve * Financial Services into table BNKA. Download the file at * https://www.fededirectory.frb.org/download.cfm * ************************************************************************ * Fill parameters: I_TRUNCLEN and I_FILETYPE * If datafile has CR (Carriage Return) as end of line, fill parameters * as follow: i_trunclen = ' ', i_filetype = 'ASC'. If there is no * CR, find out the length of line (e.g. 500) * and fill parameters as follow: i_trunclen = 500, i_filetype = 'TRU'. call function 'UPLOAD_FILES' exporting * i_trunclen = ' ' i_filetype = 'ASC' i_xpc = i_xpc tables file_all = file_all tab_file = tab_file exceptions error_file = 1 others = 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 file_all. clear itab_bnka. * counter of total records cnt_sreadto = cnt_sreadto + 1. * Exit loop if number of record greater than MAX_REC if i_max_rec ne 99999 and cnt_sreadto gt i_max_rec. cnt_sreadto = cnt_sreadto - 1. exit. endif. ******************************************************************** * Fill following fields of table ITAB_BNKA: * Hier fill following fields with data from internal table FILE_ALL * and exact position in the file, e.g. * itab_bnka-bankl = file-all-all+0(8). ******************************************************************* itab_bnka-bankl = file_all-all+0(9). " (Bank number or key) itab_bnka-bnklz = file_all-all+0(9). " (just Bank number) itab_bnka-banka = file_all-all+35(36). " Name of bank itab_bnka-stras = file_all-all+71(36). " Street itab_bnka-ort01 = file_all-all+107(20). " Town + postal code * itab_bnka-brnch = ' '. " Branch itab_bnka-provz = file_all-all+127(2). " Region * itab_bnka-swift = ' '. " SWIFT Code collect itab_bnka. endloop. endfunction.