SAP abap 呼叫報表的執行結果

2021-10-08 15:50:57 字數 2971 閱讀 1789

在一些情況下我們需要呼叫報表執行,獲取執行的結果,用submit來實現。

例:介面根據iv_bukrs、iv_lifnr、iv_spmon三個字段值獲取程式報表zfi1001執行後edmbtr的值。

data:  ra_bukrs type range of bukrs,

ls_bukrs like line of ra_bukrs,

ra_lifnr type range of lifnr,

ls_lifnr like line of ra_lifnr.

data:it_memory like table of abaplist.

data: begin of it_list occurs 0,

line(1000),

end of it_list.

data: begin of it_string occurs 0,

str type c length 100,

end of it_string.

data: begin of is_indx,

bukrs(2),

lifnr(2),

edmbtr(2),

end of is_indx.

data ls_indx like is_indx.

data l_endline type i.

if iv_bukrs is not initial.

ls_bukrs-low = iv_bukrs.

ls_bukrs-sign = 'i'.

ls_bukrs-option = 'eq'.

endif.

if iv_lifnr is not initial.

ls_lifnr-low = iv_lifnr.

ls_lifnr-sign = 'i'.

ls_lifnr-option = 'eq'.

endif.

"呼叫zfi1001報表程式

submit zfi1001 with s_bukrs in ra_bukrs

with s_lifnr in ra_lifnr

with p_spmon = iv_spmon

exporting list to memory and return.

"獲取快取

call function 'list_from_memory'

tables

listobject = it_memory

exceptions

not_found = 1

others = 2.

if it_memory is initial.

return.

endif.

"將快取轉換格式

call function 'list_to_asci'

tables

listasci = it_list

listobject = it_memory

exceptions

empty_list = 1

list_index_invalid = 2

others = 3.

if it_list is not initial.

read table it_list index 4."讀alv表頭欄位名稱的那一行

if sy-subrc = 0.

split it_list at '|' into table it_string.

"讀取要獲取欄位所處的列

loop at it_string.

condense it_string-str no-gaps.

if it_string-str = '公司'.

ls_indx-bukrs = sy-tabix.

endif.

if it_string-str = '**商'.

ls_indx-lifnr = sy-tabix.

endif.

if it_string-str = '餘額'.

ls_indx-edmbtr = sy-tabix.

endif.

endloop.

describe table it_list lines l_endline.

l_endline = l_endline - 1.

loop at it_list from 6 to l_endline."讀取表的值

refresh it_string.

split it_list at '|' into table it_string.

read table it_string index ls_indx-bukrs.

condense it_string-str no-gaps.

et_balance-bukrs = it_string-str.

read table it_string index ls_indx-lifnr.

condense it_string-str no-gaps.

et_balance-lifnr = it_string-str.

read table it_string index ls_indx-edmbtr.

condense it_string-str no-gaps.

* replace '*' with '' into it_string-str.

replace all occurrences of ',' in it_string-str with ''. "金額字段格式轉換

et_balance-edmbtr = it_string-str.

et_balance-spmon = iv_spmon.

clear:et_balance.

endloop.

endif.

endif.

endfunction.

後台動態呼叫報表

關於asp.net自帶的報表有很多應用的方法,下面只是我在做專案過程中,所應用到的一部內容,僅以此記錄一下。若是有想深入學習的朋友,還請看msdn。前台設計 register assembly microsoft.reportviewer.webforms,version 10.0.0.0,cult...

在jsp中呼叫報表

parameters.put banji new string c1 system.out.println conn 連線到資料庫 connection conn drivermanager.getconnection url,root root system.out.println jasper ...

EBS 利用form個性化 呼叫報表

1.在工具中新增呼叫報表的功能 條件 觸發器事件 when new form instance 活動 型別為 選單 選單項 specialn n為1.6 選單標籤 列印xx報表 2.對specialn 做設定 條件 觸發器事件specialn 活動 a.設定全域性變數 型別為特性,物件型別為 全域性...