Hi 大家好
今天要來繼續來開發銀行匯款媒體檔程式
1.存放匯款資料的內表
regup是存放匯款資料的table
gt_regup1是為了等一下loop gt_regup把我們要的資料取出來用的
data:gt_regup like regup occurs 0 with header line.
data:begin of gt_regup1 occurs 0,
laufd like regup-laufd,
laufi like regup-laufi,
xvorl like regup-xvorl,
zbukr like regup-zbukr,
lifnr like regup-lifnr,
dmbtr like regup-dmbtr,
end of gt_regup1.
2.存放媒體檔資料的內表
data:begin of gt_media occurs 0,
vblnr like regup-vblnr,
belnr like regup-belnr,
lifnr like regup-lifnr,
pswsl like regup-pswsl,
waers like regup-waers,
stcd1 like lfa1-stcd1, "統編
koinh like lfbk-koinh, "收款人戶名
bankn like lfbk-bankn, "收款帳號
bankl like lfbk-bankl, "總行分行
amount like regup-dmbtr,
remit like regup-dmbtr, "匯款金額
handling like regup-dmbtr, "手續費
deduct like regup-dmbtr, "扣帳金額
end of gt_media.
3.存放銀行格式的內表
銀行的每個欄位都有固定的長度
例如第一個欄位公司名稱,長度限制為16
那第二個欄位就會從第17字元開始,
公司名稱如果不到16個字就會留空白
types : begin of gs_bank ,
tx1 type c length 16, "為了方便辨識 tx1代表從第一個字元開始
tx17 type c length 15,
tx32 type c length 3 ,
tx35 type c length 4,
tx39 type c length 16,
tx55 type c length 80,
tx135 type c length 15,
tx150 type c length 8 ,
tx158 type c length 13,
tx171 type c length 1,
tx172 type c length 80,
tx252 type c length 1,
tx253 type c length 50,
tx303 type c length 20,
tx323 type c length 40,
tx363 type c length 60,
end of gs_bank.
data gt_bank type table of gs_bank.
data wa_bank type gs_bank.
現在來寫我們的input介面
selection-screen begin of block blk1 with frame title text-b01.
parameter:
p_bukrs like t001-bukrs obligatory default '1000',
p_laufd like f110v-laufd obligatory,
p_laufi like f110v-laufi obligatory,
p_hbkid(5) type c as listbox visible length 16 obligatory.
selection-screen end of block blk1.
selection-screen begin of block blk2 with frame title text-b02.
parameter: p_path like rlgrap-filename obligatory modif id xy.
selection-screen end of block blk2.
bukrs :company code
laufd :付款日期
laufi :付款Id
p_hbkid:付款銀行 (這邊要做成下拉選單,因為會有多家銀行)
p_path:下載的路徑
top-of-page. "報表格式
perform report_title.
perform report_header.
initialization.
perform set_dropdown. "銀行的下拉選單的內容(哪幾家銀行)
*=====at user-command==================================================*
at user-command. "User Presses Download button "下載按鈕
case sy-ucomm.
when 'DOWN'.
perform download_file.
endcase.
*=====at selection-screen==============================================*
at selection-screen on value-request for p_path. "選擇下載路徑
perform select_path.
at selection-screen on p_hbkid. "下拉選單功能
perform get_dropdown.
at selection-screen.
perform check_data.
at selection-screen output.
perform screen_output.
*=====start-of-selection===============================================*
start-of-selection.
perform get_data. "處理資料
perform report.
可以看到裡面有很多perform的子程式 ,
明天開始再來慢慢還債~