Function
很多經(jīng)常用到的函數(shù) ,希望對(duì)大家有幫助.
?
Funtion:DDIF_FIELDINFO_GET
功能:獲得字段的相關(guān)信息
參數(shù):
Import:
TABNAME:數(shù)據(jù)庫表的名字
FIELDNAME:無需指定,由LFIELDNAME代替了
LANGU: 語言設(shè)定,默認(rèn)sy-langu
LFIELDNAME:指定關(guān)聯(lián)字段
ALL_TYPES:是否指定所有類型
GROUP_NAMES:是否包含include的字段
UCLEN:沒用過,應(yīng)該是和unicode相關(guān)的
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:域的固定值
說明:該函數(shù) 可用來獲得某個(gè)表或者結(jié)構(gòu)或者視圖等所有字段的相關(guān)信息,所以如果想用alv來維護(hù)某個(gè)表的時(shí)候,對(duì)設(shè)定field catalog有幫助。
Funtion:DDIF_NAMETAB_GET
功能:獲得字段的相關(guān)信息(不包含text)
參數(shù):
Import:
TABNAME:數(shù)據(jù)庫表的名字
LFIELDNAME:指定關(guān)聯(lián)字段
ALL_TYPES:是否指定所有類型
GROUP_NAMES:是否包含include的字段
UCLEN:沒用過,應(yīng)該是和unicode相關(guān)的
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_TABL_GET
功能:獲得表的相關(guān)信息
參數(shù):
Import:
NAME:數(shù)據(jù)庫表的名字
STATE:狀態(tài)
STATE = ‘A’ (read the active version)
STATE = ‘M’ (read the latest version)
LANGU: 語言設(shè)定,默認(rèn)sy-langu
Export:
GOTSTATE:狀態(tài)信息
DD02V_WA:表頭
DD09L_WA:表表的技術(shù)信息
Tables:
DD03P_TAB:表的字段列表
DD05M_TAB:表的外鍵字段
DD08V_TAB:表的外鍵
DD12V_TAB:表索引
DD17V_TAB:表的索引字段
DD35V_TAB:檢索help相關(guān)
DD36M_TAB:檢索help相關(guān)
Funtion:POPUP_TO_DECIDE_LIST
功能:彈出供選擇窗口,最多25個(gè)選項(xiàng),選擇可以是單選按鈕也可以是復(fù)選按鈕,可以設(shè)定最多選擇的個(gè)數(shù)。
參數(shù):
Import:
CURSORLINE? :默認(rèn)光標(biāo)所在行
MARK_FLAG:選擇的標(biāo)志,一般設(shè)為‘X’
MARK_MAX: 最大選擇的選項(xiàng)個(gè)數(shù)
START_COL:起始行
START_ROW? :起始列,用來定位彈出窗口的位置
TEXTLINE1:文本行
TEXTLINE2:文本行
TEXTLINE3 :文本行
TITEL:彈出窗口的標(biāo)題
DISPLAY_ONLY:僅顯示
Export:
ANSWER:A:取消? 空:做了選擇
Tables:
T_SPOPLI:選擇結(jié)果
例子:
REPORT? Z_BOBO????????????????????????????????? .
* 定義函數(shù) 需要的變量
DATA: BEGIN OF SPOPLIST OCCURS 15.
INCLUDE STRUCTURE SPOPLI.
DATA: END?? OF SPOPLIST.
DATA: ANTWORT TYPE C.
* 添加選擇參數(shù)
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.
SYSTEM-CALL:DY_GET_FOCUS
說明:獲得屏幕焦點(diǎn)
參數(shù):
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.
SYSTEM-CALL:DY_GET_SET_FIELD_VALUE
說明:獲得或者設(shè)置屏幕字段的值
參數(shù):
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.
例子:我做了一個(gè)檢索help的exit,例如屏幕上有兩個(gè)字段,我按了一個(gè)字段的檢索help,那么根據(jù)這個(gè)字段就會(huì)取得相應(yīng)的另外一個(gè)字段的值,然后把這個(gè)之設(shè)置到第二個(gè)字段。
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.
Function:F4IF_INT_TABLE_VALUE_REQUEST
功能:顯示檢索help
參數(shù):
Import:
DDIC_STRUCTURE:返回table的結(jié)構(gòu):
‘s’:VALUE_TAB的結(jié)構(gòu)
‘c’:VALUE_TAB只有一個(gè)字段
RETFIELD:返回的字段名稱————必輸
DYNPPROG:當(dāng)前程序
DYNPNR:? 屏幕號(hào)
DYNPROFIELD:屏幕上需要檢索help的字段名稱
WINDOW_TITLE:檢索help的標(biāo)題
VALUE_ORG:檢索help屏幕顯示屬性:
‘c’:cell by cell
‘s’:structured
CALLBACK_PROGRAM:在f4之前調(diào)用的程序
CALLBACK_FORM:在f4之前調(diào)用的程序里面的form名稱,形式如下
FORM <NAME> TABLES RECORD_TAB STRUCTURE SEAHLPRES
CHANGING SHLP TYPE SHLP_DESCR
CALLCONTROL LIKE DDSHF4CTRL.
Export:
USER_RESET:如果沒有選擇(按紅x),返回‘x’
Tables:
VALUE_TAB:傳進(jìn)去的表———–必輸
FIELD_TAB:Fields of the hit list(暫時(shí)沒用)
RETURN_TAB:返回值表,即如果選擇了而沒有寫到屏幕上的值存在這個(gè)表中。
DYNPFLD_MAPPING:把屏幕上需要help的字段可以放在這個(gè)表中。
推測(cè):如果屏幕上有多個(gè)字段關(guān)聯(lián),那么只作一個(gè)help的話,這個(gè)應(yīng)該可以滿足。
例子:
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,?? “地名/番地-號(hào)
ORT01 TYPE T001W-ORT01,?? “市區(qū)町村名
END OF T_S_WERKS.
TYPES? T_I_WERKS TYPE STANDARD TABLE OF T_S_WERKS.
*這個(gè)就是value_tab
DATA?? L_IT_WERKS TYPE T_I_WERKS.
*取數(shù)據(jù)
SELECT WERKS??? “プラント
NAME1??? “名稱
NAME2??? “名稱 2
STRAS??? “地名/番地-號(hào)
ORT01??? “市區(qū)町村名
FROM T001W
INTO CORRESPONDING FIELDS OF TABLE L_IT_WERKS.
*調(diào)用函數(shù)
CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
EXPORTING
RETFIELD?????????????????? = ‘WERKS’??? “plant
DYNPPROG???????????????? = SY-REPID?? “程序名
DYNPNR????????????????????? = SY-DYNNR?? “屏幕號(hào)
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
Function: READ_TEXT/CREATE_TEXT
功能:讀取長(zhǎng)文本/創(chuàng)建長(zhǎng)文本
參數(shù):
Import:
CLIENT:集團(tuán)
ID:文本ID(TTXID中定義)
LANGUAGE:語言
NAME:文本名字()
OBJECT:文本對(duì)象(TTXOB中定義)
Export:
HEADER:文本的描述信息
Tables:
LINES:文本內(nèi)容
例子:讀取銷售訂單頭文本
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
功能:根據(jù)語言決定單位的顯示
參數(shù):
Import:
INPUT:內(nèi)部單位顯示方式
LANGUAGE:語言代碼
Export:
LONG_TEXT:單位的長(zhǎng)文本
OUTPUT:外部單位顯示方式
SHORT_TEXT:單位的短文本
例子:單位顯示轉(zhuǎn)換
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
功能:全角轉(zhuǎn)換為半角
參數(shù):
Import:
ALL:全部轉(zhuǎn)換
ALPHABET_UPPER:A-Z轉(zhuǎn)換
ALPHABET_LOWER:a-z轉(zhuǎn)換
NUMERIC:0-9轉(zhuǎn)換
Export:
CONVERTED:轉(zhuǎn)換的字符個(gè)數(shù)
Changing:
TEXT:轉(zhuǎn)換結(jié)果
Function: SJIS_SBC_TO_DBC
功能:半角轉(zhuǎn)換為全角
參數(shù):
Import:
ALL:全部轉(zhuǎn)換
ALPHABET_UPPER:A-Z轉(zhuǎn)換
ALPHABET_LOWER:a-z轉(zhuǎn)換
NUMERIC:0-9轉(zhuǎn)換
Export:
CONVERTED:轉(zhuǎn)換的字符個(gè)數(shù)
Changing:
TEXT:轉(zhuǎn)換結(jié)果
Function: CO_R0_CHECK_DECIMAL_POINT
功能:根據(jù)單位檢查數(shù)據(jù)的小數(shù)位
參數(shù):
Import:
I_QUANTITY:數(shù)量
I_UNIT:單位
例子:下面的例子會(huì)返回錯(cuò)誤信息,以為單位ST是不能有小數(shù)位的。
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
功能:檢查郵政編碼
參數(shù):
Import:
COUNTRY:國家(T005)———-必輸
ONE_TIME_ACCOUNT:不明確
POSTAL_CODE:郵政編碼
POSTAL_CODE_PO_BOX:沒用過,以下為推測(cè):如果輸入則會(huì)檢查,如果t005表中的XPLPF設(shè)置了,那么如果輸入PO_BOX,這個(gè)選項(xiàng)就必須輸入。
PO_BOX:沒用過
REGION:區(qū)域
Export:
POSTAL_CODE:郵編
EV_POSTAL_CODE:郵編的格式
EV_POSTAL_CODE_PO_BOX:沒用過
Funtion:CONVERSION_EXIT_ALPHA_INPUT
功能:全數(shù)字則在前面補(bǔ)0
參數(shù):
Import:
INPUT:輸入的字符串
Export:
OUTPUT:輸出的字符串
Funtion:CONVERSION_EXIT_ALPHA_OUTPUT
功能:和上面相反
Funtion:GET_JOB_RUNTIME_INFO
功能:獲得job相關(guān)信息
參數(shù):
Export:
EVENTID:后臺(tái)處理的事件id
EVENTPARM:后臺(tái)事件的參數(shù)(例如,job id,job名字)
TERNAL_PROGRAM_ACTIVE:沒用過
JOBCOUNT:job id
JOBNAME:job 名稱
Funtion:TERMINAL_ID_GET
功能:獲得端末id
參數(shù):
Import:
USERNAME:用戶名
Export:
TERMINAL:terminal id
Funtion:DATE_CONVERT_TO_FACTORYDATE
功能:把輸入日期轉(zhuǎn)為工廠日歷日期
參數(shù):
Import:
CORRECT_OPTION:表示工作日計(jì)算方式的標(biāo)記
DATE:必須轉(zhuǎn)化為工廠日歷日期的日期
FACTORY_CALENDAR_ID:工廠日歷 ID
Export:
DATE:必須轉(zhuǎn)化為工廠日歷日期的日期
FACTORYDATE:指定日歷中的工作日數(shù)
WORKINGDAY_INDICATOR:表示某日期是否為工作日的標(biāo)志
例子:
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
功能:把消息轉(zhuǎn)為文本
參數(shù):
Import:
MSGID:消息id
MSGNR:消息號(hào)
MSGV1:參數(shù)1
MSGV2:參數(shù)2
MSGV3:參數(shù)3
MSGV4:參數(shù)4
Export:
MESSAGE_TEXT_OUTPUT:輸出的字符串
說明:可以用write <message> to <text>代替
Function: POPUP_TO_CONFIRM
Group:SPO1
功能:彈出確認(rèn)窗口
參數(shù):
Import:
TITLEBAR:彈出窗口的標(biāo)題,最多40位
TEXT_QUESTION:問題,最長(zhǎng)80位,多出來的截?cái)?br /> TEXT_BUTTON_1:第一按鈕的text,最長(zhǎng)8位
ICON_BUTTON_1:第一按鈕顯示的icon
TEXT_BUTTON_2:第二按鈕的text,最長(zhǎng)8位
ICON_BUTTON_2:第二按鈕顯示的icon
DEFAULT_BUTTON:默認(rèn)的按鈕
DISPLAY_CANCEL_BUTTON:是否顯示取消
POPUP_TYPE:彈出的類型: 決定顯示的icon
ICON_MESSAGE_QUESTION :問題
ICON_MESSAGE_INFORMATION:信息
ICON_MESSAGE_WARNING:警告
ICON_MESSAGE_ERROR:錯(cuò)誤
ICON_MESSAGE_CRITICAL:沖突
START_COLUMN:彈出位置:列
START_ROW:彈出位置:行
IV_QUICKINFO_BUTTON_1:第一按鈕的顯示信息(鼠標(biāo)放上去后看到的)
IV_QUICKINFO_BUTTON_2:第二按鈕的顯示信息(鼠標(biāo)放上去后看到的)
Export:
ANSWER:返回點(diǎn)擊的按鈕
’1′ :第一個(gè)按鈕
’2′ :第二個(gè)按鈕
‘A’ :取消按鈕
Function: CS_BOM_EXPL_MAT_V2
功能:BOM展開
參數(shù):
Import:
CAPID:application id
DATUV:有效開始日
EMENG:數(shù)量
MTNRV:物料
MEHRS:多階層bom展開
WERKS:工廠
STLAN:bom用途
Tables:
STB:展開明細(xì)
說明:一般定義上面幾個(gè)參數(shù)就可以了,鑒于該函數(shù) 參數(shù)太多,就不一一說明了
Function: CLOI_PUT_SIGN_IN_FRONT
功能:將負(fù)號(hào)提前
參數(shù):
Changing:
VALUE:需要負(fù)號(hào)提前的變量
Function: EPS_GET_DIRECTORY_LISTING
功能:獲得某路徑下的文件列表
參數(shù):
Import:
DIR_NAME:需要 查找 的路徑
FILE_MASK:沒用過
Export:
DIR_NAME:文件路徑
FILE_COUNTER:文件個(gè)數(shù)
ERROR_COUNTER:錯(cuò)誤的個(gè)數(shù)
Tables:
DIR_LIST:文件列表
說明:這個(gè)函數(shù) 可以獲得服務(wù)器某個(gè)路徑下的所有文件,對(duì)open dataset for read file中file名字的獲得有幫助。
Function: BAPI_COMPANYCODE_GET_PERIOD
功能:獲得公司的會(huì)計(jì)年度以及過賬日期
參數(shù):
Import:
COMPANYCODEID:公司代碼
POSTING_DATE:posting date
Export:
FISCAL_YEAR:會(huì)計(jì)年度
FISCAL_PERIOD:財(cái)務(wù)期間
RETURN:返回值
說明:該函數(shù) 可用來檢查會(huì)計(jì)期間。
Function: MARA_SINGLE_READ
功能:讀取物料信息
參數(shù):
Import:
KZRFB:Indicator: Refresh buffer entry
MAXTZ:Max. no. of entries in buffer(這兩個(gè)參數(shù)應(yīng)該和性能優(yōu)化相關(guān))
MATNR:物料號(hào)
SPERRMODUS:Lock mode (none, shared, excl.)
STD_SPERRMODUS:Standard lock mode (if different)(鎖相關(guān))
OUTPUT_NO_MESSAGE:是否輸出消息
Export:
WMARA:返回的物料信息
說明:該函數(shù) 可用于性能優(yōu)化,例如無法避免在loop中有sql的情況可以用該函數(shù) 取代sql。
對(duì)mara的其它操作參考function group:MG21
Function: KNA1_SINGLE_READ
功能:讀取customer表信息
參數(shù):
Import:
KZRFB:Indicator: Refresh buffer entry
KNA1_KUNNR:customer code
Export:
WKNA1:返回的信息
說明:還有很多表的讀取參考function group:MG41
Function: ADDR_GET_COMPLETE_ALL_TYPES
功能:獲得地址的相關(guān)信息
參數(shù):
Import:
ADDRNUMBER:address number
PERSNUMBER:個(gè)人信息
ADDRESS_OBJECT_TYPE:類型 1:組織 2:個(gè)人 3:客戶
Export:
ADDR1_COMPLETE:地址1
ADDR2_COMPLETE:地址2
ADDR3_COMPLETE:地址3
ADDR1_COMPLETE_BAPI:地址1
ADDR2_COMPLETE_BAPI:地址2
ADDR3_COMPLETE_BAPI:地址3(以上三個(gè)bapi用)
Function: READ_VBFA
功能:取得document flow(省得select了)
參數(shù):
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來優(yōu)化性能
Function: SD_VBAK_SINGLE_READ
功能:讀取銷售訂單表頭信息
參數(shù):
Import:
I_VBELN:銷售訂單
I_BYPASSING_BUFFER:是否用buffer
I_REFRESH_BUFFER:刪除buffer?
Export:
E_VBAK:返回表頭信息
說明:讀相關(guān)sd表的函數(shù) 請(qǐng)參考function group:V45I
Function: LIKP_READ
功能:Delivery Header Data
參數(shù):
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
說明:有關(guān)讀取delivery的信息請(qǐng)參考function group:LMGT
Function: CREATE_SAP_SHORTCUT
功能:創(chuàng)建快捷方式
參數(shù):
Import:
SC_COMMAND:指定的tcode
SC_TITLE:快捷方式名字:例如:se38
SC_TYPE:快捷方式類型:有三種:’report’,’ transaction’,’ system command’
NO_DIALOG:是否彈出窗口
說明:具體沒什么用,做著玩玩。
Function: SAPGUI_PROGRESS_INDICATOR
功能:顯示進(jìn)度
參數(shù):
Import:
PERCENTAGE:進(jìn)度的百分?jǐn)?shù),>0,<100.
TEXT:文本
說明:在運(yùn)行時(shí)間很長(zhǎng)的程序中可以選擇使用,這樣保證了程序不會(huì)中止。當(dāng)然也可以在rz10里面設(shè)置程序運(yùn)行時(shí)間,不過比較麻煩。
Funtion:K_GROUP_SELECT
功能:利潤(rùn)中心組的檢索help
參數(shù):
Import:
BUTTONS:按鈕,決定是否可以選擇group類型
CLASS? :cost center class
CRUSER:創(chuàng)建人
FIELD_NAME:字段名稱:此項(xiàng)為必輸項(xiàng)
SEARCHFLD:還沒用過
SEARCHFLD_INPUT:成本控制范圍是否可以輸入(參照?qǐng)D1)
SEARCHFLD_REQUIRED:成本控制范圍是否必輸,如果設(shè)置為不可輸入,
那么這個(gè)參數(shù)無效(參考圖2)
SET:利潤(rùn)中心組的開頭字母
START_COLUMN:彈出窗口的位置
START_ROW? :彈出窗口的位置
TABLE:表或者結(jié)構(gòu)的名稱
Export:
SET_NAME:取得幫助字段的值
例子
*&———————————————————————
*& Report? Z_BOBO_20060228??????????????????????????????????????? *
*&———————————————————————*
*& 彈出窗口,利潤(rùn)中心組的幫助,這樣就省得f4_value_request了? *????????????????????????????????????????????????????????????????????????? *
*&———————————————————————*
REPORT? Z_BOBO_20060228???????????????????????? .
DATA : W_PRCGC1(15)???? TYPE C.
DATA : W_SETNAME(15)??? TYPE C.
SELECT-OPTIONS : S_PRCGC? FOR? W_PRCGC1.???? ” 利潤(rùn)中心組
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PRCGC-LOW.
CALL FUNCTION ‘K_GROUP_SELECT’
EXPORTING
BUTTONS????????????? = ‘X’
CLASS????????????????? = ’0106′
FIELD_NAME????????? = ‘RPRCTR’
SEARCHFLD_INPUT? = ‘X’
SEARCHFLD_REQUIRED = ‘X’
SET??????????????????????? = ‘@’
TABLE???????????????????? = ‘CCSS’
IMPORTING
SET_NAME??????????????? = W_SETNAME
EXCEPTIONS
NO_SET_PICKED????? = 1
OTHERS??????????????? = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*???????? WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
S_PRCGC-LOW? = W_SETNAME.
ENDIF.
START-OF-SELECTION.
WRITE: ‘TEST BOBO’.
function:SD_VBAP_READ_WITH_VBELN
功能:根據(jù)銷售訂單讀取表vbap中的信息
參數(shù):
import:I_VBELN????????????????????????? 訂單號(hào)(必輸項(xiàng))
I_BYPASSING_BUFFER???? 是否回避buffer
I_REFRESH_BUFFER???????? 是否清空buffer
tables:ET_VBAPVB??????????????????????? 不清楚其意義
ET_VBAP??????????????????????????? vbap表
form:EDIT_LINES
功能:把READ_TEXT返回的LINES中的行按照TDFORMAT=“*”重新組織
原因:如果用CREATE_TEXT登錄的長(zhǎng)文本不存在該問題,如果是在前臺(tái)業(yè)務(wù)登錄的text,那么存到數(shù)據(jù)庫的時(shí)候會(huì)在72位的地方換行,在lines這個(gè)表中的TDFORMAT設(shè)置為空,導(dǎo)致READ_TEXT返回的表中的行數(shù)也許不是你需要的行數(shù)。
代碼:
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
function:VIEW_MAINTENANCE_CALL
功能:維護(hù)表視圖等
The function module calls the extended table maintenance (View maintenance).
參數(shù):
import:ACTION?????? S = Display U = Change T = Transport
CORR_NUMBER? 傳送號(hào)(上面的action是t)
SHOW_SELECTION_POPUP?? 是否彈出選擇畫面
VIEW_NAME??? 視圖名
NO_WARNING_FOR_CLIENTINDEP? 跨集團(tuán)是否現(xiàn)實(shí)警告
VARIANT_FOR_SELECTION?? 變式名
CHECK_DDIC_MAINFLAG???? 察看是否為可維護(hù)對(duì)象
總結(jié)
- 上一篇: abap 在table control(
- 下一篇: ABAP Memory/SAP Memo