SAP BW ODS無效字元自動處理程式【升級版】
參考上一篇 SAP BW ODS無效字元自動處理程式
之前的程式在後面的使用過程中發現了一些Bug,更重要的是ODS啟用一遇到錯誤就自動退出,導致異常只會顯示第一條,而實際情況可能會有好幾筆類似資料,所以最近做了一些更新。
與之前相比,修正了值存在空格無法更新的Bug外,另外變成對所有的行都進行掃描並找出異常字元進行更新。
*&---------------------------------------------------------------------*
*& Report Z1RD0017
*&
*&---------------------------------------------------------------------*
*& Created By: Reed Lei (20100401)
*& todo: Replace the inValid character in ODS New Data Table
*& Selection Texts
*& L_D Alert Date
*& L_LIST Only Display InValid Data ?
*& L_ODS ODS Name
*&---------------------------------------------------------------------*
REPORT z1rd0017.
TABLES:rsdodso.
TYPES:
BEGIN OF bal_s_lout,
* handle of this control representation
handle TYPE balcnthndl,
* initial input
profile TYPE bal_s_prof,
log_hndl TYPE bal_t_logh,
msg_hndl TYPE bal_t_msgh,
log_filt TYPE bal_s_lfil,
log_cfil TYPE bal_t_cfil,
msg_filt TYPE bal_s_mfil,
msg_cfil TYPE bal_t_cfil,
* controls
container TYPE REF TO cl_gui_container,
splitter TYPE REF TO cl_gui_splitter_container,
tree TYPE REF TO cl_gui_column_tree,
grid TYPE REF TO cl_gui_alv_grid,
event_rec TYPE REF TO object,
* converted profile
use_grid TYPE boolean,
prof_int TYPE bal_s_iprf,
* data to be displayed
t_log_hndl TYPE bal_t_logh,
t_msg_hndl TYPE bal_t_msgh,
* data for tree
t_columns TYPE bal_t_hdrs,
t_node TYPE bal_t_node,
t_item TYPE bal_t_item,
tree_logs TYPE bal_t_trlg,
tree_msgs TYPE bal_t_trms,
* current state
count_all TYPE bal_s_scnt,
cur_node TYPE tv_nodekey,
longtexts_exist TYPE boolean,
params_exist TYPE boolean,
sel_msgty TYPE bal_s_smty,
ucomm_data TYPE bal_s_cbuc,
* tabname for the flat ALV-table for using in REUSE_ALV_LIST_DISPLAY
tabname_alv TYPE tabname,
END OF bal_s_lout,
bal_t_lout TYPE SORTED TABLE OF bal_s_lout
WITH UNIQUE KEY handle
INITIAL SIZE 1.
DATA: log_handle TYPE balloghndl.
DATA: l_s_prof TYPE bal_s_prof,
l_t_logh TYPE bal_t_logh.
DATA: l_sx_display_profile TYPE bal_s_prof,
ls_display_profile TYPE bal_s_prof.
* Get display profile for popup
CONSTANTS:
true TYPE boolean VALUE 'X',
false TYPE boolean VALUE ' '.
DATA:
g_access_control_done TYPE boolean.
DATA:
BEGIN OF g OCCURS 0,
control_handle TYPE balcnthndl,
profile TYPE bal_s_prof,
prof_int TYPE bal_s_iprf,
sel_msgty TYPE bal_s_smty,
custom_container TYPE REF TO cl_gui_custom_container,
docking_container TYPE REF TO cl_gui_docking_container,
END OF g.
DATA:
BEGIN OF wa_ods,
odsobject TYPE rsdodsobject,
fieldname(20),
value(20),
END OF wa_ods.
DATA:it_ods LIKE TABLE OF wa_ods.
DATA g_log_handles TYPE bal_t_logh .
DATA: g_log_profile TYPE bal_s_prof,l_retcode TYPE i.
DATA: l_ln TYPE balloghndl.
DATA: l_log_filter TYPE bal_s_lfil,
l_log_headers TYPE balhdr_t WITH HEADER LINE.
DATA: l_lognumber TYPE bal_r_logn WITH HEADER LINE.
DATA: l_aldate TYPE bal_r_date WITH HEADER LINE.
DATA: l_object TYPE LINE OF bal_r_obj ,
l_subobject TYPE LINE OF bal_r_sub,
l_extnumber TYPE LINE OF bal_r_extn.
DATA: l_msgid(10),l_msgno(10),
l_rsm1187_msg(100) VALUE 'Error getting SID for ODS object',
l_brain060_msg1(100) VALUE 'Value ',
l_brain060_msg2(100) VALUE '(hex.',
l_brain060_msg3(100) VALUE ') of characteristic',
l_brain060_msg4(100) VALUE 'contains invalid characters',
l_str(255),
l_msg(255).
DATA: citab LIKE TABLE OF l_str.
DATA: l_index LIKE sy-index.
DATA: l_lines TYPE i .
FIELD-SYMBOLS:
PARAMETERS:l_list AS CHECKBOX DEFAULT 'X'.
*PARAMETERS l_chall AS CHECKBOX DEFAULT 'X' NO-DISPLAY . "check and update the all rows
*SELECT-OPTIONS: l_c FOR l_lognumber-low NO INTERVALS.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME. TITLE text-100.
SELECT-OPTIONS:l_ods FOR rsdodso-odsobject NO INTERVALS NO-EXTENSION OBLIGATORY.
SELECT-OPTIONS: l_d FOR l_aldate-low OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
l_d-sign = 'I'.
l_d-option = 'EQ'.
l_d-low = sy-datum.
APPEND l_d.
START-OF-SELECTION.
*APPEND LINES OF l_c TO l_log_filter-lognumber.
APPEND LINES OF l_d TO l_log_filter-aldate.
l_object-sign = 'I'.
l_object-option = 'EQ'.
l_object-low = 'RSSM'.
APPEND l_object TO l_log_filter-object.
l_subobject-sign = 'I'.
l_subobject-option = 'EQ'.
l_subobject-low = 'MON'.
APPEND l_subobject TO l_log_filter-subobject.
l_extnumber-sign = 'I'.
l_extnumber-option = 'EQ'.
CONCATENATE 'MON:PROTOCOLL_ACTION-ODSAC-' l_ods-low INTO l_extnumber-low .
APPEND l_extnumber TO l_log_filter-extnumber.
CALL FUNCTION 'BAL_DB_SEARCH'
EXPORTING
i_s_log_filter = l_log_filter
IMPORTING
e_t_log_header = l_log_headers[]
EXCEPTIONS
log_not_found = 1.
DESCRIBE TABLE l_log_headers LINES l_lines.
IF l_lines EQ 0 .
WRITE: 'Without Error Log'.
EXIT.
ENDIF.
*DELETE l_log_headers WHERE msg_cnt_al NE 11. "abnormal message is total 11 lines.
LOOP AT l_log_headers .
CLEAR:g_log_handles[].
l_ln = l_log_headers-log_handle.
INSERT l_ln INTO TABLE g_log_handles.
CALL FUNCTION 'BAL_DSP_PROFILE_SINGLE_LOG_GET'
IMPORTING
e_s_display_profile = l_sx_display_profile
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'BAL_DB_LOAD'
EXPORTING
i_t_log_handle = g_log_handles
i_exception_if_already_loaded = space
EXCEPTIONS
OTHERS = 1.
*********************************************************************
* set data to be displayed
*********************************************************************
CALL FUNCTION 'BAL_CNTL_CREATE'
EXPORTING
i_container = g-custom_container
i_s_display_profile = g-profile
i_t_log_handle = g_log_handles
IMPORTING
e_control_handle = g-control_handle
EXCEPTIONS
profile_inconsistent = 1
OTHERS = 2.
PERFORM. load(saplsbal_cntl).
ASSIGN ('(SAPLSBAL_CNTL)D_T[]') TO
IF NOT
* 251(BL): "Control does not exist."
MESSAGE e251(bl) INTO sy-msgli.
EXIT.
ENDIF.
ENDLOOP.
LOOP AT
* point to message data table
IF
CONTINUE.
ENDIF.
ASSIGN (
LOOP AT
ASSIGN COMPONENT '%_MSGID' OF STRUCTURE
l_msgid =
ASSIGN COMPONENT '%_MSGNO' OF STRUCTURE
l_msgno =
IF l_msgid EQ 'RSM1' AND l_msgno EQ '187'.
CLEAR: citab[].
ASSIGN COMPONENT 'T_MSG' OF STRUCTURE
l_str =
* SPLIT l_rsm1187_msg AT space INTO TABLE citab.
* LOOP AT citab INTO l_msg.
REPLACE FIRST OCCURRENCE OF l_rsm1187_msg IN l_str WITH '' .
* ENDLOOP.
CONDENSE l_str.
wa_ods-odsobject = l_str.
ENDIF.
IF l_msgid EQ 'BRAIN' AND
( l_msgno EQ '060' OR l_msgno EQ '059').
CLEAR: citab[].
ASSIGN COMPONENT 'T_MSG' OF STRUCTURE
l_str =
* SPLIT l_brain060_msg AT space INTO TABLE citab.
* LOOP AT citab INTO l_msg.
* REPLACE FIRST OCCURRENCE OF l_msg IN l_str WITH '' .
* ENDLOOP.
*** Marked by Reedlei 20100610
REPLACE FIRST OCCURRENCE OF l_brain060_msg1 IN l_str WITH '|' .
REPLACE FIRST OCCURRENCE OF l_brain060_msg2 IN l_str WITH '|' .
REPLACE FIRST OCCURRENCE OF l_brain060_msg3 IN l_str WITH '|' .
REPLACE FIRST OCCURRENCE OF l_brain060_msg4 IN l_str WITH '|' .
*** Added by Reedlei 20100610
SPLIT l_str AT '|' INTO TABLE citab.
LOOP AT citab INTO l_msg.
l_index = sy-tabix.
CONDENSE l_msg.
IF l_msg IS INITIAL.
DELETE citab INDEX l_index.
ENDIF.
ENDLOOP.
READ TABLE citab INDEX 1 INTO l_msg.
*** Marked by Reedlei 20100610
CONDENSE l_msg.
wa_ods-value = l_msg.
READ TABLE citab INDEX 3 INTO l_msg.
CONDENSE l_msg.
wa_ods-fieldname = l_msg.
ENDIF.
ENDLOOP.
IF NOT wa_ods-fieldname IS INITIAL AND
NOT wa_ods-odsobject IS INITIAL AND
NOT wa_ods-value IS INITIAL.
APPEND wa_ods TO it_ods.
ENDIF.
ENDLOOP.
DATA:
l_entries TYPE i.
***********************************************************************
* destroy containers
***********************************************************************
IF NOT g-docking_container IS INITIAL.
CALL METHOD g-docking_container->free
EXCEPTIONS
THERS = 0.
ENDIF.
IF NOT g-custom_container IS INITIAL.
CALL METHOD g-custom_container->free
EXCEPTIONS
THERS = 0.
ENDIF.
***********************************************************************
* reduce stack
***********************************************************************
CLEAR g.
DESCRIBE TABLE g LINES l_entries.
IF l_entries > 0.
READ TABLE g INDEX l_entries.
DELETE g INDEX l_entries.
ENDIF.
SORT it_ods.
DELETE ADJACENT DUPLICATES FROM it_ods.
DATA:l_up(200),l_st(200),l_wh(200),l_new(200).
DATA: fieldnm TYPE rsdiobjfieldnm.
WRITE: AT 10(15) 'ODS NAME' , 30(15) 'FieldName', 60(15)'Value'.
ULINE AT /5(70).
LOOP AT it_ods INTO wa_ods.
CONCATENATE ' /BIC/A' wa_ods-odsobject '40' INTO l_up.
SELECT SINGLE fieldnm FROM rsdiobj INTO fieldnm
WHERE iobjnm = wa_ods-fieldname AND bjvers = 'A'.
SELECT (fieldnm) INTO TABLE citab FROM (l_up).
SORT citab.
DELETE ADJACENT DUPLICATES FROM citab.
LOOP AT citab INTO l_str.
CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
EXPORTING
intext = l_str
IMPORTING
uttext = l_new.
IF l_new NE l_str.
CONCATENATE ' ' fieldnm ' = ''' l_new '''' INTO l_st.
CONCATENATE ' ' fieldnm ' = ''' l_str '''' INTO l_wh.
IF NOT l_list EQ 'X'.
UPDATE (l_up)
SET (l_st)
WHERE (l_wh).
ENDIF.
WRITE : AT /10(15) wa_ods-odsobject ,
28 wa_ods-fieldname,55 l_str+0(40) LEFT-JUSTIFIED.
ENDIF.
ENDLOOP.
ENDLOOP.
* ENDIF.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/554557/viewspace-664910/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SAP BW ODS無效字元自動處理程式字元
- Oracle 處理無效物件數Oracle物件
- DC 升級/降級事件處理事件
- 【TensorFlow重大升級】自動將Python程式碼轉為TFGraph,大幅簡化動態圖處理!Python
- Ionic實戰 自動升級APP(Android版)APPAndroid
- 藍橋杯_演算法提高_身份證升級(簡單字元處理)演算法字元
- 關閉chrome自動升級的教程 chrome如何取消自動升級Chrome
- 整塊程式碼自動生成、智慧括號匹配……CodeGeeX程式設計提效,功能再升級!程式設計
- 某次BW 異常處理過程
- 關於jQuery用bind動態繫結事件無效的處理jQuery事件
- 解析XML檔案時,無效的XML 字元 (Unicode: 0x7)異常處理XML字元Unicode
- SAP BW系統建立連結到BW
- oracle延遲事務無法自動推入處理Oracle
- BW處理鏈的Attribute Chane Run
- 如何處理快取導致的無效曝光快取
- Oracle之處理synonym同義詞無效物件Oracle物件
- Oracle資料庫無效物件問題處理Oracle資料庫物件
- Chrome 自動升級後,本地專案都無法訪問Chrome
- win10無法升級到10586怎麼解決_win10無法升級到10586處理方法Win10
- shell 字元處理字元
- SAP BW:CUBE size 分析
- SAP BW : Cannot delete DTPdelete
- ios+appium 自動化 click 無效iOSAPP
- windows10 家庭版升級專業版的圖文步驟(無損升級)Windows
- 升級Win11專業工作站版金鑰,無需程式碼一秒升級
- bug處理--antdesign中umi升級後無法載入子頁面
- 微信電腦版怎麼升級?微信PC版手動更新升級方法教程
- 升級win10系統提示安裝程式無法驗證產品金鑰如何處理Win10
- 字元處理函式字元函式
- tr命令“字元”處理字元
- SAP-FI模組 如何處理自動生成會計憑證增強
- SpringMvc自動裝配@Controller無效SpringMVCController
- SAP BW 學習筆記筆記
- 在SAP BW中使用javascriptJavaScript
- SAP BW 基礎知識
- ChatExcel--自動處理表格Excel
- android 自動檢測版本升級Android
- 開啟 Ubuntu 系統自動升級Ubuntu