SAP常用系統函式歸納
SAP常用系統函式歸納
函式名 描述
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.
說明:
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1625967
本文轉自
http://blog.csdn.net/ft1612796/archive/2007/05/25/1625967.aspx
本文來自CSDN部落格,轉載請標明出處:http://blog.csdn.net/long2006sky/archive/2007/07/31/1719759.aspx
相關文章
- Kotlin知識歸納(十一) —— 高階函式Kotlin函式
- Kotlin知識歸納(二) —— 讓函式更好呼叫Kotlin函式
- PHP常用函式歸類【持續整理】PHP函式
- oracle 系統自帶幾個常用函式Oracle函式
- Shell中常用的系統函式basename和dirname函式
- 核心函式 系統呼叫 系統命令 庫函式函式
- Mysql 常用函式(1)- 常用函式彙總MySql函式
- 常用函式函式
- 工具歸納
- MySQL函式大全(字串函式,數學函式,日期函式,系統級函式,聚合函式)MySql函式字串
- Mysql 常用函式(20)- ceiling 函式MySql函式
- Mysql 常用函式(15)- upper 函式MySql函式
- 動作遊戲戰鬥系統總結歸納&思考(中)遊戲
- MySQL 常用函式MySql函式
- kotlin常用函式Kotlin函式
- js 常用函式JS函式
- Oracle常用函式Oracle函式
- 常用函式整理函式
- TensorFlow常用函式函式
- PHP 常用函式PHP函式
- QT常用函式QT函式
- 常用助手函式函式
- loadrunner常用函式函式
- PHP常用函式PHP函式
- MySQL 常用函式。MySql函式
- 常用函式集合函式
- 微軟程式歸納新技術:元程式歸納微軟
- 使用Java+SAP雲平臺+SAP Cloud Connector呼叫ABAP On-Premise系統裡的函式JavaCloudREM函式
- Hive常用函式及自定義函式Hive函式
- 核函式 多項式核函式 高斯核函式(常用)函式
- openpyxl淺歸納
- 動作遊戲戰鬥系統框架總結歸納&思考(上)遊戲框架
- 15個常用excel函式公式 excel函式辦公常用公式Excel函式公式
- javascript常用函式大全JavaScript函式
- PHP常用函式篇PHP函式
- Js常用的函式JS函式
- Carbon 類常用函式函式
- Hyperf 常用助手函式函式
- 常用啟用函式函式