備份ABAP程式碼 (分模組儲存)
[@more@]
REPORT zrp_backup_abapcode.
TABLES tadir.
TYPES: BEGIN OF t_type,
line(9999),
END OF t_type.
DATA rep_table TYPE STANDARD TABLE OF t_type WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 500.
DATA: file TYPE string,"RLGRAP-FILENAME.
path TYPE string.
PARAMETER: obj_name LIKE tadir-obj_name DEFAULT 'Z%'.
SELECT-OPTIONS: object FOR tadir-object DEFAULT 'PROG',
author FOR tadir-author, "AUTHOR FOR TADIR-AUTHOR DEFAULT SY-UNAME,
devclass FOR tadir-devclass.
DATA: BEGIN OF it_table OCCURS 0,
obj_name LIKE tadir-obj_name,
END OF it_table.
DATA: BEGIN OF wa_table,
obj_name LIKE tadir-obj_name,
END OF wa_table.
DATA: message_text TYPE string.
DATA: zmd TYPE char6.
***********************************************************************
START-OF-SELECTION.
SELECT obj_name INTO TABLE it_table FROM tadir
WHERE obj_name LIKE obj_name AND
object IN object AND
author IN author AND
devclass IN devclass.
SORT it_table BY obj_name.
LOOP AT it_table INTO wa_table.
IF wa_table-obj_name+4(2) = 'MM'
OR wa_table-obj_name+5(2) = 'MM' .
zmd = 'MM'.
ELSEIF wa_table-obj_name+4(2) = 'PP'
OR wa_table-obj_name+5(2) = 'PP'.
zmd = 'PP'.
ELSEIF wa_table-obj_name+4(2) = 'SD'
OR wa_table-obj_name+5(2) = 'SD'.
zmd = 'SD'.
ELSEIF wa_table-obj_name+4(2) = 'FI'
OR wa_table-obj_name+5(2) = 'FI'
OR wa_table-obj_name+4(2) = 'CO'
OR wa_table-obj_name+5(2) = 'CO'.
zmd = 'FICO'.
ELSEIF wa_table-obj_name+4(2) = 'HR'
OR wa_table-obj_name+5(2) = 'HR'.
zmd = 'HR'.
ELSE.
zmd = 'OTHERS'.
ENDIF.
IF devclass-high <> ''.
CONCATENATE 'C:BACKUP-' zmd '-' sy-datum+6(2) '.' sy-datum+4(2) '.'
sy-datum+0(4) '-' sy-sysid '-' devclass-low
'-' devclass-high ''
INTO path.
ELSE.
CONCATENATE 'C:BACKUP-' zmd '-' sy-datum+6(2) '.' sy-datum+4(2) '.'
sy-datum+0(4) '-' sy-sysid '-' devclass-low
''
INTO path.
ENDIF.
CONDENSE path NO-GAPS.
READ REPORT wa_table-obj_name INTO rep_table.
IF wa_table-obj_name CS ''.
ELSE.
CLEAR file.
CONCATENATE path wa_table-obj_name '.TXT' INTO file.
IF sy-subrc = 0.
* CALL FUNCTION 'DOWNLOAD'
* EXPORTING
* FILENAME = FILE
* FILETYPE = 'ASC' "ASC, WK1, DBF, DAT, bin
* MODE = ' ' "Mode ' ' = Rewrite Mode 'A' = Appending
* TABLES
* DATA_TAB = REP_TABLE.
* WRITE: / 'File Saved Successfully'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = file
filetype = 'ASC'
* APPEND = 'X'
* WRITE_FIELD_SEPARATOR = 'X'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* IMPORTING
* FILELENGTH =
TABLES
data_tab = rep_table
* FIELDNAMES =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22 .
IF sy-subrc <> 0.
WRITE :/ 'File download error,Message code:',sy-subrc,
' creating file ',file.
ENDIF.
ELSE.
WRITE: / 'Error Occured'.
ENDIF.
ENDIF.
ENDLOOP.
message_text = 'FILE(S) CREATED IN FOLDER'.
CONCATENATE message_text path INTO message_text SEPARATED BY space.
MESSAGE message_text TYPE 'I'.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9437124/viewspace-980341/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle自動備份,儲存每天備份日誌的指令碼編寫Oracle指令碼
- RMAN備份恢復——備份集儲存位置改變
- oracle儲存過程分頁程式碼Oracle儲存過程
- innodb儲存引擎備份工具--Xtrabackup儲存引擎
- RMAN相容性、控制檔案自動備份、儲存時間、備份策略、備份指令碼(二)指令碼
- catalog備份資料庫及RMAN儲存指令碼資料庫指令碼
- ORACLE高效分頁儲存過程程式碼Oracle儲存過程
- MySQL備份之分庫分表備份指令碼MySql指令碼
- Spark 儲存模組原始碼學習Spark原始碼
- 利用Dectorator分模組儲存Vuex狀態(下)Vue
- 利用Dectorator分模組儲存Vuex狀態(上)Vue
- SQL Server 資料備份儲存過程SQLServer儲存過程
- MySQL儲存安全(TDE加密、自動備份)MySql加密
- asp.net利用儲存過程分頁程式碼ASP.NET儲存過程
- NFS儲存rman備份時的mount選項NFS
- 深入剖析 RocketMQ 原始碼 - 訊息儲存模組MQ原始碼
- 臨時儲存程式碼
- MySQL:Windows下分庫備份指令碼MySqlWindows指令碼
- 讓備份資料“枯木逢春”,杉巖釋出備份儲存一體機
- ABAP開發的Github issue備份工具Github
- MySQL不同儲存引擎的資料備份與恢復MySql儲存引擎
- 檔案儲存NAS備份服務開放公測
- 自動備份SQL資料庫到雲端儲存StorageSQL資料庫
- 轉:IBM儲存備份管理軟體TSM介紹IBM
- Windows下RMAN備份程式碼Windows
- android Notification 程式碼備份Android
- asp.net SQL Server 儲存過程分頁及程式碼呼叫ASP.NETSQLServer儲存過程
- 4款優秀免費線上資料備份/儲存工具
- 可用。儲存分頁
- 儲存ASPX 生成的html程式碼HTML
- SQL備份資料庫程式碼SQL資料庫
- WINDOWS自動打包目錄指令碼 複製到遠端備份伺服器儲存Windows指令碼伺服器
- OceanBase 儲存層程式碼解讀(三)巨集塊儲存格式
- OceanBase 儲存層程式碼解讀(二)微塊儲存格式
- SQL Server 簡單備份指令碼程式碼SQLServer指令碼
- Synology群暉NAS儲存如何設定備份計劃自動備份電腦資料夾
- win10系怎麼備份已儲存的遊戲檔案Win10遊戲
- 分散式文件儲存資料庫之MongoDB備份與恢復分散式資料庫MongoDB