PM-功能位置特性值批次更新程式
一個比較實用的程式,特性值的匯入,此程式主要用在PM的功能位置(IL02)特性值匯入,只要把對應的TABLE改一下,還可以用在物料等特性值的匯入上。
匯入模板:
PM000023 | PM000024 | PM000025 | PM000026 | PM000027 | PM000028 | PM000029 | |
33250001-W1-0002 | 3 | 4 | 5 | 3 | 2 | 2 | 2 |
33250001-W1-0001 | 3 | 4 | 5 | 3 | 2 | 2 | 2 |
到內表以後有作轉換,變成如下模板:
功能位置 | 類別 | 特性 | 特性值 |
33250001-W1-0002 | EAMSD001 | PM000028 | 1 |
33250001-W1-0002 | EAMSD001 | PM000029 | 2 |
33250001-W1-0002 | EAMSD001 | PM000030 | 3 |
33250001-W1-0002 | EAMSD001 | PM000031 | 4 |
因為第一個模板是之前匯入的模組,如果要人工整理成第二種標準模板,過於麻煩,使用者比較偉大,所有隻好在程式中作處理了,類別由程式實現。第一種模板如果特性值超過256個,就沒辦法匯入了,EXCEL只有256列,第二個模板就不會有這樣的問題。
程式如下:
[@more@]*&---------------------------------------------------------------------*
*& Report ZPMIXS010
*&
*&---------------------------------------------------------------------*
*& Written By : Maurice Qiu
*& Date Written : 2008/07/07
*& Program Purpose : 功能位置特性值批次更新-BAPI
*& Run Frequency : Others
*& Transaction Codes :
*& Input File Names : N/A
*& Output File Names : N/A
*& Reports Generated : N/A
*& Related Processes :
*& Others : N/A
*&--------------------------------------------------------------------**
************************************************************************
REPORT ZPMIXS010 NO STANDARD PAGE HEADING
LINE-SIZE 150
LINE-COUNT 56
MESSAGE-ID 00.
DATA: g_retcode LIKE sy-subrc,
g_pcfilegui TYPE string,
c_asc TYPE char10 VALUE 'ASC'.
DATA: g_klart TYPE tcla-klart.
DATA: BEGIN OF it_tab OCCURS 0,
tplnr LIKE iflot-tplnr,
class LIKE rmclf-class,
atnam LIKE cabn-atnam,
atwrt TYPE atwrt,
END OF it_tab.
TYPES: typ_t_csv_data LIKE STANDARD TABLE OF it_tab.
* 特性格式
CONSTANTS: c_characteristic_format_number TYPE atfor VALUE 'NUM',
c_characteristic_format_date TYPE atfor VALUE 'DATE',
c_characteristic_format_time TYPE atfor VALUE 'TIME',
c_characteristic_format_char TYPE atfor VALUE 'CHAR',
c_characteristic_format_bool TYPE atfor VALUE 'BOOL',
c_characteristic_format_curr TYPE atfor VALUE 'CURR'.
* 表名
CONSTANTS: c_table_name(20) TYPE c VALUE 'IFLOT'.
DATA: BEGIN OF it_error OCCURS 0,
tplnr LIKE iflot-tplnr,
class LIKE rmclf-class,
atnam LIKE cabn-atnam,
message(100),
END OF it_error.
*&---------------------------------------------------------------------*
** Selection Screen
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETERS p_file LIKE rlgrap-filename OBLIGATORY DEFAULT text-002.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK bk1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
***Search help for get download path from PC
PERFORM get_pc_download_path USING 'X'
CHANGING p_file.
AT SELECTION-SCREEN.
***For check path exist or not
PERFORM check_path.
PERFORM get_upload_data. "to upload data from local path
START-OF-SELECTION.
PERFORM process_data. " 整理資料
* Write error message.
PERFORM write_error_report.
END-OF-SELECTION.
FREE: it_error,it_tab.
TOP-OF-PAGE.
PERFORM write_title.
************************************************************************
*----------------------------------------------------------------------*
* INCLUDE ZSEARCH_HELP *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form get_pc_download_path
*&---------------------------------------------------------------------*
*& Search help for get download path form PC
*----------------------------------------------------------------------*
FORM get_pc_download_path USING value(p_value)
CHANGING p_pcfile LIKE rlgrap-filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = p_value
CHANGING
file_name = p_pcfile.
ENDFORM. " get_pc_download_path
*&---------------------------------------------------------------------*
*& Form check_path
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* *----------------------------------------------------------------------*
FORM check_path.
DATA: l_fpath(255),
l_fname(255),
l_ftext(10).
CLEAR: l_fpath, l_fname, l_ftext, g_retcode.
* To check path of upload form pc correct or not
PERFORM parsing_filename USING p_file
CHANGING l_fpath
l_fname
l_ftext.
TRANSLATE l_ftext TO UPPER CASE.
IF l_ftext <> 'XLS'.
MESSAGE e398 WITH '不可以上傳' l_ftext '的檔案!'.
STOP.
ENDIF.
PERFORM check_dir_of_pc USING l_fpath
CHANGING g_retcode.
IF g_retcode = 0. "0 no exit, 1:exit
MESSAGE e398 WITH '目錄' l_fpath '沒有找到!'.
g_retcode = 1.
STOP.
ELSE.
CLEAR g_retcode.
PERFORM check_file_of_pc USING p_file
CHANGING g_retcode.
IF g_retcode <> 1.
MESSAGE e398 WITH '檔案' l_fname '沒有找到!'.
STOP.
ENDIF.
ENDIF.
ENDFORM. " check_path
*&---------------------------------------------------*
*& Form PARSING_FILENAME
*&---------------------------------------------------*
* The function split the full file name to path,
* file name and extension
*----------------------------------------------------*
* INPUT:
* P_FULLNAME : the full file string shall be parsed
* OUTPUT:
* P_PATH: FILE PATH
* P_FILENAME: FILE NAME
* P_EXTENSION: FILE EXTENSION
*----------------------------------------------------*
FORM parsing_filename USING p_fullname TYPE rlgrap-filename
CHANGING p_path
p_filename
p_extension.
DATA : l_filename(128) TYPE c,
l_extname(10) TYPE c,
l_leftname(120) TYPE c,
l_pos LIKE sy-fdpos,
l_full_len TYPE i,
l_cut_len TYPE i.
CONSTANTS: c_bslash_2(2) VALUE ''.
DATA: l_bslash_2(2).
DATA: l_fullname TYPE rlgrap-filename.
IF p_fullname(2) = c_bslash_2.
l_fullname = p_fullname+2.
l_bslash_2 = c_bslash_2.
ELSE.
l_fullname = p_fullname.
CLEAR l_bslash_2.
ENDIF.
SPLIT l_fullname AT '.' INTO l_filename l_extname.
* end change for remote file path
IF l_extname IS INITIAL.
p_extension = '.xls'.
ELSE.
p_extension = l_extname.
ENDIF.
l_full_len = strlen( l_filename ).
IF l_filename CS ''.
p_path = l_filename+0(sy-fdpos).
l_pos = sy-fdpos + 1.
l_cut_len = l_full_len - l_pos.
l_filename = l_filename+l_pos(l_cut_len).
ENDIF.
** retrieve file name
DO.
IF l_filename CS ''.
l_full_len = strlen( l_filename ).
l_pos = sy-fdpos + 1.
l_cut_len = l_full_len - l_pos.
l_leftname = l_filename+0(sy-fdpos).
CONCATENATE p_path '' l_leftname
INTO p_path.
l_filename = l_filename+l_pos(l_cut_len).
ELSE.
p_filename = l_filename.
EXIT.
ENDIF.
ENDDO.
* change for remote file path V01
IF NOT l_bslash_2 IS INITIAL.
CONCATENATE l_bslash_2 p_path INTO p_path.
ENDIF.
ENDFORM. " Extract_FILEPATH
*&---------------------------------------------------------------------*
*& Form check_dir_of_pc
*&---------------------------------------------------------------------*
* check directory exist or not in presentation server
*----------------------------------------------------*
* INPUT:
* f_PATH : Dir string
* OUTPUT:
* F_RETURN: Query result
* 0 - not exist
* 1 - dir exist
*----------------------------------------------------*
FORM check_dir_of_pc
USING pl_path TYPE c
CHANGING pl_return.
DATA: l_return(512) TYPE c.
CALL FUNCTION 'WS_QUERY'
EXPORTING
* ENVIRONMENT =
filename = pl_path
query = 'DE'
* WINID =
IMPORTING
return = l_return.
pl_return = l_return.
ENDFORM. "check_dir_of_pc
*&---------------------------------------------------------------------*
*& Form check_file_of_pc
*&---------------------------------------------------------------------*
* Check if FILENAME exists in presentation server
*----------------------------------------------------*
* INPUT:
* f_PATH : Dir string
* OUTPUT:
* F_RETURN: Query result
* 0 - not exist
* 1 - dir exist
*----------------------------------------------------*
FORM check_file_of_pc
USING pl_path TYPE c
CHANGING pl_return.
DATA: l_return(512) TYPE c.
CALL FUNCTION 'WS_QUERY'
EXPORTING
* ENVIRONMENT =
filename = pl_path
query = 'FE'
* WINID =
IMPORTING
return = l_return.
pl_return = l_return.
ENDFORM. "check_dir_of_pc
***************************************************
*----------------------------------------------------------------------*
* INCLUDE ZPM_BAPIF01 *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form get_upload_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* *----------------------------------------------------------------------*
FORM get_upload_data.
DATA : lt_intern TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA : l_row TYPE i,
l_col TYPE i,
l_tabix TYPE i.
CONSTANTS: c_linesize TYPE i VALUE 132.
DATA l_message(50).
DATA: l_row_st TYPE i VALUE '1',
l_row_ed TYPE i VALUE '65535',
l_col_st TYPE i VALUE '1',
l_col_ed TYPE i VALUE '256'.
FIELD-SYMBOLS
FIELD-SYMBOLS
FIELD-SYMBOLS
FIELD-SYMBOLS
*&fuction to upload excel data into internal table lt_intern
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = l_col_st
i_begin_row = l_row_st
i_end_col = l_col_ed
i_end_row = l_row_ed
TABLES
intern = lt_intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
*&if file format is wrong etc., show error message.
IF sy-subrc <> 0.
MESSAGE e398 WITH 'Error upload to internal table!'.
EXIT.
ENDIF.
*&no data in excel file
IF lt_intern[] IS INITIAL.
MESSAGE e398 WITH 'No data be upload!'.
EXIT.
ELSE.
LOOP AT lt_intern.
l_row = lt_intern-row.
l_col = lt_intern-col.
ENDLOOP.
l_row = l_row - 1.
SORT lt_intern BY row col.
********************************************************************
*分配特性
DO l_row TIMES.
LOOP AT lt_intern.
ASSIGN COMPONENT 3 OF STRUCTURE it_tab TO
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND it_tab.
CLEAR it_tab.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ENDDO.
********************************************************************
DATA : 4_row TYPE i VALUE 2,
4_col TYPE i VALUE 2,
l_clint LIKE kssk-clint.
LOOP AT it_tab.
CLEAR l_clint.
READ TABLE lt_intern WITH KEY row = 4_row col = 4_col.
ASSIGN COMPONENT 4 OF STRUCTURE it_tab TO
IF sy-subrc <> 0.
EXIT.
ENDIF.
READ TABLE lt_intern WITH KEY row = 4_row col = 1. "分配功能位置
ASSIGN COMPONENT 1 OF STRUCTURE it_tab TO
IF sy-subrc <> 0.
EXIT.
ENDIF.
ASSIGN COMPONENT 2 OF STRUCTURE it_tab TO
SELECT SINGLE clint INTO l_clint FROM kssk WHERE objek =
SELECT SINGLE class INTO
MODIFY it_tab.
CLEAR it_tab.
4_col = 4_col + 1.
IF 4_col > l_col.
4_row = 4_row + 1.
4_col = 2.
ENDIF.
ENDLOOP.
***************************************************************
ENDIF.
SORT it_tab.
DELETE ADJACENT DUPLICATES FROM it_tab.
ENDFORM. " get_upload_data
*&---------------------------------------------------------------------*
*& Form process_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* *----------------------------------------------------------------------*
FORM process_data.
DATA lt_class LIKE TABLE OF it_tab WITH HEADER LINE.
DATA: l_object TYPE bapi1003_key-object,
lt_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
DATA: lt_value_num TYPE TABLE OF bapi1003_alloc_values_num WITH
HEADER LINE,
lt_value_char TYPE TABLE OF bapi1003_alloc_values_char WITH
HEADER LINE,
lt_value_curr TYPE TABLE OF bapi1003_alloc_values_curr WITH
HEADER LINE.
DATA: lt_value_num_temp TYPE TABLE OF bapi1003_alloc_values_num
WITH HEADER LINE,
lt_value_char_temp TYPE TABLE OF bapi1003_alloc_values_char
WITH HEADER LINE,
lt_value_curr_temp TYPE TABLE OF bapi1003_alloc_values_curr
WITH HEADER LINE.
PERFORM f_get_klart USING c_table_name
CHANGING g_klart.
LOOP AT it_tab.
AT NEW class.
CLEAR: lt_class, lt_class[].
ENDAT.
MOVE-CORRESPONDING it_tab TO lt_class.
APPEND lt_class.
CLEAR lt_class.
AT END OF class.
CLEAR: lt_value_num, lt_value_num[],
lt_value_num_temp, lt_value_num_temp[],
lt_value_char, lt_value_char[],
lt_value_char_temp, lt_value_char_temp[],
lt_value_curr, lt_value_curr[],
lt_value_curr_temp, lt_value_curr_temp[].
PERFORM f_set_characteristic_value TABLES lt_class
lt_value_num
lt_value_char
lt_value_curr.
WRITE it_tab-tplnr TO l_object.
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = l_object
objecttable = 'IFLOT'
classnum = it_tab-class
classtype = g_klart
TABLES
allocvaluesnum = lt_value_num_temp
allocvalueschar = lt_value_char_temp
allocvaluescurr = lt_value_curr_temp
return = lt_return.
LOOP AT lt_value_num_temp.
READ TABLE lt_value_num WITH KEY charact =
lt_value_num_temp-charact.
IF sy-subrc <> 0.
MOVE-CORRESPONDING lt_value_num_temp TO lt_value_num.
APPEND lt_value_num.
CLEAR lt_value_num.
ENDIF.
ENDLOOP.
LOOP AT lt_value_char_temp.
READ TABLE lt_value_char WITH KEY charact =
lt_value_char_temp-charact.
IF sy-subrc <> 0.
MOVE-CORRESPONDING lt_value_char_temp TO lt_value_char.
APPEND lt_value_char.
CLEAR lt_value_char.
ENDIF.
ENDLOOP.
LOOP AT lt_value_curr_temp.
READ TABLE lt_value_curr WITH KEY charact =
lt_value_curr_temp-charact.
IF sy-subrc <> 0.
MOVE-CORRESPONDING lt_value_curr_temp TO lt_value_curr.
APPEND lt_value_curr.
CLEAR lt_value_curr.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = l_object
objecttable = 'IFLOT'
classnum = it_tab-class
classtype = g_klart
TABLES
allocvaluesnumnew = lt_value_num
allocvaluescharnew = lt_value_char
allocvaluescurrnew = lt_value_curr
return = lt_return.
READ TABLE lt_return TRANSPORTING NO FIELDS
WITH KEY type = 'E'.
IF sy-subrc = 0.
ROLLBACK WORK.
LOOP AT lt_return WHERE type = 'E'.
MOVE-CORRESPONDING it_tab TO it_error.
it_error-atnam = space.
it_error-message = lt_return-message.
APPEND it_error.
CLEAR it_error.
ENDLOOP.
CLEAR: lt_return, lt_return[].
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
ENDAT.
ENDLOOP.
ENDFORM. " process_data
*&---------------------------------------------------------------------*
*& Form write_title
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* *----------------------------------------------------------------------*
FORM write_title.
WRITE:/(140) '功能位置特性值批次更新-BAPI' CENTERED COLOR 1.
SKIP.
IF NOT it_error[] IS INITIAL.
WRITE:/(18) '功能位置',
(15) '類別',
(15) '特性',
(90) 'Error log'.
WRITE:/(18) sy-uline , (15) sy-uline, (15) sy-uline, (90) sy-uline.
ENDIF.
ENDFORM. " write_title
*&---------------------------------------------------------------------*
*& Form write_error_report
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* *----------------------------------------------------------------------*
FORM write_error_report.
IF it_error[] IS INITIAL.
SKIP 8.
WRITE:/(140) '資料更新成功!' CENTERED COLOR 4.
ELSE.
LOOP AT it_error.
WRITE:/(18) it_error-tplnr,
(15) it_error-class,
(15) it_error-atnam,
(90) it_error-message.
ENDLOOP.
ENDIF.
ENDFORM. " write_error_report
*&---------------------------------------------------------------------*
*& Form f_set_characteristic_value
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PI_CSV_DATA text
* -->PI_VALUE_NUM text
* -->PI_VALUE_CHAR text
* -->PI_VALUE_CURR text
*----------------------------------------------------------------------*
FORM f_set_characteristic_value
TABLES pi_csv_data TYPE typ_t_csv_data
pi_value_num STRUCTURE bapi1003_alloc_values_num
pi_value_char STRUCTURE bapi1003_alloc_values_char
pi_value_curr STRUCTURE bapi1003_alloc_values_curr.
DATA: l_wa_csv_data LIKE LINE OF pi_csv_data.
DATA: l_wa_value_num LIKE LINE OF pi_value_num,
l_wa_value_char LIKE LINE OF pi_value_char,
l_wa_value_curr LIKE LINE OF pi_value_curr.
DATA: l_wa_characteristic TYPE ctcv_01.
DATA: l_i_value TYPE TABLE OF strg,
l_wa_value LIKE LINE OF l_i_value.
LOOP AT pi_csv_data INTO l_wa_csv_data
WHERE NOT atwrt IS initial.
* 取得特性屬性
PERFORM f_get_characteristic USING l_wa_csv_data-atnam
CHANGING l_wa_characteristic.
** 檢查屬性值字串
PERFORM f_parse_characteristic_value TABLES l_i_value
USING l_wa_characteristic
l_wa_csv_data-atwrt.
CASE l_wa_characteristic-atfor.
WHEN c_characteristic_format_number
OR c_characteristic_format_date
OR c_characteristic_format_time.
LOOP AT l_i_value INTO l_wa_value.
CLEAR l_wa_value_num.
l_wa_value_num-charact = l_wa_characteristic-atnam.
l_wa_value_num-value_from = l_wa_value-atflv.
l_wa_value_num-value_to = l_wa_value-atflb.
l_wa_value_num-value_relation = l_wa_value-atcod.
APPEND l_wa_value_num TO pi_value_num.
ENDLOOP.
WHEN c_characteristic_format_char
OR c_characteristic_format_bool.
CLEAR l_wa_value_char.
LOOP AT l_i_value INTO l_wa_value.
l_wa_value_char-charact = l_wa_characteristic-atnam.
l_wa_value_char-value_char = l_wa_value-atwrt.
l_wa_value_num-value_relation = l_wa_value-atcod.
APPEND l_wa_value_char TO pi_value_char.
ENDLOOP.
WHEN c_characteristic_format_curr.
CLEAR l_wa_value_curr.
LOOP AT l_i_value INTO l_wa_value.
l_wa_value_curr-charact = l_wa_characteristic-atnam.
l_wa_value_num-value_from = l_wa_value-atflv.
l_wa_value_num-value_to = l_wa_value-atflb.
l_wa_value_num-value_relation = l_wa_value-atcod.
APPEND l_wa_value_curr TO pi_value_curr.
ENDLOOP.
ENDCASE.
ENDLOOP.
ENDFORM. " f_set_characteristic_value
*&---------------------------------------------------------------------*
*& Form f_get_characteristic
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PV_ATNAM text
* *----------------------------------------------------------------------*
FORM f_get_characteristic USING pv_atnam
CHANGING pv_characteristic TYPE ctcv_01.
DATA: l_charact TYPE cabn-atnam,
l_wa_cabn TYPE cabn,
l_i_cabnt TYPE STANDARD TABLE OF cabnt,
l_wa_cabnt LIKE LINE OF l_i_cabnt.
CLEAR pv_characteristic.
l_charact = pv_atnam.
CALL FUNCTION 'CTAP_CHARACT_READ_COMPLETE'
EXPORTING
charact = l_charact
f_with_description = 'X'
IMPORTING
s_cabn = l_wa_cabn
TABLES
e_cabnt = l_i_cabnt
EXCEPTIONS
charact_not_found = 1
OTHERS = 2.
CASE sy-subrc.
WHEN 0.
pv_characteristic-atnam = l_wa_cabn-atnam.
READ TABLE l_i_cabnt INTO l_wa_cabnt INDEX 1.
IF sy-subrc = 0.
pv_characteristic-atbez = l_wa_cabnt-atbez.
ENDIF.
pv_characteristic-atfor = l_wa_cabn-atfor.
pv_characteristic-anzst = l_wa_cabn-anzst.
pv_characteristic-anzdz = l_wa_cabn-anzdz.
pv_characteristic-atvor = l_wa_cabn-atvor.
pv_characteristic-atsch = l_wa_cabn-atsch.
pv_characteristic-msehi = l_wa_cabn-msehi.
pv_characteristic-atdex = l_wa_cabn-atdex.
pv_characteristic-atdim = l_wa_cabn-atdim.
pv_characteristic-atkle = l_wa_cabn-atkle.
pv_characteristic-atein = l_wa_cabn-atein.
pv_characteristic-atint = l_wa_cabn-atint.
ENDCASE.
ENDFORM. " f_get_characteristic
*&---------------------------------------------------------------------*
*& Form f_parse_characteristic_value
*&---------------------------------------------------------------------*
* 檢查屬性值字串
*----------------------------------------------------------------------*
* -->PI_STRG text
* -->PWA_CABN text
* -->PV_ATWRT text
*----------------------------------------------------------------------*
FORM f_parse_characteristic_value TABLES pi_strg STRUCTURE strg
USING pwa_ctcv TYPE ctcv_01
pv_atwrt.
DATA: l_i_attribute TYPE TABLE OF ctcv_01,
l_wa_attribute LIKE LINE OF l_i_attribute.
MOVE-CORRESPONDING pwa_ctcv TO l_wa_attribute.
APPEND l_wa_attribute TO l_i_attribute.
* 準備檢查屬性值
CALL FUNCTION 'CTCV_PREPARE_SYNTAX_CHECK'
TABLES
attributes_of_characteristics = l_i_attribute.
* 檢查屬性值
CLEAR pi_strg[].
CALL FUNCTION 'CTCV_VALUE_SYNTAX_CHECK'
EXPORTING
characteristic = pwa_ctcv-atnam
string = pv_atwrt
classtype = g_klart
TABLES
tstrg = pi_strg
EXCEPTIONS
characteristic_not_prepared = 1
currency_check = 2
date_check = 3
format_check = 4
illegal_internal_baseunit = 5
interval_check = 6
pattern_check = 7
time_check = 8
unit_check = 9
no_valid_dimension = 10
interval_not_allowed = 11
OTHERS = 12.
ENDFORM. " f_parse_characteristic_value
*&---------------------------------------------------------------------*
*& Form f_get_klart
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PV_TABNAME text
* *----------------------------------------------------------------------*
FORM f_get_klart USING pv_tabname
CHANGING pv_klart.
DATA: l_tabname TYPE tclt-obtab.
DATA: l_i_iklart TYPE STANDARD TABLE OF rmclklart,
l_wa_iklart LIKE LINE OF l_i_iklart.
CLEAR pv_klart.
l_tabname = pv_tabname.
CALL FUNCTION 'CLCA_GET_CLASSTYPES_FROM_TABLE'
EXPORTING
table = l_tabname
with_text = 'X'
TABLES
iklart = l_i_iklart
EXCEPTIONS
no_classtype_found = 1
OTHERS = 2.
CASE sy-subrc.
WHEN 0.
READ TABLE l_i_iklart INTO l_wa_iklart
WITH KEY stand = 'X'.
IF sy-subrc = 0.
pv_klart = l_wa_iklart-klart.
ENDIF.
ENDCASE.
ENDFORM. " f_get_klart
*& End
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90072/viewspace-1007345/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql 批次更新與批次更新多條記錄的不同值實現方法MySql
- mybatis批次更新MyBatis
- SAP 物料主分類檢視維護的批次分類特性值不能在批次裡被覆蓋
- oracle 批次更新、批次刪除的匿名塊Oracle
- 資料庫-批次更新資料庫
- mysql 的常用批次更新MySql
- Oracle -- 批次更新sequence的儲存Oracle
- oracle批次更新解決辦法Oracle
- 批次給控制元件賦值控制元件賦值
- ORACLE批次更新四種方法比較Oracle
- Oracle 臨時表 OracleDataAdapter 批次更新OracleAPT
- pl/sql功能特性SQL
- Promise的值穿透特性Promise穿透
- 199IT小程式近日更新功能
- Swift5.0新特性更新Swift
- [譯]按功能(特性)分包
- Java 7:最新特性更新、程式碼示例及效能測試(轉)Java
- 使用反射為特性賦值反射賦值
- 批次殺程式指令碼指令碼
- MySQL 8.0新特性更新介紹MySql
- iOS後臺模式藉助位置更新實現iOS模式
- PostgreSQLjson任意位置append功能實現SQLJSONAPP
- 企業招聘小程式開發的功能和價值
- JDK1.8新特性值OptionalJDK
- laravel 批次插入並在遇到重複鍵時更新Laravel
- 【新特性速遞】指定提示資訊的顯示位置(ToolTipPosition)
- const特性總結(不斷更新)
- 如何更新Mac電腦截圖的儲存位置?Mac
- eas_批次更新組織長編碼,長名稱
- swift語言新特性:可選值Swift
- PostgreSQLNULL值相對位置與QUERY優化-nullsfirstlast,ascdescSQLNull優化AST
- chitika:搜尋引擎排名位置的價值
- Mybatis如何動態生成插入的列及批次插入值MyBatis
- 能否將TopThink每次的程式碼或功能更新公佈出來?
- 基於vue-cli3 SSR 程式實現熱更新功能Vue
- ctwr程式特性
- 使用awk批次殺程式的命令
- 特性更新!DistSQL 叢集治理能力詳解SQL