Function宝典
函數名 描述
CONVERSION_EXIT_ALPHA_INPUT 料號前面補0
CONVERSION_EXIT_ALPHA_OUTPUT 料號前面減0
CONVERSION_EXIT_MATN1_INPUT 料號前面補0
CONVERSION_EXIT_MATN1_OUTPUT 料號前面減0
LAST_DAY_OF_MONTHS 查詢某日期的在當月的最后一天
CO_SF_CAUFVD_GET 根據工單號查詢訂單抬頭和項目
SO_NEW_DOCUMENT_ATT_SEND_API1 外發郵件
VIEW_MAINTENANCE_CALL 調用數據表的維護視圖
SO_OBJECT_SEND 外發郵件
函數名
CONVERSION_EXIT_ALPHA_INPUT
功能:料號前面補0,
實例:
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' "料號前面加0”
EXPORTING
input = matnr_in
IMPORTING
output = matnr_out.
說明:1)數字料號入Table需要補0,不會自動產生,有字母料號卻會自動補0.
2)只能用’字符型’
CONVERSION_EXIT_MATN1_INPUT
功能:料號前面補0
實例:
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT' "料號前面補0”
EXPORTING
input = matnr_in
IMPORTING
output = matnr_out
EXCEPTIONS
length_error = 1
OTHERS = 2.
說明: 1)數字料號入Table需要補0,不會自動產生,有字母料號卻會自動補0.
2)只能用于料號轉換
CONVERSION_EXIT_ALPHA_OUTPUT
功能:料號前面去0
實例:
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' "料號前面去0.
EXPORTING
input = wa_ysy1-matnr
IMPORTING
output = wa_ysy1-matnr.
說明:
CONVERSION_EXIT_MATN1_OUTPUT
功能:料號前面去0
實例:
CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
EXPORTING
input = t_afpo-matnr
IMPORTING
output = t_afpo-matnr
EXCEPTIONS
OTHERS = 1.
說明:
LAST_DAY_OF_MONTHS
功能:查詢某日期的在當月的最后一天
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
day_in = f_date "月任意一天 類型必須為D(要完成日期##
IMPORTING
last_day_of_month = p_date "月最后一天 類型必須為D(完整日期)
EXCEPTIONS
day_in_no_date = 1
OTHERS = 2.
說明:
CO_SF_CAUFVD_GET
功能: 根據工單號查詢訂單抬頭和項目
實例:
DATA: wa_caufvd TYPE caufvd.
CALL FUNCTION 'CO_SF_CAUFVD_GET'"取得訂單抬頭和項目
EXPORTING
aufnr_imp = aufnr
IMPORTING
caufvd_exp = wa_caufvd “訂單抬頭和項目結構
EXCEPTIONS
not_found = 1
OTHERS = 2.
說明:
SO_NEW_DOCUMENT_ATT_SEND_API1
功能:郵件發送 SAPoffice: Send new document with attachments using RFC
實例:
FORM email_itab. “郵件內容“
WRITE: '編號' TO email_itab-line+0(3), "255個長度的文本字段:文本"
'記帳日期' TO email_itab-line+3(10),
ENDFORM. "email_itab
FORM reset_objpack .
it_packing_list-transf_bin = space. "標記將以二進制形式傳輸對象的標志"
it_packing_list-head_start = 0."表頭開始行"
it_packing_list-head_num = 1. "表頭行數"
it_packing_list-body_start = 1."內容開始行"
it_packing_list-body_num = it_message_lines. "內容行數"
it_packing_list-doc_type = 'RAW'. "信息類型"
APPEND it_packing_list.
ENDFORM. "reset_objpack
FORM reset_doc_chng .
DESCRIBE TABLE email_itab LINES it_message_lines.
gd_doc_data-doc_size = it_message_lines * 255 + STRLEN( email_itab ). "SAPoffice 文檔的大小 "
gd_doc_data-obj_langu = sy-langu. "創建文檔使用的語言"
gd_doc_data-obj_name = 'SAPRPT'. "文檔,文件夾或分配清單的名稱"
gd_doc_data-obj_descr = '郵件標題'. "Email標題"
gd_doc_data-sensitivty = 'F'. "對象:靈敏度(個人的,功能的,...) F:功能"
ENDFORM. "reset_doc_chng
FORM reset_reclist .
SELECT zmaaddr
INTO it_receivers-receiver
FROM ziebtemail.
it_receivers-rec_type = 'U'. "互聯網地址
APPEND it_receivers.
CLEAR it_receivers.
ENDSELECT.
ENDFORM. "reset_reclist
DATA: gd_doc_data LIKE sodocchgi1,
gd_sent_all(1) TYPE c,
it_message_lines TYPE sy-tabix,
it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF email_itab OCCURS 10.
INCLUDE STRUCTURE soli.
DATA: END OF email_itab.
PERFORM email_itab. "TABLES OUTPUT_TAB.
PERFORM reset_doc_chng.
PERFORM reset_reclist.
PERFORM reset_objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data “新文檔的屬性”
PUT_IN_OUTBOX = 'X' “標志:發送后將文檔移到outbox
* COMMIT_WORK = ' '
* IMPORTING
SENT_TO_ALL = gd_sent_all “Flag: Document sent to all”
* NEW_OBJECT_ID = ID of created object (not document!)
tables
packing_list = it_packing_list “SAPoffice:輸入對象組件描述”
* OBJECT_HEADER =
* CONTENTS_BIN =
* CONTENTS_TXT =
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = email_itab”SAPoffice:API 收件人清單的結構”
* EXCEPTIONS
* TOO_MANY_RECEIVERS = 1
* DOCUMENT_NOT_SENT = 2
* DOCUMENT_TYPE_NOT_EXIST = 3
* OPERATION_NO_AUTHORIZATION = 4
* PARAMETER_ERROR = 5
* X_ERROR = 6
* ENQUEUE_ERROR = 7
* OTHERS = 8
.
IF sy-subrc <>0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
說明:
VIEW_MAINTENANCE_CALL
功能:調用數據表的維護視圖
實例:
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action = 'U' “活動(顯示/維護/傳輸)”
* CORR_NUMBER = ' '
* GENERATE_MAINT_TOOL_IF_MISSING = ' '
* SHOW_SELECTION_POPUP = ' '
view_name = 'ZIEBTEMAIL' “要處理的視圖/表格的名稱”
* NO_WARNING_FOR_CLIENTINDEP = ' '
* RFC_DESTINATION_FOR_UPGRADE = ' '
* CLIENT_FOR_UPGRADE = ' '
* VARIANT_FOR_SELECTION = ' '
* COMPLEX_SELCONDS_USED = ' '
* CHECK_DDIC_MAINFLAG = ' '
* SUPPRESS_WA_POPUP = ' '
* TABLES
* DBA_SELLIST =
* EXCL_CUA_FUNCT =
* EXCEPTIONS
* CLIENT_REFERENCE = 1
* FOREIGN_LOCK = 2
* INVALID_ACTION = 3
* NO_CLIENTINDEPENDENT_AUTH = 4
* NO_DATABASE_FUNCTION = 5
* NO_EDITOR_FUNCTION = 6
* NO_SHOW_AUTH = 7
* NO_TVDIR_ENTRY = 8
* NO_UPD_AUTH = 9
* ONLY_SHOW_ALLOWED = 10
* SYSTEM_FAILURE = 11
* UNKNOWN_FIELD_IN_DBA_SELLIST = 12
* VIEW_NOT_FOUND = 13
* MAINTENANCE_PROHIBITED = 14
* OTHERS = 15
.
IF sy-subrc <>0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
說明:
SO_OBJECT_SEND
功能:外發郵件
實例:
REPORT ztmail02 .
DATA: BEGIN OF itab OCCURS 0,
pernr LIKE pa0001-pernr,
ename LIKE pa0001-ename,
END OF itab.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli occurs 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1 occurs 100 WITH HEADER LINE,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT pernr ename
INTO CORRESPONDING FIELDS OF TABLE itab
FROM pa0001
WHERE pernr <50.
LOOP AT itab.
WRITE: /02 sy-vline, itab-pernr, 15 sy-vline, itab-ename, 50
sy-vline.
ENDLOOP.
*receivers
receiver_list-recextnam = 'eric.guh@sina.com'. “直接外部地址作為接收方”
receiver_list-recesc = ‘U’. “收件人類型的說明; U 互聯網地址”
receiver_list-sndart = ‘MAIL'. “輸出設備; MAIL 郵件”
receiver_list-sndpri = '1'. “發送:優先級; 1 最高優先權”
APPEND receiver_list.
*general data
w_object_hd_change-objla = sy-langu. “創建文檔使用的語言”
w_object_hd_change-objnam = 'Object name'. “文檔,文件夾或分配清單的名稱”
w_object_hd_change-objsns = 'F'. “對象:靈敏度(個人的,功能的,...)” F: 功能
w_object_hd_change -OBJDES = ‘Message subject’. “Mail的標題”
APPEND w_object_hd_change.
*content
message_content-line = 'Message content'. “發送的內容”
APPEND message_content.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change “通常頭數據”
object_type = 'RAW' “對象類型”
OUTBOX_FLAG = 'X' “標志:發送后將文檔移到outbox
owner = sy-uname “負責傳送的用戶”
TABLES
objcont = message_content “發送的內容”
receivers = receiver_list “接收對象屬性”
att_cont = compressed_attachment.
---------------------------------------------------------------------------------------------
函數名 ???????????????????????????????????????????????????? 描述 ????????????????????????
????SD_VBAP_READ_WITH_VBELN???????????? 根據銷售訂單讀取表 vbap 中的信息
????EDIT_LINES???????????????????????????????????????????? 把 READ_TEXT 返回的 LINES 中的行按照 TDFORMAT=“*” 重新組織
????VIEW_MAINTENANCE_CALL?????????????????? 維護表視圖
???? 函數名 ???????????????????????????????? 描述 ????????????????????????
DY_GET_FOCUS???????????????? 獲得屏幕焦點
DY_GET_SET_FIELD_VALUE???? 獲得或者設置屏幕字段的值
???? 函數名 ?????????????????????????????????????????????????????????? 描述 ????????????????????????
????F4IF_INT_TABLE_VALUE_REQUEST?????????? 顯示檢索 help
????READ_TEXT?????????????????????????????????????????????????? 讀取長文本
????CONVERSION_EXIT_CUNIT_OUTPUT?????????? 單位轉換
????SJIS_DBC_TO_SBC?????????????????????????????????????? 全角轉半角
????SJIS_SBC_TO_DBC?????????????????????????????????????? 半角轉換為全角
????CO_R0_CHECK_DECIMAL_POINT?????????????? 根據單位檢查數據的小數位
????POSTAL_CODE_CHECK?????????????????????? 檢查郵政編碼
?
???? 函數名 ?????????????????????????????????????? 描述 ????????????????????????
????CONVERSION_EXIT_ALPHA_INPUT?????????? 全數字則在前面補 0
????CONVERSION_EXIT_ALPHA_INPUT?????????? 和上面相反
????GET_JOB_RUNTIME_INFO?????????????????? 獲得 job 相關信息
????TERMINAL_ID_GET?????????????????????? 獲得端末 id
????DATE_CONVERT_TO_FACTORYDATE?????????? 把輸入日期轉為工廠日歷日期
????MESSAGE_TEXT_BUILD???????????????????? 把消息轉為文本
?
???? 函數名 ?????????????????????????????????????? 描述 ????????????????????????
????POPUP_TO_CONFIRM?????????????????????? 彈出確認窗口
?
???? 函數名 ?????????????????????????????????????? 描述 ????????????????????????
????CONVERSION_EXIT_MATN1_INPUT???????????????? 物料號碼轉換函數
????CONVERSION_EXIT_MATN1_OUTPUT???????????????? 同上相反
????CONVERT_TO_LOCAL_CURRENCY?????????????????? 按照指定日期匯率轉換金額為指定貨幣類型
????SSF_FUNCTION_MODULE_NAME???????????????????? 根據 form 名取得對應的函數名 (SmartForm)????
?
???? 函數名 ?????????????????????????????????????? 描述 ????????????????????????
????DATE_CHECK_PLAUSIBILITY???????????????? 日期 CHECK
????cl_gui_frontend_services=>gui_upload?? 上傳到服務器
????cl_gui_frontend_services=>gui_download?????? 下載到服本地
????SSF_FUNCTION_MODULE_NAME????SMARTFORMS 輸出報表時,生成一個函數名稱,然后 CALL 這個名稱
?
???? 函數名 ?????????????????????????????????????? 描述 ????????????????????????
????POPUP_TO_DECIDE_LIST???????????????? 彈出供選擇窗口 ??
?
?
1.function : SD_VBAP_READ_WITH_VBELN
?? 功能:根據銷售訂單讀取表 vbap 中的信息
?? 參數:
??????import : I_VBELN???????????????????????????? 訂單號(必輸項)
?????????????????? I_BYPASSING_BUFFER???? 是否回避 buffer
?????????????????? I_REFRESH_BUFFER???????? 是否清空 buffer
???? tables : ET_VBAPVB???????????????????????? 不清楚其意義
??????????????????ET_VBAP????????????????????????????vbap 表
2.form : EDIT_LINES
?? 功能:把 READ_TEXT 返回的 LINES 中的行按照 TDFORMAT=“*” 重新組織
?? 原因:如果用 CREATE_TEXT 登錄的長文本不存在該問題,如果是在前臺業務登錄的 text ,那么存到數據庫的時候會在 72 位的地方換行,在 lines 這個表中的 TDFORMAT 設置為空,導致 READ_TEXT 返回的表中的行數也許不是你需要的行數。
?? 代碼:
FORM EDIT_LINES TABLES P_IT_LINES STRUCTURE TLINE.
??DATA:
????L_IT_LINES TYPE STANDARD TABLE OF TLINE,
????L_WA_LINES TYPE TLINE,
????L_WA_LINE1 TYPE TLINE,
????L_LINE TYPE I.
??DATA:
????L_INDEX TYPE I,
????L_I???? TYPE I.
??READ TABLE P_IT_LINES TRANSPORTING NO FIELDS
????WITH KEY TDFORMAT = SPACE.
??CHECK SY-SUBRC = 0.
??L_LINE = LINES( P_IT_LINES ).
??CHECK L_LINE > 1.
??L_IT_LINES[] = P_IT_LINES[].
??CLEAR: P_IT_LINES[].
??L_INDEX = 2.
??DO.
????CLEAR: L_WA_LINES.
????READ TABLE L_IT_LINES INTO L_WA_LINES INDEX L_INDEX.
????IF SY-SUBRC <> 0.
??????L_I = L_INDEX - 1.
??????READ TABLE L_IT_LINES INTO L_WA_LINES INDEX L_I.
??????IF SY-SUBRC = 0 .
????????APPEND L_WA_LINES TO P_IT_LINES.
??????ENDIF.
??????EXIT.
????ENDIF.
????IF L_WA_LINES-TDFORMAT = '*'.
??????L_I = L_INDEX - 1.
??????CLEAR L_WA_LINE1.
??????READ TABLE L_IT_LINES INTO L_WA_LINE1 INDEX L_I.
??????APPEND L_WA_LINE1 TO P_IT_LINES.
??????L_INDEX = L_I + 2.
????ELSE.
??????L_I = L_INDEX - 1.
??????READ TABLE L_IT_LINES INTO L_WA_LINE1 INDEX L_I.
??????CONCATENATE L_WA_LINE1-TDLINE L_WA_LINES-TDLINE
???????????? INTO L_WA_LINE1-TDLINE.
??????APPEND L_WA_LINE1 TO P_IT_LINES.
??????L_INDEX = L_INDEX + 2.
????ENDIF.
??ENDDO.
ENDFORM.????????????????????" S4110_EDIT_LINES
3.function:VIEW_MAINTENANCE_CALL
?? 功能:維護表視圖等
????????The function module calls the extended table maintenance (View maintenance).
?? 參數:
????import : ACTION?????? S = Display U = Change T = Transport
????????????CORR_NUMBER?? 傳送號(上面的 action 是 t )
????????????SHOW_SELECTION_POPUP?? 是否彈出選擇畫面
????????????VIEW_NAME???? 視圖名
????????????NO_WARNING_FOR_CLIENTINDEP?? 跨集團是否現實警告
????????????VARIANT_FOR_SELECTION?? 變式名
????????????CHECK_DDIC_MAINFLAG???? 察看是否為可維護對象
補充: VIEW_MAINTENANCE_CALL
例子:
??CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
????EXPORTING
??????ACTION?????????????????????? = 'U'??????????" 更新
??????SHOW_SELECTION_POPUP???????? = 'X'??????????" 顯示選擇畫面
??????VIEW_NAME????????????????????= 'ZPPT000020' " 表名
??????NO_WARNING_FOR_CLIENTINDEP?? = ' '??????????" 不顯示警告
????EXCEPTIONS
??????CLIENT_REFERENCE???????????? = 1
??????FOREIGN_LOCK???????????????? = 2
??????INVALID_ACTION?????????????? = 3
??????NO_CLIENTINDEPENDENT_AUTH????= 4
??????NO_DATABASE_FUNCTION???????? = 5
??????NO_EDITOR_FUNCTION?????????? = 6
??????NO_SHOW_AUTH???????????????? = 7
??????NO_TVDIR_ENTRY?????????????? = 8
??????NO_UPD_AUTH??????????????????= 9
??????ONLY_SHOW_ALLOWED????????????= 10
??????SYSTEM_FAILURE?????????????? = 11
??????UNKNOWN_FIELD_IN_DBA_SELLIST = 12
??????VIEW_NOT_FOUND?????????????? = 13
??????MAINTENANCE_PROHIBITED?????? = 14
??????OTHERS?????????????????????? = 15.
效果:
每天函數講解系列 ----2006.01.10
?
1.SYSTEM-CALL:DY_GET_FOCUS
?? 說明:獲得屏幕焦點
?? 參數:
??????????ID 'SSCREENNAM' FIELD CURRSUBSCREEN
??????????ID 'SSCREENNBR' FIELD CURRSUBSCREENNO
??????????ID 'MSCREENNAM' FIELD CURRSCREEN
??????????ID 'MSCREENNBR' FIELD CURRSCREENNO
??????????ID 'FIELDNAME' FIELD CURSOR_FIELD
??????????ID 'FIELDOFFS' FIELD DUMMYOFFS
??????????ID 'LINE' FIELD CURSOR_LINE.
2.SYSTEM-CALL:DY_GET_SET_FIELD_VALUE
?? 說明:獲得或者設置屏幕字段的值
?? 參數:
??????ID 'GET_SET'????FIELD 'S'????"S:Set mode??G:Get mode
??????ID 'SSCREENNAM' FIELD SHSUBSCREEN
??????ID 'SSCREENNBR' FIELD SHSUBSCREENNO
??????ID 'MSCREENNAM' FIELD SHSCREEN
??????ID 'MSCREENNBR' FIELD SHSCREENNO
??????ID 'FIELDNAME' FIELD DYNP_EXPORT
??????ID 'LINE' FIELD DYNP_EXSTEPL
??????ID 'VALUE' FIELD DYNP_EXPVAL.
例子:我做了一個檢索 help 的 exit ,例如屏幕上有兩個字段,我按了一個字段的檢索 help ,那么根據這個字段就會取得相應的另外一個字段的值,然后把這個之設置到第二個字段。
FUNCTION ZTEST_F4.
*"----------------------------------------------------------------------
*"*"Local interface:
*"??TABLES
*"??????SHLP_TAB TYPE??SHLP_DESCT
*"??????RECORD_TAB STRUCTURE??SEAHLPRES
*"??CHANGING
*"???? REFERENCE(SHLP) TYPE??SHLP_DESCR
*"???? REFERENCE(CALLCONTROL) LIKE??DDSHF4CTRL STRUCTURE??DDSHF4CTRL
*"----------------------------------------------------------------------
* Local data definition
??DATA: L_ZZOINO(3) TYPE C.
??DATA: L_ZZPOSID(10) TYPE C.
??DATA: DYNP_EXPORT(132), DYNP_EXPVAL(132).
??DATA: DYNP_EXSTEPL TYPE I, OK, DUMMYCHAR.
??DATA: DUMMYOFFS TYPE I.
??DATA: SHSUBSCREEN LIKE HELP_INFO-DYNPPROG,
????????SHSUBSCREENNO LIKE HELP_INFO-DYNPRO,
????????SHSCREEN LIKE HELP_INFO-DYNPPROG,
????????SHSCREENNO LIKE HELP_INFO-DYNPRO.
??DATA: CURRSUBSCREEN LIKE HELP_INFO-DYNPPROG,
????????CURRSUBSCREENNO LIKE HELP_INFO-DYNPRO,
????????CURRSCREEN LIKE HELP_INFO-DYNPPROG,
????????CURRSCREENNO LIKE HELP_INFO-DYNPRO.
??DATA: CURSOR_FIELD LIKE DYNPREAD-FIELDNAME, CURSOR_LINE TYPE I.
??DATA: SETCURSOR_AVAILABLE TYPE I.
* Get record value from record table
??READ TABLE RECORD_TAB INDEX 1.
??L_ZZPOSID = RECORD_TAB+0(10).
??IF SHLP_TAB-INTDESCR-HOTKEY IS INITIAL.
????L_ZZOINO = RECORD_TAB+10(3).
??ENDIF.
* Check command, if return, set screen
??IF CALLCONTROL-STEP = 'RETTOP'.
*?? Initialize screen, get screen focus
????CALL 'DY_GET_FOCUS'
??????????ID 'SSCREENNAM' FIELD CURRSUBSCREEN
??????????ID 'SSCREENNBR' FIELD CURRSUBSCREENNO
??????????ID 'MSCREENNAM' FIELD CURRSCREEN
??????????ID 'MSCREENNBR' FIELD CURRSCREENNO
??????????ID 'FIELDNAME' FIELD CURSOR_FIELD
??????????ID 'FIELDOFFS' FIELD DUMMYOFFS
??????????ID 'LINE' FIELD CURSOR_LINE.
*?? Set screen parameter
????GET PARAMETER ID 'RID' FIELD SHSUBSCREEN .
????SHSCREEN = SHSUBSCREEN.
????GET PARAMETER ID 'DYN' FIELD SHSUBSCREENNO.
????SHSCREENNO = SHSUBSCREENNO.
????DYNP_EXPORT?? ='V_WA_DYNPRO_9000-ZZOINO'.
????DYNP_EXPVAL?? = L_ZZOINO.
*?? System call for set screen
????CALL 'DY_GET_SET_FIELD_VALUE'
??????ID 'GET_SET'????FIELD 'S'????"Set mode
??????ID 'SSCREENNAM' FIELD SHSUBSCREEN
??????ID 'SSCREENNBR' FIELD SHSUBSCREENNO
??????ID 'MSCREENNAM' FIELD SHSCREEN
??????ID 'MSCREENNBR' FIELD SHSCREENNO
??????ID 'FIELDNAME' FIELD DYNP_EXPORT
??????ID 'LINE' FIELD DYNP_EXSTEPL
??????ID 'VALUE' FIELD DYNP_EXPVAL.
*?? System call for set screen
????DYNP_EXPORT?? ='V_WA_DYNPRO_9000-ZZPOSID'.
????DYNP_EXPVAL?? = L_ZZPOSID.
????CALL 'DY_GET_SET_FIELD_VALUE'
??????ID 'GET_SET'????FIELD 'S'????"Set mode
??????ID 'SSCREENNAM' FIELD SHSUBSCREEN
??????ID 'SSCREENNBR' FIELD SHSUBSCREENNO
??????ID 'MSCREENNAM' FIELD SHSCREEN
??????ID 'MSCREENNBR' FIELD SHSCREENNO
??????ID 'FIELDNAME' FIELD DYNP_EXPORT
??????ID 'LINE' FIELD DYNP_EXSTEPL
??????ID 'VALUE' FIELD DYNP_EXPVAL.
??ENDIF.
ENDFUNCTION.
?
每天函數講解系列 ----2006.01.11
Function:F4IF_INT_TABLE_VALUE_REQUEST
?? 功能:顯示檢索 help
?? 參數:
???? Import :
????????DDIC_STRUCTURE :返回 table 的結構:
??????????‘s’ : VALUE_TAB 的結構
??????????‘c’ : VALUE_TAB 只有一個字段
????????RETFIELD :返回的字段名稱 ------------ 必輸
????????DYNPPROG :當前程序
????????DYNPNR : ?? 屏幕號
????????DYNPROFIELD :屏幕上需要檢索 help 的字段名稱
????????WINDOW_TITLE :檢索 help 的標題
????????VALUE_ORG :檢索 help 屏幕顯示屬性:
????????‘c’ : cell by cell
????????‘s’ : structured
????????CALLBACK_PROGRAM :在 f4 之前調用的程序
????????CALLBACK_FORM :在 f4 之前調用的程序里面的 form 名稱,形式如下
?????????? FORM <NAME> TABLES RECORD_TAB STRUCTURE SEAHLPRES
????????????????????CHANGING SHLP TYPE SHLP_DESCR
??????????????????????????????CALLCONTROL LIKE DDSHF4CTRL.
???? Export :
????????USER_RESET :如果沒有選擇(按紅 x ),返回 ‘x’
???? Tables :
????????VALUE_TAB :傳進去的表 ----------- 必輸
????????FIELD_TAB : Fields of the hit list (暫時沒用)
????????RETURN_TAB :返回值表,即如果選擇了而沒有寫到屏幕上的值存在這個表中。
????????DYNPFLD_MAPPING :把屏幕上需要 help 的字段可以放在這個表中。
?????????? 推測:如果屏幕上有多個字段關聯,那么只作一個 help 的話,這個應該可以滿足。
例子:
FORM A3000_SET_F4_FIELD_WERKS USING P_FIELD.
TYPES:
??BEGIN OF T_S_WERKS,
????WERKS TYPE T001W-WERKS,?? " プラント
????NAME1 TYPE T001W-NAME1,?? " 名稱
????NAME2 TYPE T001W-NAME2,?? " 名稱 2
????STRAS TYPE T001W-STRAS,?? " 地名 / 番地 - 號
????ORT01 TYPE T001W-ORT01,?? " 市區町村名
??END OF T_S_WERKS.
TYPES??T_I_WERKS TYPE STANDARD TABLE OF T_S_WERKS.
* 這個就是 value_tab
DATA?? L_IT_WERKS TYPE T_I_WERKS.
* 取數據
??SELECT WERKS????" プラント
???????? NAME1????" 名稱
???????? NAME2????" 名稱 2
???????? STRAS????" 地名 / 番地 - 號
???????? ORT01????" 市區町村名
????FROM T001W
????INTO CORRESPONDING FIELDS OF TABLE L_IT_WERKS.
* 調用函數
??CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
????EXPORTING
??????RETFIELD?????????????? = 'WERKS'????“plant
??????DYNPPROG?????????????? = SY-REPID?? “ 程序名
??????DYNPNR???????????????? = SY-DYNNR?? “ 屏幕號
??????DYNPROFIELD????????????= P_FIELD????“ 字段名稱
??????VALUE_ORG??????????????= 'S'????????“ 顯示屬性: cell by cell
????TABLES
??????VALUE_TAB??????????????= L_IT_WERKS
????EXCEPTIONS
??????PARAMETER_ERROR????????= 1
??????NO_VALUES_FOUND????????= 2
??????OTHERS???????????????? = 3
????????????.
??IF SY-SUBRC <> 0.
???? MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
???????????? WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
??ENDIF.
ENDFORM.????????????????????" A3000_SET_F4_FIELD_WERKS
程序:
REPORT?ZF4IF_INT_TABLE_VALUE_REQUEST?????????????????????????????????? .
TYPES:
?BEGIN OF T_S_WERKS,
??? WERKS TYPE T001W-WERKS,?? "
??? NAME1 TYPE T001W-NAME1,?? "
??? NAME2 TYPE T001W-NAME2,?? "2
??? STRAS TYPE T001W-STRAS,?? "/-
??? ORT01 TYPE T001W-ORT01,?? "
?END OF T_S_WERKS.
TYPES?T_I_WERKS TYPE STANDARD TABLE OF T_S_WERKS.
*value_tab
DATA?? L_IT_WERKS TYPE T_I_WERKS.
PARAMETERS: P_WERKS(4) TYPE C.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WERKS.
*AT SELECTION-SCREEN ON HELP-REQUEST FOR .
*
?SELECT WERKS??? "
???????? NAME1??? "
???????? NAME2??? " 2
???????? STRAS??? "/-
???????? ORT01??? "
??? FROM T001W
??? INTO CORRESPONDING FIELDS OF TABLE L_IT_WERKS.
*
?CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
??? EXPORTING
????? RETFIELD?????????????? = 'WERKS'??? "plant
????? DYNPPROG?????????????? = SY-REPID?? "
????? DYNPNR???????????????? = SY-DYNNR?? "
????? DYNPROFIELD??????????? = 'P_WERKS'??? "
????? VALUE_ORG????????????? = 'S'??????? "cell by cell
??? TABLES
????? VALUE_TAB????????????? = L_IT_WERKS
??? EXCEPTIONS
????? PARAMETER_ERROR??????? = 1
????? NO_VALUES_FOUND??????? = 2
????? OTHERS???????????????? = 3
??? ????????.
?IF SY-SUBRC <> 0.
???? MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
???????????? WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
? ENDIF.
Function: READ_TEXT/CREATE_TEXT
?? 功能:讀取長文本 / 創建長文本
?? 參數:
??Import :
????CLIENT :集團
????ID :文本 ID ( TTXID 中定義)
????LANGUAGE :語言
????NAME :文本名字()
????OBJECT :文本對象( TTXOB 中定義)
??Export :
????HEADER :文本的描述信息
??Tables :
????LINES :文本內容
例子:讀取銷售訂單頭文本
???? CALL FUNCTION 'READ_TEXT'
????????EXPORTING
??????????ID??????????????????????= ‘Y001’
??????????LANGUAGE????????????????= SY-LANGU
??????????NAME????????????????????= ‘385’
??????????OBJECT??????????????????= ‘VBBK’
????????TABLES
??????????LINES?????????????????? = L_IT_LINES
????????EXCEPTIONS
??????????ID??????????????????????= 1
??????????LANGUAGE????????????????= 2
??????????NAME????????????????????= 3
??????????NOT_FOUND?????????????? = 4
??????????OBJECT??????????????????= 5
??????????REFERENCE_CHECK???????? = 6
??????????WRONG_ACCESS_TO_ARCHIVE = 7
??????????OTHERS??????????????????= 8.
Function: CONVERSION_EXIT_CUNIT_OUTPUT
?? 功能:根據語言決定單位的顯示
?? 參數:
????Import :
??????INPUT :內部單位顯示方式
??????LANGUAGE :語言代碼
????Export :
??????LONG_TEXT :單位的長文本
??????OUTPUT :外部單位顯示方式
??????SHORT_TEXT :單位的短文本
例子:單位顯示轉換
??????CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
??????EXPORTING
????????INPUT??????????= ‘ST’
????????LANGUAGE?????? = SY-LANGU
??????IMPORTING
????????OUTPUT???????? = L_OUT
??????EXCEPTIONS
????????UNIT_NOT_FOUND = 1
????????OTHERS???????? = 2.
Function: SJIS_DBC_TO_SBC
?? 功能:全角轉換為半角
?? 參數:
????Import :
??????ALL :全部轉換
??????ALPHABET_UPPER : A-Z 轉換
??????ALPHABET_LOWER : a-z 轉換
??????NUMERIC : 0-9 轉換
????Export :
??????CONVERTED :轉換的字符個數
????Changing :
??????TEXT :轉換結果
Function: SJIS_SBC_TO_DBC
?? 功能:半角轉換為全角
?? 參數:
????Import :
??????ALL :全部轉換
??????ALPHABET_UPPER : A-Z 轉換
??????ALPHABET_LOWER : a-z 轉換
??????NUMERIC : 0-9 轉換
????Export :
??????CONVERTED :轉換的字符個數
????Changing :
??????TEXT :轉換結果
Function: CO_R0_CHECK_DECIMAL_POINT
?? 功能:根據單位檢查數據的小數位
?? 參數:
????Import :
??????I_QUANTITY :數量
??????I_UNIT :單位
?? 例子:下面的例子會返回錯誤信息,以為單位 ST 是不能有小數位的。
????????CALL FUNCTION 'CO_R0_CHECK_DECIMAL_POINT'
??????????EXPORTING
????????????I_QUANTITY?????? = 3.2
????????????I_UNIT?????????? =‘ST’
??????????EXCEPTIONS
????????????WRONG_DATA?????? = 1
????????????OTHERS?????????? = 2.??
Function: POSTAL_CODE_CHECK
?? 功能:檢查郵政編碼
?? 參數:
????Import :
??????COUNTRY :國家( T005 ) ---------- 必輸
??????ONE_TIME_ACCOUNT :不明確
??????POSTAL_CODE :郵政編碼
??????POSTAL_CODE_PO_BOX :沒用過,以下為推測:如果輸入則會檢查,如果 t005 表中的 XPLPF 設置了,那么如果輸入 PO_BOX ,這個選項就必須輸入。
?????? PO_BOX :沒用過
?????? REGION :區域
????Export :
??????POSTAL_CODE :郵編
??????EV_POSTAL_CODE :郵編的格式
??????EV_POSTAL_CODE_PO_BOX :沒用過
例子:檢查輸入的郵編是否有效
????????CALL FUNCTION 'POSTAL_CODE_CHECK'
??????????EXPORTING
????????????COUNTRY???????????????????? = 'JP'
????????????POSTAL_CODE???????????????? = L_WA_DISP-POST_CODE1
??????????EXCEPTIONS
????????????NOT_VALID?????????????????? = 1
????????????OTHERS??????????????????????= 2
每天函數講解系列 ----2006.01.12
?
Funtion : CONVERSION_EXIT_ALPHA_INPUT
?? 功能:全數字則在前面補 0
?? 參數:
????Import :
??????INPUT :輸入的字符串
????Export :
??????OUTPUT :輸出的字符串
Funtion : CONVERSION_EXIT_ALPHA_INPUT
?? 功能:和上面相反
Funtion : GET_JOB_RUNTIME_INFO
?? 功能:獲得 job 相關信息
?? 參數:
????Export :
???? EVENTID :后臺處理的事件 id
???? EVENTPARM :后臺事件的參數(例如, job id , job 名字)
???? TERNAL_PROGRAM_ACTIVE :沒用過
???? JOBCOUNT : job id
???? JOBNAME : job 名稱
Funtion : TERMINAL_ID_GET
?? 功能:獲得端末 id
?? 參數:
????Import :
??????USERNAME :用戶名
????Export :
??????TERMINAL : terminal id
Funtion : DATE_CONVERT_TO_FACTORYDATE
?? 功能:把輸入日期轉為工廠日歷日期
?? 參數:
????Import :
??????CORRECT_OPTION :表示工作日計算方式的標記 ??
??????DATE :必須轉化為工廠日歷日期的日期 ??
??????FACTORY_CALENDAR_ID :工廠日歷 ID????
????Export :
??????DATE :必須轉化為工廠日歷日期的日期 ????
??????FACTORYDATE :指定日歷中的工作日數 ??????
??????WORKINGDAY_INDICATOR :表示某日期是否為工作日的標志 ????????
例子:
DATA: DATE1????????LIKE SCAL-DATE,
??????DATE2????????LIKE SCAL-DATE,
??????CORRECTION?? LIKE SCAL-INDICATOR,
??????CALENDAR???? LIKE SCAL-FCALID,
??????FACTORYDATE??LIKE SCAL-FACDATE,
??????WORKDAY??????LIKE SCAL-INDICATOR.
??????CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
?????????? EXPORTING??DATE???????????????? = DATE1
?????????????????????? CORRECT_OPTION?????? = CORRECTION
?????????????????????? FACTORY_CALENDAR_ID??= CALENDAR
?????????? IMPORTING??DATE???????????????? = DATE2
?????????????????????? FACTORYDATE??????????= FACTORYDATE
?????????????????????? WORKINGDAY_INDICATOR = WORKDAY
?????????? EXCEPTIONS CORRECT_OPTION_INVALID???? = 1
????????????????????????DATE_AFTER_RANGE?????????? = 2
?????????????????????? DATE_BEFORE_RANGE??????????= 3
?????????????????????? DATE_INVALID?????????????? = 4
?????????????????????? FACTORY_CALENDAR_NOT_FOUND = 5.
Funtion : MESSAGE_TEXT_BUILD
?? 功能:把消息轉為文本
?? 參數:
????Import :
??????MSGID :消息 id
??????MSGNR :消息號
??????MSGV1 :參數 1
??????MSGV2 :參數 2
??????MSGV3 :參數 3
??????MSGV4 :參數 4
????Export :
??????MESSAGE_TEXT_OUTPUT :輸出的字符串
?? 說明:可以用 write <message> to <text> 代替。
每天函數講解系列 ----2006.01.16
?
Function: POPUP_TO_CONFIRM
Group : SPO1
?? 功能:彈出確認窗口
?? 參數:
????Import :
??????TITLEBAR :彈出窗口的標題,最多 40 位
??????TEXT_QUESTION :問題,最長 80 位,多出來的截斷
??????TEXT_BUTTON_1 :第一按鈕的 text ,最長 8 位
??????ICON_BUTTON_1 :第一按鈕顯示的 icon
??????TEXT_BUTTON_2 :第二按鈕的 text ,最長 8 位
??????ICON_BUTTON_2 :第二按鈕顯示的 icon
??????DEFAULT_BUTTON :默認的按鈕
??????DISPLAY_CANCEL_BUTTON :是否顯示取消
??????POPUP_TYPE :彈出的類型: 決定顯示的 icon
???????? ICON_MESSAGE_QUESTION :問題
??????????ICON_MESSAGE_INFORMATION :信息
??????????ICON_MESSAGE_WARNING :警告
??????????ICON_MESSAGE_ERROR :錯誤
??????????ICON_MESSAGE_CRITICAL :沖突
??????START_COLUMN :彈出位置:列
??????START_ROW :彈出位置:行
??????IV_QUICKINFO_BUTTON_1 :第一按鈕的顯示信息(鼠標放上去后看到的)
??????IV_QUICKINFO_BUTTON_2 :第二按鈕的顯示信息(鼠標放上去后看到的)
????Export :
??????ANSWER :返回點擊的按鈕
????????'1' :第一個按鈕
???????? '2' :第二個按鈕
???????? 'A' :取消按鈕
每天函數講解系列 ----2006.01.20
?
物料號碼轉換函數 , 上傳文件時可能會用到
1.CONVERSION_EXIT_MATN1_INPUT
????EXPORTING????
??????INPUT = ' 要轉換的物料號 '
????IMPORTING
??????OUTPUT = ' 轉換后的內部使用的物料號 '.
?? 比如輸入 123456, 輸出 000000000000123456
2.CONVERSION_EXIT_MATN1_OUTPUT.
?? 作用同上面相反 , 用法較簡單 , 就不說了
?call function 'CONVERT_TO_LOCAL_CURRENCY'??????" 按照指定日期匯率轉換金額為指定貨幣類型
??????????exporting
????????????DATE???????????? = T_EKKO-BEDAT?? " 日期
????????????FOREIGN_AMOUNT?? = T_DATA-NETPR?? " 待轉換金額
????????????FOREIGN_CURRENCY = WAERS??????????" 當前貨幣單位
????????????LOCAL_CURRENCY?? = 'USD'??????????" 目標貨幣
??????????importing
????????????LOCAL_AMOUNT???? = T_DATA-NETPR.??" 轉換后金額
??????endif.
?call function 'SSF_FUNCTION_MODULE_NAME'??????" 根據 form 名取得對應的函數名 (SmartForm)
????exporting
??????FORMNAME?????????? = 'ZFI_06'????????????????"Form 名
????importing
??????FM_NAME????????????= FUNC_MODULE_NAME????????" 返回函數名
????exceptions
??????NO_FORM????????????= 1
??????NO_FUNCTION_MODULE = 2
??????others???????????? = 3.
由于開發機上開發 smartform 傳入生產機后有可能會改變其函數名 , 所以在調用 smartform 前使用這個函數
每天函數講解系列 ----2006.01.23
?
DATE_CHECK_PLAUSIBILITY 日期 CHECK
??CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
????EXPORTING
??????date??????????????????????= i_date
????EXCEPTIONS
??????plausibility_check_failed = 1
??????OTHERS????????????????????= 2.
cl_gui_frontend_services=>gui_upload?? 上傳到服務器
??CALL METHOD cl_gui_frontend_services=>gui_upload
????EXPORTING
??????filename????????????????= l_filename
??????filetype????????????????= i_filetype
??????has_field_separator???? = i_separator
*??????HEADER_LENGTH?????????? = 0
*??????DAT_MODE????????????????= SPACE
*??????CODEPAGE????????????????= SPACE
*??????IGNORE_CERR???????????? = ABAP_TRUE
*??????REPLACEMENT???????????? = '#'
*??????READ_BY_LINE????????????= 'X'
*????IMPORTING
*??????FILELENGTH??????????????=
*??????HEADER??????????????????=
????CHANGING
??????data_tab????????????????= o_tab_table
????EXCEPTIONS
??????file_open_error???????? = 1
??????file_read_error???????? = 2
??????no_batch????????????????= 3
??????gui_refuse_filetransfer = 4
??????invalid_type????????????= 5
??????no_authority????????????= 6
??????unknown_error?????????? = 7
??????bad_data_format???????? = 8
??????header_not_allowed??????= 9
??????separator_not_allowed?? = 10
??????header_too_long???????? = 11
??????unknown_dp_error????????= 12
??????access_denied?????????? = 13
??????dp_out_of_memory????????= 14
??????disk_full?????????????? = 15
??????dp_timeout??????????????= 16
??????not_supported_by_gui????= 17
??????error_no_gui????????????= 18
??????OTHERS??????????????????= 19.
cl_gui_frontend_services=>gui_download?? 下載到服務器
??CALL METHOD cl_gui_frontend_services=>gui_download
????EXPORTING
*??????BIN_FILESIZE??????????????=
??????filename??????????????????= l_filename
??????filetype??????????????????= i_filetype
*??????APPEND????????????????????= SPACE
??????write_field_separator???? = i_separator
*??????HEADER????????????????????= '00'
*??????TRUNC_TRAILING_BLANKS???? = SPACE
*??????WRITE_LF??????????????????= 'X'
*??????COL_SELECT????????????????= SPACE
*??????COL_SELECT_MASK?????????? = SPACE
*??????DAT_MODE??????????????????= SPACE
*??????CONFIRM_OVERWRITE???????? = SPACE
*??????NO_AUTH_CHECK???????????? = SPACE
*??????CODEPAGE??????????????????= SPACE
*??????IGNORE_CERR?????????????? = ABAP_TRUE
*??????REPLACEMENT?????????????? = '#'
*??????WRITE_BOM???????????????? = SPACE
*??????TRUNC_TRAILING_BLANKS_EOL = 'X'
*????IMPORTING
*??????FILELENGTH????????????????=
????CHANGING
??????data_tab??????????????????= o_tab_table[]
????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
??????not_supported_by_gui??????= 22
??????error_no_gui??????????????= 23
??????OTHERS????????????????????= 24.
SSF_FUNCTION_MODULE_NAME??
SMARTFORMS 輸出報表時,生成一個函數名稱,然后 CALL 這個名稱
??CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
????EXPORTING
??????FORMNAME?????????? = CNS_SMART??????????"SMARTFORMS の名稱
????IMPORTING
??????FM_NAME????????????= W_FMNAME?????????? "SMARTFORMS の名稱
????EXCEPTIONS
??????NO_FORM????????????= 1
??????NO_FUNCTION_MODULE = 2
??????OTHERS???????????? = 3.
*??CALL FUNCTION W_FMNAME
*????TABLES
*??????I_HEAD?????????? = I_HEAD??????????
*????EXCEPTIONS
*??????FORMATTING_ERROR = 1
*??????INTERNAL_ERROR?? = 2
*??????SEND_ERROR?????? = 3
*??????USER_CANCELED????= 4
*??????OTHERS?????????? = 5.
GRAPH_MATRIX_3D?? 把數據生成柱狀 3D
TIME_CHECK_PLAUSIBILITY?? 判斷是不是時間
每天函數講解系列 ----2006.02.11
?
Funtion : POPUP_TO_DECIDE_LIST??
?? 功能:彈出供選擇窗口,最多 25 個選項,選擇可以是單選按鈕也可以是復選按鈕,可以設定最多選擇的個數。
?? 參數:
????Import :
??????CURSORLINE?? :默認光標所在行
??????MARK_FLAG :選擇的標志,一般設為 ‘X’
??????MARK_MAX : 最大選擇的選項個數
??????START_COL :起始行
??????START_ROW?? :起始列,用來定位彈出窗口的位置
??????TEXTLINE1 :文本行
??????TEXTLINE2 :文本行
??????TEXTLINE3 :文本行
??????TITEL :彈出窗口的標題
??????DISPLAY_ONLY :僅顯示
????Export :
??????ANSWER : A :取消 ?? 空:做了選擇
????Tables :
??????T_SPOPLI :選擇結果
例子:
REPORT??Z_BOBO??????????????????????????????????.
* 定義函數需要的變量
DATA: BEGIN OF SPOPLIST OCCURS 15.
??????????INCLUDE STRUCTURE SPOPLI.
??DATA: END?? OF SPOPLIST.
??DATA: ANTWORT TYPE C.
* 添加選擇參數
??SPOPLIST-VAROPTION = 'Creditor'.
??APPEND SPOPLIST.
??SPOPLIST-VAROPTION = 'Material'.
??APPEND SPOPLIST.
??SPOPLIST-VAROPTION = 'Account '.
??SPOPLIST-SELFLAG?? = 'X'.
??CALL FUNCTION 'POPUP_TO_DECIDE_LIST'
???? EXPORTING??TITEL????????????= 'Possible entra: Order'
?????????????? TEXTLINE1????????= 'By which criteria'
?????????????? TEXTLINE2????????= 'should orders'
?????????????? TEXTLINE3????????= 'be selected?'
?????????????? MARK_MAX???????? = 2
?????????????? MARK_FLAG????????= 'X'
????IMPORTING??ANSWER?????????? = ANTWORT
????TABLES???? T_SPOPLI???????? = SPOPLIST
????EXCEPTIONS TOO_MUCH_ANSWERS = 1
?????????????? TOO_MUCH_MARKS?? = 2.
??IF SY-SUBRC = 2.
????WRITE: 'Too many answers chosen.'.
??ENDIF.
* 取消
??IF ANTWORT = 'A'.
????WRITE: 'Popup canceled.'.
??ELSE.
????WRITE: 'Options chosen:'.
????LOOP AT SPOPLIST WHERE SELFLAG = 'X'.
??????WRITE: / SPOPLIST-VAROPTION.
????ENDLOOP.
??ENDIF.
每天函數講解系列 ----2006.02.13
?
Funtion : DDIF_FIELDINFO_GET??
?? 功能:獲得字段的相關信息
?? 參數:
????Import :
??????TABNAME :數據庫表的名字
??????FIELDNAME :無需指定,由 LFIELDNAME 代替了
??????LANGU : 語言設定,默認 sy-langu
??????LFIELDNAME :指定關聯字段
??????ALL_TYPES :是否指定所有類型
??????GROUP_NAMES :是否包含 include 的字段
??????UCLEN :沒用過,應該是和 unicode 相關的
????Export :
??????X030L_WA :返回表頭的信息
??????DDOBJTYPE :表類型
????????'TRANSP'?? = transparent table
????????'POOL'???? = logical pooled table
????????'CLUSTER'??= logical cluster table
????????'VIEW'???? = database or projection view
????????'INTTAB'?? = structure, help view, maintenance view or structure view
????????'TPOOL'????= physical pooled table
????????'TCLUSTER' = physical cluster table
????????'DTEL'???? = data element
????????'TTYP'???? = table type
??????DFIES_WA :沒用過
??????LINES_DESCR :沒用過
????Tables :
??????DFIES_TAB :字段列表
??????FIXED_VALUES :域的固定值
?? 說明:該函數可用來獲得某個表或者結構或者視圖等所有字段的相關信息,所以如果想用 alv 來維護某個表的時候,對設定 field catalog 有幫助。
Funtion : DDIF_NAMETAB_GET????
?? 功能:獲得字段的相關信息 ( 不包含 text)
?? 參數:
????Import :
??????TABNAME :數據庫表的名字
??????LFIELDNAME :指定關聯字段
??????ALL_TYPES :是否指定所有類型
??????GROUP_NAMES :是否包含 include 的字段
??????UCLEN :沒用過,應該是和 unicode 相關的
????Export :
??????X030L_WA :返回表頭的信息
??????DTELINFO_WA : data element 的信息
??????TTYPINFO_WA :表類型的信息
??????DDOBJTYPE :表類型
????????'TRANSP'?? = transparent table
????????'POOL'???? = logical pooled table
????????'CLUSTER'??= logical cluster table
????????'VIEW'???? = database or projection view
????????'INTTAB'?? = structure, help view, maintenance view or structure view
????????'TPOOL'????= physical pooled table
????????'TCLUSTER' = physical cluster table
????????'DTEL'???? = data element
????????'TTYP'???? = table type
??????DFIES_WA :沒用過
??????LINES_DESCR :沒用過
????Tables :
??????DFIES_TAB :字段列表
??????FIXED_VALUES :域的固定值
Funtion : DDIF_NAMETAB_GET????
?? 功能:獲得字段的相關信息 ( 不包含 text)
?? 參數:
????Import :
??????TABNAME :數據庫表的名字
??????LFIELDNAME :指定關聯字段
??????ALL_TYPES :是否指定所有類型
??????GROUP_NAMES :是否包含 include 的字段
??????UCLEN :沒用過,應該是和 unicode 相關的
????Export :
??????X030L_WA :返回表頭的信息
??????DTELINFO_WA : data element 的信息
??????TTYPINFO_WA :表類型的信息
??????DDOBJTYPE :表類型
????????'TRANSP'?? = transparent table
????????'POOL'???? = logical pooled table
????????'CLUSTER'??= logical cluster table
????????'VIEW'???? = database or projection view
????????'INTTAB'?? = structure, help view, maintenance view or structure view
????????'TPOOL'????= physical pooled table
????????'TCLUSTER' = physical cluster table
????????'DTEL'???? = data element
????????'TTYP'???? = table type
??????DFIES_WA :沒用過
??????LINES_DESCR :沒用過
????Tables :
??????DFIES_TAB :字段列表
??????FIXED_VALUES :域的固定值
每天函數講解系列 ----2006.02.14
?
Function: CLOI_PUT_SIGN_IN_FRONT
?? 功能:將負號提前
?? 參數:
????Changing :
??????VALUE :需要負號提前的變量
Function: CLOI_PUT_SIGN_IN_FRONT
?? 功能:將負號提前
?? 參數:
????Changing :
??????VALUE :需要負號提前的變量
Function: BAPI_COMPANYCODE_GET_PERIOD
?? 功能:獲得公司的會計年度以及過賬日期
?? 參數:
????Import :
??????COMPANYCODEID :公司代碼
??????POSTING_DATE : posting date
????Export :
??????FISCAL_YEAR :會計年度
??????FISCAL_PERIOD :財務期間
??????RETURN :返回值
?? 說明:該函數可用來檢查會計期間
Function: MARA_SINGLE_READ
?? 功能:讀取物料信息
?? 參數:
????Import :
??????KZRFB : Indicator: Refresh buffer entry
??????MAXTZ : Max. no. of entries in buffer (這兩個參數應該和性能優化相關)
??????MATNR :物料號
??????SPERRMODUS : Lock mode (none, shared, excl.)
??????STD_SPERRMODUS : Standard lock mode (if different) (鎖相關)
??????OUTPUT_NO_MESSAGE :是否輸出消息
????Export :
??????WMARA :返回的物料信息
?? 說明:該函數可用于性能優化,例如無法避免在 loop 中有 sql 的情況可以用該函數取代 sql 。
???????? 對 mara 的其它操作參考 function group : MG21
Function: KNA1_SINGLE_READ
?? 功能:讀取 customer 表信息
?? 參數:
????Import :
??????KZRFB : Indicator: Refresh buffer entry
??????KNA1_KUNNR : customer code
????Export :
??????WKNA1 :返回的信息
?? 說明:還有很多表的讀取參考 function group : MG41
Function: ADDR_GET_COMPLETE_ALL_TYPES
?? 功能:獲得地址的相關信息
?? 參數:
????Import :
??????ADDRNUMBER : address number
??????PERSNUMBER :個人信息
??????ADDRESS_OBJECT_TYPE :類型 1 :組織 2 :個人 3 :客戶
????Export :
??????ADDR1_COMPLETE :地址 1
??????ADDR2_COMPLETE :地址 2
??????ADDR3_COMPLETE :地址 3
??????ADDR1_COMPLETE_BAPI :地址 1
??????ADDR2_COMPLETE_BAPI :地址 2
??????ADDR3_COMPLETE_BAPI :地址 3 (以上三個 bapi 用)
Function: READ_VBFA
?? 功能:取得 document flow (省得 select 了)
?? 參數:
????Import :
??????I_VBELV : Preceding sales and distribution document
??????I_POSNV : Preceding item of an SD document
??????I_VBTYP_V : Document category of preceding SD document
??????I_VBTYP_N : Document category of subsequent document
??????I_FKTYP : Billing category
??????I_BYPASSING_BUFFER :是否用 buffer
??????I_REFRESH_BUFFER :刪除 buffer ?
????Tables :
??????E_VBFA :憑證流的表
?? 說明:可以通過 by passing buffer 來優化性能
Function: LIKP_READ
?? 功能: Delivery Header Data
?? 參數:
????Import :
??????I_VBELN : Delivery
??????LINE_EXIST : if 'x' check only if line exsists
????Export :
??????O_ANSWR : send out 'x' for line exsists in table
????Tables :
??????E_LIKP : SD Document: Delivery Header Data
?? 說明:有關讀取 delivery 的信息請參考 function group : LMGT
每天函數講解系列 ----2006.02.15
?
Convert currency value from SAP to display
The following code shows how CURRENCY_AMOUNT_SAP_TO_DISPLAY can be used. You pass it a
Currecny code(WAERS) and an SAP stored currency value. It will convert the value into its correct currecny
value. Without using this function module you are not guaranteed to be using the correct value as it is often
missing a number of zeroes.
????????????????????????I.e. 28000 JPY is stored within SAP as 280.??
* DATA declaration
*-----------------
* WMTO_S-AMOUNT =??Type DEC :: length 15 :: Deciamls 4
parameter: p_discur like TCURC-WAERS,???? "Display currency
?????????? p_intval like WMTO_S-AMOUNT.?? "Internal Amount
data:??????gd_disval??like WMTO_S-AMOUNT. "Display Amount
************************************************************************
*Start-of-selection.
START-OF-SELECTION.
CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'
???? EXPORTING
??????????currency????????= p_discur
??????????amount_internal = p_intval
????IMPORTING
???????? AMOUNT_DISPLAY?? = gd_disval
????EXCEPTIONS
???????? INTERNAL_ERROR?? = 1
???????? OTHERS?????????? = 2.
IF sy-subrc EQ 0.
*??You are now able to manipulate the returned value.
*???????????????????????? I.e. Convert it to GBP????
*??Without using this function module you would only be manipulating the
*??SAP stored value, which is often missing a number of zeroes.
*?????? I.e. 28000 JPY is stored within SAP as 280. ??????????
ENDIF.
************************************************************************
*End-of-selection.
END-OF-SELECTION.
write:/(30)??'Value stored in SAP:', p_intval,
??????/(30)??'Displayed currency:',??p_discur,
??????/(30)??'Ammount is displayed Currency:', gd_disval.
Convert currency value from display to SAP
The following code shows how CURRENCY_AMOUNT_DISPLAY_TO_SAP can be used. You pass it a
Currecny code(WAERS) and the displayed currency value. It will convert the value so that it can be stored
in SAP. Without using this function module the value stored in SAP is not guaranteed to be correct.
????????????????????????I.e. 28000 JPY is stored within SAP as 280.
*Data declaration
*------------
* WMTO_S-AMOUNT =??Type DEC :: length 15 :: Deciamls 4
parameter: p_curr?? like TCURC-WAERS,???? "Display currency
?????????? p_disval like WMTO_S-AMOUNT.??"Internal Amount
data:??????gd_intval??like WMTO_S-AMOUNT. "Display Amount
CALL FUNCTION 'CURRENCY_AMOUNT_DISPLAY_TO_SAP'
???? EXPORTING
??????????currency????????= p_curr
??????????amount_display??= p_disval
????IMPORTING
??????????AMOUNT_INTERNAL = gd_intval
????EXCEPTIONS
??????????INTERNAL_ERROR??= 1
??????????OTHERS??????????= 2
??????????.
IF sy-subrc <> 0.
* You are now able to store the return value into an SAP table.
ENDIF.
************************************************************************
*Start-of-selection.
START-OF-SELECTION.
write:/(30)??'Value Displayed on screen in SAP:', p_disval,
??????/(30)??'Currency:',??p_curr,
??????/(30)??'Internal SAP value', gd_intval.
Retrieve fiscal year and period
?
The below code shows how to use function modules
BAPI_COMPANYCODE_GET_PERIOD and DETERMINE_PERIOD to retrieve fiscal year and fiscal period for a specific date.
*.......................................................................
*: Report:??ZFISCALYR??????????????????????????????????????????????????:
*:???????????????????????????????????????????????????????????????????? :
*: Author:??www.SAPdev.co.uk?????????????????????????????????????????? :
*:???????????????????????????????????????????????????????????????????? :
*: Date??:??2004?????????????????????????????????????????????????????? :
*:???????????????????????????????????????????????????????????????????? :
*: Description: Demonstrates how to return the corresponding fiscal????:
*:??????????????year and posting period for a company code and posting :
*:??????????????date or posting date and fiscal year variant.??????????:
*:.....................................................................:
REPORT??zfiscalyr NO STANDARD PAGE HEADING.
TABLES: ekko.
PARAMETERS:???? p_bukrs TYPE ekko-bukrs,
????????????????p_bedat TYPE ekko-bedat.
DATA: gd_fiscalyr??TYPE bapi0002_4-fiscal_year,
??????gd_fiscalp?? TYPE bapi0002_4-fiscal_period.
DATA: gd_fiscalyr2 TYPE T009B-BDATJ,
??????gd_fiscalp2??TYPE bapi0002_4-fiscal_period.
DATA: gd_periv???? TYPE t009-periv.
************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
* get fiscal year and period - (requires date and company code)
??CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
????EXPORTING
??????companycodeid = p_bukrs
??????posting_date??= p_bedat
????IMPORTING
??????fiscal_year?? = gd_fiscalyr
??????fiscal_period = gd_fiscalp.
* Alternative fiscal year function module
* - (requires date and fiscal year variant code from T009 table)
*--------------------------------------------------------------------
* gets first entry in fiscal year variant table (will need to choose
* correct one from table rather than just using first entry)
??SELECT SINGLE periv
????FROM t009
????INTO gd_periv.
* get fiscal year and period
??CALL FUNCTION 'DETERMINE_PERIOD'
????EXPORTING
??????date??????????????????????= p_bedat
*????PERIOD_IN???????????????? = '000'
??????version?????????????????? = gd_periv
?? IMPORTING
??????period????????????????????= gd_fiscalp2
??????year??????????????????????= gd_fiscalyr2
?? EXCEPTIONS
??????period_in_not_valid?????? = 1
??????period_not_assigned?????? = 2
??????version_undefined???????? = 3
??????OTHERS????????????????????= 4.
************************************************************************
*END-OF-SELECTION.
END-OF-SELECTION.
??WRITE:/ 'From function module: BAPI_COMPANYCODE_GET_PERIOD',
????????/ 'Fiscal year is:', gd_fiscalyr,
????????/ 'Fiscal period is:', gd_fiscalp.
??SKIP.
WRITE:/ 'From function module: DETERMINE_PERIOD',
????????/ 'Fiscal year is:', gd_fiscalyr2,
????????/ 'Fiscal period is:', gd_fiscalp2.
?
一個將數字金額轉換為中文大寫金額的程序
FUNCTION z_rmbdx.
*"----------------------------------------------------------------------
*"*"Local interface:
*" ?IMPORTING
*" ? ? REFERENCE(RMBXX) LIKE ?BSEG-WRBTR
*" ?CHANGING
*" ? ? REFERENCE(RMBDX1) TYPE ?C
*"----------------------------------------------------------------------
DATA: BEGIN OF rmb,
? ? by TYPE c,
? ? sy TYPE c,
? ? y TYPE c,
? ? qw TYPE c,
? ? bw TYPE c,
? ? sw TYPE c,
? ? w TYPE c,
? ? q TYPE c,
? ? b TYPE c,
? ? s TYPE c,
? ? g TYPE c,
? ? d TYPE c,
? ? j TYPE c,
? ? f TYPE c,
? ? n TYPE c,
? ? END OF rmb.
DATA: BEGIN OF rmbdx,
? ? by(2) TYPE c,
? ? by1(4) TYPE c,
? ? sy(2) TYPE c,
? ? sy1(4) TYPE c,
? ? y(2) TYPE c,
? ? y1(2) TYPE c,
? ? qw(2) TYPE c,
? ? qw1(4) TYPE c,
? ? bw(2) TYPE c,
? ? bw1(4) TYPE c,
? ? sw(2) TYPE c,
? ? sw1(4) TYPE c,
? ? w(2) TYPE c,
? ? w1(4) TYPE c,
? ? q(2) TYPE c,
? ? q1(4) TYPE c,
? ? b(2) TYPE c,
? ? b1(4) TYPE c,
? ? s(2) TYPE c,
? ? s1(4) TYPE c,
? ? g(2) TYPE c,
? ? d(2) TYPE c,
? ? j(2) TYPE c,
? ? j1(2) TYPE c,
? ? f(2) TYPE c,
? ? f1(2) TYPE c,
? ? z(2) TYPE c,
? ? END OF rmbdx.
DATA: y(1) TYPE c.
rmb = rmbxx.
IF NOT ( rmb-by IS INITIAL ) AND rmb-by NE '0'.
PERform dx USING rmb-by CHANGING rmbdx-by.
y = 'X'.
IF rmb-by NE '0'.
? IF rmb-sy EQ '0' AND rmb-y EQ '0'.
? ? rmbdx-by1 = ' 佰億 '.
? ELSE.
? ? rmbdx-by1 = ' 佰 '.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-sy IS INITIAL ).
IF rmb-sy NE '0' OR rmb-y NE '0'.
? PERform dx USING rmb-sy CHANGING rmbdx-sy.
? y = 'X'.
? IF rmb-sy NE '0'.
? ? IF rmb-y EQ '0'.
? ? ? rmbdx-sy1 = ' 拾億 '.
? ? ELSE.
? ? ? rmbdx-sy1 = ' 拾 '.
? ? ENDIF.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-y IS INITIAL ).
IF rmb-y NE '0' OR rmb-qw NE '0'.
? PERform dx USING rmb-y CHANGING rmbdx-y.
? y = 'X'.
? IF rmb-y NE '0'.
? ? rmbdx-y1 = ' 億 '.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-qw IS INITIAL ).
IF rmb-qw NE '0' OR rmb-bw NE '0'.
? PERform dx USING rmb-qw CHANGING rmbdx-qw.
? y = 'X'.
? IF rmb-qw NE '0'.
? ? IF rmb-bw EQ '0' AND rmb-sw EQ '0' AND rmb-w EQ '0'.
? ? ? rmbdx-qw1 = ' 仟萬 '.
? ? ELSE.
? ? ? rmbdx-qw1 = ' 仟 '.
? ? ENDIF.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-bw IS INITIAL ).
IF rmb-bw NE '0' OR rmb-sw NE '0'.
? PERform dx USING rmb-bw CHANGING rmbdx-bw.
? y = 'X'.
? IF rmb-bw NE '0'.
? ? IF rmb-sw EQ '0' AND rmb-w EQ '0'.
? ? ? rmbdx-bw1 = ' 佰萬 '.
? ? ELSE.
? ? ? rmbdx-bw1 = ' 佰 '.
? ? ENDIF.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-sw IS INITIAL ).
IF rmb-sw NE'0' OR rmb-w NE '0'.
? PERform dx USING rmb-sw CHANGING rmbdx-sw.
? y = 'X'.
? IF rmb-sw NE '0'.
? ? IF rmb-w EQ '0'.
? ? ? rmbdx-sw1 = ' 拾萬 '.
? ? ELSE.
? ? ? rmbdx-sw1 = ' 拾 '.
? ? ENDIF.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-w IS INITIAL ).
IF rmb-w NE '0' OR rmb-q NE '0'.
? PERform dx USING rmb-w CHANGING rmbdx-w.
? y = 'X'.
? IF rmb-w NE '0'.
? ? rmbdx-w1 = ' 萬 '.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-q IS INITIAL ).
IF rmb-q NE '0' OR rmb-b NE '0'.
? PERform dx USING rmb-q CHANGING rmbdx-q.
? y = 'X'.
? IF rmb-q NE '0'.
? ? rmbdx-q1 = ' 仟 '.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-b IS INITIAL ).
IF rmb-b NE '0' OR rmb-s NE '0'.
? PERform dx USING rmb-b CHANGING rmbdx-b.
? y = 'X'.
? IF rmb-b NE '0'.
? ? rmbdx-b1 = ' 佰 '.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-s IS INITIAL ).
IF rmb-s NE'0' OR rmb-g NE '0'.
? PERform dx USING rmb-s CHANGING rmbdx-s.
? y = 'X'.
? IF rmb-s NE '0'.
? ? rmbdx-s1 = ' 拾 '.
? ENDIF.
ENDIF.
ENDIF.
IF NOT ( rmb-g IS INITIAL ) AND rmb-g NE '0'.
PERform dx USING rmb-g CHANGING rmbdx-g.
y = 'X'.
ENDIF.
IF y EQ 'X'.
rmbdx-d = ' 圓 '.
ENDIF.
IF NOT ( rmb-j IS INITIAL ) AND rmb-j NE '0'.
PERform dx USING rmb-j CHANGING rmbdx-j.
rmbdx-j1 = ' 角 '.
ENDIF.
IF NOT ( rmb-f IS INITIAL ) AND rmb-f NE '0'.
PERform dx USING rmb-f CHANGING rmbdx-f.
rmbdx-f1 = ' 分 '.
ELSE.
rmbdx-z = ' 整 '.
ENDIF.
CONDENSE rmbdx NO-GAPS.
IF rmbxx = 0.
CLEAR rmbdx.
ENDIF.
rmbdx1 = rmbdx.
CLEAR y.
ENDFUNCTION.
*---------------------------------------------------------------------*
* ? ? ? form dx ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *
*---------------------------------------------------------------------*
* ? ? ? ........ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*
*---------------------------------------------------------------------*
* ?--> ?value(X) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*
* ?--> ?DXX ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *
*---------------------------------------------------------------------*
form dx USING value(x) CHANGING dxx.
CASE x.
WHEN '0'.
? dxx = ' 零 '.
WHEN '1'.
? dxx = ' 壹 '.
WHEN '2'.
? dxx = ' 貳 '.
WHEN '3'.
? dxx = ' 叁 '.
WHEN '4'.
? dxx = ' 肆 '.
WHEN '5'.
? dxx = ' 伍 '.
WHEN '6'.
? dxx = ' 陸 '.
WHEN '7'.
? dxx = ' 柒 '.
WHEN '8'.
? dxx = ' 捌 '.
WHEN '9'.
? dxx = ' 玖 '.
ENDCASE.
ENDform.
運行該程序前還需定義以下文本段 :
001: 壹
002: 貳
003: 叁
004: 肆
005: 伍
006: 陸
007: 柒
008: 捌
009: 玖
010: 零
011: 元
012: 角
013: 分
014: 拾
015: 佰
016: 仟
017: 萬
REPORT ZYESE04 .
parameters : p_test type p.
data: result type string,
? ? ?test type p.
start-of-selection.
?test = p_test.
?perform select_translate.
end-of-selection.
top-of-page.
end-of-page.
*&---------------------------------------------------------------------*
*& ? ? ?form ?select_translate
*&---------------------------------------------------------------------*
* ? ? ? text
*----------------------------------------------------------------------*
* ?--> ?p1 ? ? ? ?text
* ?<-- ?p2 ? ? ? ?text
*----------------------------------------------------------------------*
form select_translate.
?data length type i.
?data index type i value '0'.
?data temp type p.
?data temp_s type string.
?data temp_r type i.
?data index_times type i.
?data flag1 type i value '1'.
?data flag2 type i value '1'.
?data flag3 type i value '1'.
?data flag4 type i value '1'.
?data flag5 type i value '1'.
?data flag6 type i value '1'.
?data flag7 type i value '1'.
?data flag8 type i value '1'.
?data flag9 type i value '1'.
?temp = test.
?temp_s = temp.
?length = strlen( temp_s ) - 1.
?do length times.
? ?index = index + 1.
? ?index_times = length - index + 1.
? ?do index_times times.
? ? ?temp_r = temp mod 10.
? ? ?if sy-index = index_times.
? ? ? ?case index.
? ? ? ? ?when '1'.
? ? ? ? ? ?if temp_r <> '0'.
? ? ? ? ? ? ?concatenate text-013 result into result.
? ? ? ? ? ?endif.
? ? ? ? ?when '2'.
? ? ? ? ? ?if temp_r <> '0'.
? ? ? ? ? ? ?concatenate text-012 result into result.
? ? ? ? ? ?endif.
? ? ? ? ?when '3'.
? ? ? ? ? ?concatenate text-011 result into result.
? ? ? ? ?when '4'.
? ? ? ? ? ?if temp_r <> '0'.
? ? ? ? ? ? ?concatenate text-014 result into result.
? ? ? ? ? ?endif.
? ? ? ? ?when '5'.
? ? ? ? ? ?if temp_r <> '0'.
? ? ? ? ? ? ?concatenate text-015 result into result.
? ? ? ? ? ?endif.
? ? ? ? ?when '6'.
? ? ? ? ? ?if temp_r <> '0'.
? ? ? ? ? ? ?concatenate text-016 result into result.
? ? ? ? ? ?endif.
? ? ? ? ?when '7'.
? ? ? ? ? ?concatenate text-017 result into result.
? ? ? ? ?when '8'.
? ? ? ? ? ?if temp_r <> '0'.
? ? ? ? ? ? ?concatenate text-014 result into result.
? ? ? ? ? ?endif.
? ? ? ? ?when '9'.
? ? ? ? ? ?if temp_r <> '0'.
? ? ? ? ? ? ?concatenate text-015 result into result.
? ? ? ? ? ?endif.
? ? ? ? ?when '10'.
? ? ? ? ? ?if temp_r <> '0'.
? ? ? ? ? ? ?concatenate text-016 result into result.
? ? ? ? ? ?endif.
? ? ? ?endcase.
? ? ? ?case temp_r.
? ? ? ? ?when '0'.
? ? ? ? ? ?case index.
? ? ? ? ? ? ?when '1'.
? ? ? ? ? ? ? ?flag1 = 0.
? ? ? ? ? ? ?when '2'.
? ? ? ? ? ? ? ?flag2 = 0.
? ? ? ? ? ? ? ?if flag1 = '1'.
? ? ? ? ? ? ? ? ?concatenate text-010 result into result.
? ? ? ? ? ? ? ?endif.
? ? ? ? ? ? ?when '3'.
? ? ? ? ? ? ? ?flag3 = 0.
? ? ? ? ? ? ?when '4'.
? ? ? ? ? ? ? ?flag4 = 0.
? ? ? ? ? ? ? ?if flag3 = '1'.
? ? ? ? ? ? ? ? ?concatenate text-010 result into result.
? ? ? ? ? ? ? ?endif.
? ? ? ? ? ? ?when '5'.
? ? ? ? ? ? ? ?flag5 = 0.
? ? ? ? ? ? ? ?if flag4 = '1'.
? ? ? ? ? ? ? ? ?concatenate text-010 result into result.
? ? ? ? ? ? ? ?endif.
? ? ? ? ? ? ?when '6'.
? ? ? ? ? ? ? ?flag6 = 0.
? ? ? ? ? ? ? ?if flag5 = '1'.
? ? ? ? ? ? ? ? ?concatenate text-010 result into result.
? ? ? ? ? ? ? ?endif.
? ? ? ? ? ? ?when '7'.
? ? ? ? ? ? ? ?flag7 = 0.
* ? ? ? ? ? ? ? ?if flag6 = '1'.
* ? ? ? ? ? ? ? ? ?concatenate text-010 result into result.
* ? ? ? ? ? ? ? ?endif.
? ? ? ? ? ? ?when '8'.
? ? ? ? ? ? ? ?flag8 = 0.
? ? ? ? ? ? ? ?if flag7 = '1'.
? ? ? ? ? ? ? ? ?concatenate text-010 result into result.
? ? ? ? ? ? ? ?endif.
? ? ? ? ? ? ?when '9'.
? ? ? ? ? ? ? ?flag9 = 0.
? ? ? ? ? ? ? ?if flag8 = '1'.
? ? ? ? ? ? ? ? ?concatenate text-010 result into result.
? ? ? ? ? ? ? ?endif.
? ? ? ? ? ?endcase.
? ? ? ? ?when '1'.
? ? ? ? ? ?concatenate text-001 result into result.
? ? ? ? ?when '2'.
? ? ? ? ? ?concatenate text-002 result into result.
? ? ? ? ?when '3'.
? ? ? ? ? ?concatenate text-003 result into result.
? ? ? ? ?when '4'.
? ? ? ? ? ?concatenate text-004 result into result.
? ? ? ? ?when '5'.
? ? ? ? ? ?concatenate text-005 result into result.
? ? ? ? ?when '6'.
? ? ? ? ? ?concatenate text-006 result into result.
? ? ? ? ?when '7'.
? ? ? ? ? ?concatenate text-007 result into result.
? ? ? ? ?when '8'.
? ? ? ? ? ?concatenate text-008 result into result.
? ? ? ? ?when '9'.
? ? ? ? ? ?concatenate text-009 result into result.
? ? ? ?endcase.
? ? ?endif.
? ?enddo.
? ?temp = temp div 10.
?enddo.
?write :/ test,
? ? ? ? ? ? ? result.
?clear result.
ENDform. ? ? ? ? ? ? ? ? ? ?" select_translate
一個只有 9 句的程序卻可更改 SAP 標準程序
REPORT ZMODISAP .
DATA:ITAB_CODE(72) OCCURS 0 WITH HEADER LINE.
***Change client status,under this status,No access key is asked
UPDATE T000
SET CCCATEGORY = 'C'
CCCORACTIV = '2'
CCNOCLIIND = '3'.
*** Modify LSTRDU34
READ REPORT 'LSTRDU34' INTO ITAB_CODE .
INSERT 'SY-SUBRC = 0 .' INTO ITAB_CODE ?INDEX 102.
INSERT REPORT 'LSTRDU34' ?FROM ITAB_CODE .
*** Modify LSTRDU44
READ REPORT 'LSTRDU44' INTO ITAB_CODE .
INSERT 'SY-SUBRC = 0 .' INTO itab_code ?index 101.
INSERT REPORT 'LSTRDU44' ?FROM ITAB_CODE .?
總結
以上是生活随笔為你收集整理的Function宝典的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ABAP程序权限对象设定
- 下一篇: SPO1的函数