ABAP-2-会计凭证批量数据导入本地ACCESS

ABAP-1-会计凭证批量数据导入本地ACCESS

上一版本出现问题:

A.若TXT数据条目超过800万(大概1.3G),则将TXT导入ACCESS过程不成功,ACCESS数据表为空。(Access单表最大容量2G)

B.数据量过大造成内存溢出,需要BASIS优化服务器内存容量。

经过反复测试,发现还是SQL语句的问题:

1.SQL问题

 insert into fan_tab(va1,va2....) select F1 as va1,F2 as va2... FROM [Text;FMT=Delimited;HDR=No;IMEX=1;DATABASE=C:\;].[A010#txt];

 上面语句中过多使用AS别名,insert into ... select ... FROM ...

2.调整思路

 A.TXT文件中第一行存放标题

 B.ID编号字段放在TXT文件中

 C.SQL语句调整为:select * into fan_tab FROM [Text;FMT=Delimited;HDR=No;IMEX=1;DATABASE=C:\;].[A010#txt];

  直接将TXT数据转换为ACCESS数据表。

3.测试

 ABAP-2-会计凭证批量数据导入本地ACCESS

 ABAP-2-会计凭证批量数据导入本地ACCESS

 上述400多万的记录执行时间大概4分钟

4.代码部分

 ZFIR0035_ACCOUNTDOC_EXPORT

 *&---------------------------------------------------------------------*
*& Report ZFIR0035_ACCOUNTDOC_EXPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* report zfir0035_accountdoc_export. include zapi0001_prg_info. include zfir0035_accountdoc_export_top. "define include zfir0035_accountdoc_export_scr. "screen include zfir0035_accountdoc_export_pro. "processing include zfir0035_accountdoc_export_frm. "subroutine

 ZFIR0035_ACCOUNTDOC_EXPORT_TOP

 *&---------------------------------------------------------------------*
*& 包含 ZFIR0035_ACCOUNTDOC_EXPORT_TOP
*&---------------------------------------------------------------------* include ole2incl. tables:
mkpf,
mseg. constants:
gc_provider type string value 'Provider=Microsoft.Jet.OLEDB.4.0',
gc_security type string value 'Persist Security Info=False',
gc_datasour type string value 'Data Source='. constants:
gc_char type c value ',',
gc_char3 type c value '''',
gc_char1 type c value '_',
gc_char2 type c value ';',
gc_char4 type c value '.',
gc_check type c value 'X'. data:
begin of wa_inf,
count type i, "总记录数
dburl type string, "数据库路径
tabnm type string, "表名
qydat type datum, "获取数据-日期
qytim type uzeit, "获取数据-时间
txdat type datum, "下载TXT-日期
txtim type uzeit, "下载TXT-时间
acdat type datum, "导入DB-日期
actim type uzeit, "导入DB-时间
fhdat type datum, "执行结束-日期
fhtim type uzeit, "执行结束-时间
ustim type uzeit, "总用时
mod type i,
div type string,
end of wa_inf. data:
begin of wa_xsz,
id type i.
include structure zsfi0018_xsz.
data:end of wa_xsz. data:
go_conn type ole2_object,
go_rset type ole2_object,
go_err type ole2_object,
go_rtab type ole2_object. data:
gt_str type table of string,
gt_imp type table of string,
gt_data type table of zsfi0018_xsz,
gt_xsz like table of wa_xsz,
gt_inf like table of wa_inf. data:
gv_txurl type string,
gv_tabnm type string,
gv_zchar type c,
gv_count type i,
gv_datasour type string. data:
gs_inf like wa_inf. field-symbols:
<fs_str> type string,
<fs_imp> type string,
<fs_inf> like wa_inf,
<fs_xsz> like wa_xsz,
<fs_data> type zsfi0018_xsz.

ZFIR0035_ACCOUNTDOC_EXPORT_SCR

 *&---------------------------------------------------------------------*
*& 包含 ZFIR0035_ACCOUNTDOC_EXPORT_SCR
*&---------------------------------------------------------------------* selection-screen begin of block block1 with frame title text-.
parameter:
p_bukrs type bukrs obligatory.
select-options:
s_budat for mkpf-budat obligatory.
selection-screen end of block block1. selection-screen begin of block block2 with frame title text-.
parameters:
p_dburl type rlgrap-filename obligatory. selection-screen skip. parameters:
p_deltx as checkbox default 'X'.
selection-screen end of block block2.

ZFIR0035_ACCOUNTDOC_EXPORT_PRO

 *&---------------------------------------------------------------------*
*& 包含 ZFIR0035_ACCOUNTDOC_EXPORT_PRO
*&---------------------------------------------------------------------* initialization.
"初始-公司代码
perform frm_get_auth_bukrs using p_bukrs. at selection-screen on value-request for p_dburl.
"获取数据库(.MDB)路径
perform frm_get_filepath_dburl. start-of-selection.
"权限检查
perform frm_auth_check_bukrs.
"获取数据
perform frm_get_data.
"下载TXT文件
perform frm_txt_download.
"导入数据库表
perform frm_txt_to_access.
"删除TXT文件
if p_deltx is not initial.
perform frm_txt_delete_file.
endif. end-of-selection.
"输出执行信息
perform frm_exec_info.

ZFIR0035_ACCOUNTDOC_EXPORT_FRM

 *&---------------------------------------------------------------------*
*& 包含 ZFIR0035_ACCOUNTDOC_EXPORT_FRM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form FRM_GET_FILEPATH_DBURL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_get_filepath_dburl .
call function 'WS_FILENAME_GET'
exporting
def_filename = text-
def_path = 'D:\'
mask = ',*.mdb,.'
mode = 'O'
title = text-003
importing
filename = p_dburl
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
case sy-subrc.
when 0.
when others.
exit.
endcase.
endform.
*&---------------------------------------------------------------------*
*& Form FRM_GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_get_data .
data:
lv_index type string,
lv_dmbtr type string,
lv_wrbtr type string,
lv_pswbt type string,
gv_zchar type c. call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = 30
text = text-005. gs_inf-qydat = sy-datum.
gs_inf-qytim = sy-uzeit.
gs_inf-dburl = p_dburl. select single zchar
into gv_zchar
from ztfi0034_char.
if sy-subrc <> 0.
message e001(00) with text-042.
endif. call function 'ZFI_01_ACCOUNTDOC_EXPORT'
exporting
p_bukrs = p_bukrs
tables
it_budat = s_budat
et_data = gt_data. do 4000000 times.
read table gt_data assigning <fs_data> index 1.
if sy-subrc = 0.
append <fs_data> to gt_data.
endif. enddo. "增加标题字符
append initial line to gt_str assigning <fs_str>.
concatenate
gv_zchar 'ID' gv_zchar gc_char
gv_zchar 'BUKRS' gv_zchar gc_char
gv_zchar 'BELNR' gv_zchar gc_char
gv_zchar 'GJAHR' gv_zchar gc_char
gv_zchar 'MONAT' gv_zchar gc_char
gv_zchar 'BLART' gv_zchar gc_char
gv_zchar 'BLDAT' gv_zchar gc_char
gv_zchar 'BUDAT' gv_zchar gc_char
gv_zchar 'CPUDT' gv_zchar gc_char
gv_zchar 'CPUTM' gv_zchar gc_char
gv_zchar 'USNAM' gv_zchar gc_char
gv_zchar 'TCODE' gv_zchar gc_char
gv_zchar 'STBLG' gv_zchar gc_char
gv_zchar 'STJAH' gv_zchar gc_char
gv_zchar 'BKTXT' gv_zchar gc_char
gv_zchar 'XSTOV' gv_zchar gc_char
gv_zchar 'STGRD' gv_zchar gc_char
gv_zchar 'PPNAM' gv_zchar gc_char
gv_zchar 'UMSKZ' gv_zchar gc_char
gv_zchar 'SHKZG' gv_zchar gc_char
gv_zchar 'DMBTR' gv_zchar gc_char
gv_zchar 'WRBTR' gv_zchar gc_char
gv_zchar 'PSWBT' gv_zchar gc_char
gv_zchar 'KOKRS' gv_zchar gc_char
gv_zchar 'KOSTL' gv_zchar gc_char
gv_zchar 'VBELN' gv_zchar gc_char
gv_zchar 'VBEL2' gv_zchar gc_char
gv_zchar 'HKONT' gv_zchar gc_char
gv_zchar 'TXT20' gv_zchar gc_char
gv_zchar 'XNEGP' gv_zchar gc_char
into <fs_str>.
unassign <fs_str>. "增加标题文本
append initial line to gt_str assigning <fs_str>.
lv_index = lv_index + 1.
concatenate
gv_zchar lv_index gv_zchar gc_char
gv_zchar text-011 gv_zchar gc_char
gv_zchar text-012 gv_zchar gc_char
gv_zchar text-013 gv_zchar gc_char
gv_zchar text-014 gv_zchar gc_char
gv_zchar text-015 gv_zchar gc_char
gv_zchar text-016 gv_zchar gc_char
gv_zchar text-017 gv_zchar gc_char
gv_zchar text-018 gv_zchar gc_char
gv_zchar text-019 gv_zchar gc_char
gv_zchar text-020 gv_zchar gc_char
gv_zchar text-021 gv_zchar gc_char
gv_zchar text-022 gv_zchar gc_char
gv_zchar text-023 gv_zchar gc_char
gv_zchar text-024 gv_zchar gc_char
gv_zchar text-025 gv_zchar gc_char
gv_zchar text-026 gv_zchar gc_char
gv_zchar text-027 gv_zchar gc_char
gv_zchar text-028 gv_zchar gc_char
gv_zchar text-029 gv_zchar gc_char
gv_zchar text-030 gv_zchar gc_char
gv_zchar text-031 gv_zchar gc_char
gv_zchar text-032 gv_zchar gc_char
gv_zchar text-033 gv_zchar gc_char
gv_zchar text-034 gv_zchar gc_char
gv_zchar text-035 gv_zchar gc_char
gv_zchar text-036 gv_zchar gc_char
gv_zchar text-037 gv_zchar gc_char
gv_zchar text-038 gv_zchar gc_char
gv_zchar text-039 gv_zchar
into <fs_str>.
unassign <fs_str>. "数据明细
loop at gt_data assigning <fs_data>.
clear:lv_dmbtr,lv_wrbtr,lv_pswbt. lv_index = lv_index + 1.
lv_dmbtr = <fs_data>-dmbtr.
lv_wrbtr = <fs_data>-wrbtr.
lv_pswbt = <fs_data>-pswbt. append initial line to gt_str assigning <fs_str>.
concatenate
gv_zchar lv_index gv_zchar gc_char
gv_zchar <fs_data>-bukrs gv_zchar gc_char
gv_zchar <fs_data>-belnr gv_zchar gc_char
gv_zchar <fs_data>-gjahr gv_zchar gc_char
gv_zchar <fs_data>-monat gv_zchar gc_char
gv_zchar <fs_data>-blart gv_zchar gc_char
gv_zchar <fs_data>-bldat gv_zchar gc_char
gv_zchar <fs_data>-budat gv_zchar gc_char
gv_zchar <fs_data>-cpudt gv_zchar gc_char
gv_zchar <fs_data>-cputm gv_zchar gc_char
gv_zchar <fs_data>-usnam gv_zchar gc_char
gv_zchar <fs_data>-tcode gv_zchar gc_char
gv_zchar <fs_data>-stblg gv_zchar gc_char
gv_zchar <fs_data>-stjah gv_zchar gc_char
gv_zchar <fs_data>-bktxt gv_zchar gc_char
gv_zchar <fs_data>-xstov gv_zchar gc_char
gv_zchar <fs_data>-stgrd gv_zchar gc_char
gv_zchar <fs_data>-ppnam gv_zchar gc_char
gv_zchar <fs_data>-umskz gv_zchar gc_char
gv_zchar <fs_data>-shkzg gv_zchar gc_char
gv_zchar lv_dmbtr gv_zchar gc_char
gv_zchar lv_wrbtr gv_zchar gc_char
gv_zchar lv_pswbt gv_zchar gc_char
gv_zchar <fs_data>-kokrs gv_zchar gc_char
gv_zchar <fs_data>-kostl gv_zchar gc_char
gv_zchar <fs_data>-vbeln gv_zchar gc_char
gv_zchar <fs_data>-vbel2 gv_zchar gc_char
gv_zchar <fs_data>-hkont gv_zchar gc_char
gv_zchar <fs_data>-txt20 gv_zchar gc_char
gv_zchar <fs_data>-xnegp gv_zchar
into <fs_str>.
unassign <fs_str>.
endloop. describe table gt_str lines gs_inf-count.
endform.
*&---------------------------------------------------------------------*
*& Form FRM_TXT_DOWNLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_txt_download .
data:
lv_filetype type char10 value 'DAT', "DAT
lv_codepage type abap_encoding value ''. call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = 60
text = text-006. gs_inf-txdat = sy-datum.
gs_inf-txtim = sy-uzeit. concatenate
p_bukrs gc_char1
s_budat-low gc_char1
s_budat-high
into gv_tabnm. gs_inf-tabnm = gv_tabnm. concatenate
'd:\'
gv_tabnm
'.TXT'
into gv_txurl. "内表数据保存本地
call function 'GUI_DOWNLOAD'
exporting
confirm_overwrite = gc_check "如果文件存在 弹出是否覆盖文件的对话框
write_field_separator = space "加入字段分隔符 TAB
filename = gv_txurl "文件名 必须为 STRING 类型
filetype = lv_filetype
codepage = lv_codepage
tables
data_tab = gt_str "内表
exceptions
file_write_error = 1
file_not_found = 2. endform.
*&---------------------------------------------------------------------*
*& Form FRM_TXT_TO_ACCESS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_txt_to_access .
data:
lv_conn type string,
lv_fild type string,
lv_hstr type string,
lv_sqlh type string,
lv_sqli type string,
lv_crtb type string,
lv_detb type string,
lv_qytb type string,
lv_infd type string,
lv_col type string,
lv_txt type string,
lv_cont type i. call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = 80
text = text-007. gs_inf-acdat = sy-datum.
gs_inf-actim = sy-uzeit. concatenate
gc_datasour
p_dburl
into gv_datasour. concatenate
gc_provider gc_char2
gc_security gc_char2
gv_datasour
into lv_conn. "TXT文件
concatenate
'FROM [Text;FMT=CSVDelimited;HDR=Yes;IMEX=;DATABASE=D:\;].['
gv_tabnm
'#txt];'
into lv_txt. "Excel文件
* concatenate
* 'FROM [Excel 8.0;DATABASE=C:\'
* gv_tabnm
* '.xls].[Sheet1]'
* into lv_txt. "删除表
concatenate
'DROP TABLE'
gv_tabnm
into lv_detb separated by space. concatenate
'VALUES ('
gc_char3 text-011 gc_char3 gc_char
gc_char3 text-012 gc_char3 gc_char
gc_char3 text-013 gc_char3 gc_char
gc_char3 text-014 gc_char3 gc_char
gc_char3 text-015 gc_char3 gc_char
gc_char3 text-016 gc_char3 gc_char
gc_char3 text-017 gc_char3 gc_char
gc_char3 text-018 gc_char3 gc_char
gc_char3 text-019 gc_char3 gc_char
gc_char3 text-020 gc_char3 gc_char
gc_char3 text-021 gc_char3 gc_char
gc_char3 text-022 gc_char3 gc_char
gc_char3 text-023 gc_char3 gc_char
gc_char3 text-024 gc_char3 gc_char
gc_char3 text-025 gc_char3 gc_char
gc_char3 text-026 gc_char3 gc_char
gc_char3 text-027 gc_char3 gc_char
gc_char3 text-028 gc_char3 gc_char
gc_char3 text-029 gc_char3 gc_char
gc_char3 text-030 gc_char3 gc_char
gc_char3 text-031 gc_char3 gc_char
gc_char3 text-032 gc_char3 gc_char
gc_char3 text-033 gc_char3 gc_char
gc_char3 text-034 gc_char3 gc_char
gc_char3 text-035 gc_char3 gc_char
gc_char3 text-036 gc_char3 gc_char
gc_char3 text-037 gc_char3 gc_char
gc_char3 text-038 gc_char3 gc_char
gc_char3 text-039 gc_char3
')'
into lv_hstr. "创建数据表-SQL语句
concatenate
'Create TABLE'
gv_tabnm
'('
'ID COUNTER NOT NULL,'
'BUKRS TEXT(),'
'BELNR TEXT(),'
'GJAHR TEXT(),'
'MONAT TEXT(),'
'BLART TEXT(),'
'BLDAT TEXT(),'
'BUDAT TEXT(),'
'CPUDT TEXT(),'
'CPUTM TEXT(),'
'USNAM TEXT(),'
'TCODE TEXT(),'
'STBLG TEXT(),'
'STJAH TEXT(),'
'BKTXT TEXT(),'
'XSTOV TEXT(),'
'STGRD TEXT(),'
'PPNAM TEXT(),'
'UMSKZ TEXT(),'
'SHKZG TEXT(),'
'DMBTR TEXT(),'
'WRBTR TEXT(),'
'PSWBT TEXT(),'
'KOKRS TEXT(),'
'KOSTL TEXT(),'
'VBELN TEXT(),'
'VBEL2 TEXT(),'
'HKONT TEXT(),'
'TXT20 TEXT(),'
'XNEGP TEXT()'
')'
into lv_crtb separated by space. "数据写入-SQL语句-Insert字段明细
concatenate
gv_tabnm
'('
'BUKRS' gc_char
'BELNR' gc_char
'GJAHR' gc_char
'MONAT' gc_char
'BLART' gc_char
'BLDAT' gc_char
'BUDAT' gc_char
'CPUDT' gc_char
'CPUTM' gc_char
'USNAM' gc_char
'TCODE' gc_char
'STBLG' gc_char
'STJAH' gc_char
'BKTXT' gc_char
'XSTOV' gc_char
'STGRD' gc_char
'PPNAM' gc_char
'UMSKZ' gc_char
'SHKZG' gc_char
'DMBTR' gc_char
'WRBTR' gc_char
'PSWBT' gc_char
'KOKRS' gc_char
'KOSTL' gc_char
'VBELN' gc_char
'VBEL2' gc_char
'HKONT' gc_char
'TXT20' gc_char
'XNEGP'
')'
into lv_infd. "数据导入-SQL语句-Select字段明细
concatenate
'F1 AS ID' gc_char
'F2 AS BUKRS' gc_char
'F3 AS BELNR' gc_char
'F4 AS GJAHR' gc_char
'F5 AS MONAT' gc_char
'F6 AS BLART' gc_char
'F7 AS BLDAT' gc_char
'F8 AS BUDAT' gc_char
'F9 AS CPUDT' gc_char
'F10 AS CPUTM' gc_char
'F11 AS USNAM' gc_char
'F12 AS TCODE' gc_char
'F13 AS STBLG' gc_char
'F14 AS STJAH' gc_char
'F15 AS BKTXT' gc_char
'F16 AS XSTOV' gc_char
'F17 AS STGRD' gc_char
'F18 AS PPNAM' gc_char
'F19 AS UMSKZ' gc_char
'F20 AS SHKZG' gc_char
'F21 AS DMBTR' gc_char
'F22 AS WRBTR' gc_char
'F23 AS PSWBT' gc_char
'F24 AS KOKRS' gc_char
'F25 AS KOSTL' gc_char
'F26 AS VBELN' gc_char
'F27 AS VBEL2' gc_char
'F28 AS HKONT' gc_char
'F29 AS TXT20' gc_char
'F30 AS XNEGP'
into lv_fild. "SQL语句-查询记录数 "SQL语句-导入已存在表记录-数据抬头
concatenate
'INSERT INTO'
lv_infd
lv_hstr
into lv_sqlh separated by space. "SQL语句--创建表同时导入数据
concatenate
'SELECT * '
"lv_fild
'INTO'
gv_tabnm
lv_txt
into lv_sqli separated by space. "SQL语句--导入已存在表记录-数据明细
* concatenate
* 'INSERT INTO'
* lv_infd
* 'SELECT'
* lv_fild
* lv_txt
* into lv_sqli separated by space. "数据库连接
create object go_conn 'ADODB.Connection'.
set property of go_conn 'Provider' = gc_provider.
set property of go_conn 'ConnectionString' = lv_conn.
call method of go_conn 'Open'. call method of go_conn 'BeginTrans' = lv_cont. * "创建表
* call method of go_conn 'Execute' = go_rset
* exporting
* #1 = lv_crtb.
*
* "写入标题数据
* call method of go_conn 'Execute' = go_rset
* exporting
* #1 = lv_sqlh. "写入明细数据
call method of go_conn 'Execute' = go_rset
exporting
#1 = lv_sqli. call method of go_conn 'CommitTrans' = lv_cont. "关闭及释放
call method of go_rset 'Close'.
call method of go_conn 'Close'.
call method of go_rtab 'Close'.
free object go_rset.
free object go_rtab.
free object go_conn. "完成时间
gs_inf-fhdat = sy-datum.
gs_inf-fhtim = sy-uzeit. if gs_inf-fhdat = gs_inf-qydat.
gs_inf-ustim = gs_inf-fhtim - gs_inf-qytim.
else.
gs_inf-ustim = ( gs_inf-fhdat - gs_inf-qydat ) * 240000 - gs_inf-fhtim + gs_inf-qytim.
endif. endform.
*&---------------------------------------------------------------------*
*& Form FRM_TXT_DELETE_FILE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_txt_delete_file .
data:lv_rc type i. call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = 100
text = text-008. call method cl_gui_frontend_services=>file_delete
exporting
filename = gv_txurl
changing
rc = lv_rc. endform.
*&---------------------------------------------------------------------*
*& Form FRM_EXEC_INFO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_exec_info .
skip.
write:/10 text-050.
write:/10(60) sy-uline.
write:/20 text-051,35 p_bukrs.
write:/20 text-052,35 s_budat-low,50 s_budat-high.
write:/20 text-053,35 p_dburl.
write:/20 text-054,35 gs_inf-tabnm.
write:/20 text-055,35 sy-uname.
skip.
write:/10 text-056.
write:/10(60) sy-uline.
write:/20 text-057,35 gs_inf-count.
write:/20 text-058,35 gs_inf-qydat,50 gs_inf-qytim.
write:/20 text-059,35 gs_inf-txdat,50 gs_inf-txtim.
write:/20 text-060,35 gs_inf-acdat,50 gs_inf-actim.
write:/20 text-061,35 gs_inf-fhdat,50 gs_inf-fhtim.
write:/20 text-062,35 gs_inf-ustim. endform.
*&---------------------------------------------------------------------*
*& Form FRM_GET_AUTH_BUKRS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_BUKRS text
*----------------------------------------------------------------------*
form frm_get_auth_bukrs using fv_bukrs.
data:
lt_value type table of usvalues.
field-symbols:
<fs_value> type usvalues. call function 'SUSR_USER_AUTH_FOR_OBJ_GET'
exporting
user_name = sy-uname
sel_object = 'F_BKPF_BUK'
tables
values = lt_value
exceptions
user_name_not_exist = 1
not_authorized = 2
internal_error = 3
others = 4.
if sy-subrc = 0 .
loop at lt_value assigning <fs_value>
where field = 'BUKRS'
and von ne '*'.
select single count(*)
from t001
where bukrs = <fs_value>-von.
if sy-subrc = 0.
fv_bukrs = <fs_value>-von.
endif.
endloop.
endif. endform.
*&---------------------------------------------------------------------*
*& Form FRM_AUTH_CHECK_BUKRS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_auth_check_bukrs .
authority-check
object 'F_BKPF_BUK'
id 'BUKRS'
field p_bukrs.
if sy-subrc ne 0.
message e001(00) with p_bukrs text-009.
endif. select single count(*)
from t001
where bukrs = p_bukrs.
if sy-subrc <> 0.
message e001(00) with p_bukrs text-040.
endif. if s_budat-low is initial
or s_budat-high is initial.
message e001(00) with text-041.
endif.
endform.
上一篇:python基础知识一


下一篇:SHA1l加密