标准常用方法总结
标准常用方法总结
Convert
CONVERSION_EXIT_ALPHA_INPUT
converts any number into a string fill with zeroes, with the number at the extreme right
Example:
input = 123
output = 0000000000000…000000000000123CONVERSION_EXIT_ALPHA_OUTPUT
converts any number with zeroes right into a simple integer
Example:
input = 00000000000123
output = 123CONVERT_ABAPSPOOLJOB_2_PDF
convert abap spool output to PDFCONVERT_OTF
Convert SAP documents (SAPScript) to other types.
Example:CALL FUNCTION “CONVERT_OTF” EXPORTING FORMAT = “PDF” IMPORTING BIN_FILESIZE = FILE_LEN TABLES OTF = OTFDATA LINES = PDFDATA EXCEPTIONS ERR_MAX_LINEWIDTH = 1 ERR_FORMAT = 2 ERR_CONV_NOT_POSSIBLE = 3 OTHERS = 4.
CONVERT_OTFSPOOLJOB_2_PDF
converts a OTF spool to PDF (i.e. Sapscript document)CONVERT_TO_FOREIGN_CURRENCY
Convert local currency to foreign currency.CONVERT_TO_LOCAL_CURRENCY
Convert from foreign currency to local currency
File
EPS_GET_DIRECTORY_LISTING
return a list of filenames from a local or network driveEPS_GET_FILE_ATTRIBUTES
Pass in a filename and a path, and will return attributes for the fileFILENAME_GET
popup to get a filename from a user, returns blank filename if user selects cancelDOWNLOAD
download a file to the presentation server (PC)
APPL_LOG
APPL_LOG_DELETE
通过该功能模块,您可以根据指定的选择条件删除数据库中的日志APPL_LOG_DISPLAY
通过该功能模块,可以对数据库中的日志进行分析。APPL_LOG_DISPLAY_INTERN
使用此功能模块,您可以在本地内存中分析日志,例如,当您仅在运行时收集日志记录并且不想写入数据库时。APPL_LOG_INIT
该功能模块检查指定的对象或子对象是否存在,并删除本地内存中所有存在的关联数据APPL_LOG_READ_DB
使用此功能模块,您可以根据指定的选择条件从数据库中读取对象或子对象的日志数据。APPL_LOG_READ_INTERN
使用此功能模块,您可以从本地内存中读取指定对象或子对象的日志类至少具有指定值的所有日志数据。APPL_LOG_SET_OBJECT
使用此函数模块,您可以创建一个新对象或子对象,以便在本地内存中进行写入。通过一个标志,您可以控制APPL_LOG_WRITE_…消息是写入本地内存还是输出到屏幕上。APPL_LOG_WRITE_DB
使用此函数模块,您可以将本地内存中指定对象或子对象的所有数据写入数据库。如果所讨论的对象或子对象的日志是新的,则将日志号返回给调用程序。APPL_LOG_WRITE_HEADER
使用这个功能模块,您可以将日志头数据写入本地内存。APPL_LOG_WRITE_LOG_PARAMETERS
使用此功能模块,您可以在本地内存中为指定对象或子对象写入日志参数的名称和相关值。如果为同一对象或子对象重复调用此函数模块,则会相应地更新现有参数。如果没有使用调用指定对象或子对象,则假定最近使用的对象。APPL_LOG_WRITE_MESSAGE_PARAMS
使用此函数模块,您可以在本地内存中编写带有参数的单个消息。否则,函数模块就像APPL_LOG_WRITE_SINGLE_MESSAGE一样工作。APPL_LOG_WRITE_MESSAGES
With this function module you write one or more messages, without parameters, in local memory.APPL_LOG_WRITE_SINGLE_MESSAGE
With this function module you write a single message, without parameters, in local memory. If no header entry has yet been written for the object or sub-object, it is created. If you do not specify an object or sub-object with the call, the most recently used is assumed.
BAL_LOG
BAL_CNTL_CREATE
Create Control for log displayBAL_CNTL_FREE
Release ControlBAL_CNTL_REFRESH
Put new data in log displayBAL_DB_DELETE
Delete logs from the databaseBAL_DB_DEQUEUE
Unlock logBAL_DB_ENQUEUE
Lock logBAL_DB_LOAD
Load logs from the databaseBAL_DB_LOAD
Load log(s)BAL_DB_SAVE
Save logs in the databaseBAL_DB_SAVE
Save log(s)BAL_DB_SAVE_PREPARE
Prepare saveBAL_DB_SEARCH
Find logs in the databaseBAL_DSP_LOG_DISPLAY
Display messages in memoryBAL_DSP_LOG_DISPLAY
Display LogBAL_DSP_LOG_PARAMETERS
Either output extended long text or call a callback routine (based on the data in BAL_S_LOG-PARAMS)BAL_DSP_LOG_TECHNICAL_DATA
Output all log header dataBAL_DSP_MSG_LONGTEXT
Display message long textBAL_DSP_MSG_PARAMETERS
Either output extended long text or call a callback routine (based on the data in BAL_S_MSG-PARAMS)BAL_DSP_MSG_TECHNICAL_DATA
Output technical data of a message such as work area, error number, etc.BAL_DSP_OUTPUT_FREE
End outputBAL_DSP_OUTPUT_INIT
Initialize outputBAL_DSP_OUTPUT_SET_DATA
Set dataset to be displayedBAL_DSP_PROFILE_DETLEVEL_GET
Message hierarchy in DETLEVELBAL_DSP_PROFILE_NO_TREE_GET
Display without tree (fullscreen)BAL_DSP_PROFILE_POPUP_GET
Display without tree (popup)BAL_DSP_PROFILE_SINGLE_LOG_GET
Standard profile (SLG1) for one logBAL_DSP_PROFILE_STANDARD_GET
Standard profile (SLG1) for a lot of logsBAL_GLB_AUTHORIZATION_GET
Assign authorizationBAL_GLB_AUTHORIZATION_RESET
Reset authorizationBAL_GLB_CONFIG_GET
Read configurationBAL_GLB_CONFIG_SET
Set configurationBAL_GLB_MEMORY_EXPORT
Put function group memory in ABAP-MEMORYBAL_GLB_MEMORY_IMPORT
Get function group memory from ABAP-MEMORYBAL_GLB_MEMORY_REFRESH
(Partially) reset global memoryBAL_GLB_MEMORY_REFRESH
(Partially) initialize memoryBAL_GLB_MSG_CURRENT_HANDLE_GET
Get current message handleBAL_GLB_MSG_DEFAULTS_GET
Get message defaultsBAL_GLB_SEARCH_LOG
Find logs in memoryBAL_GLB_SEARCH_MSG
Find messages in memoryBAL_LOG_CREATE
Create log with header dataBAL_LOG_CREATE
Create log with header dataBAL_LOG_DELETE
Delete log (from database also at Save)BAL_LOG_EXIST
Check existence of a log in memoryBAL_LOG_HDR_CHANGE
Change log headerBAL_LOG_HDR_CHECK
Check log header data for consistencyBAL_LOG_HDR_READ
Read log header and other dataBAL_LOG_MSG_ADD
Put message in logBAL_LOG_MSG_ADD
Put message in logBAL_LOG_MSG_CHANGE
Change messageBAL_LOG_MSG_CHANGE
Change messageBAL_LOG_MSG_CHECK
Check message data for consistencyBAL_LOG_MSG_CUMULATE
Add message cumulatedBAL_LOG_MSG_DELETE
Delete messageBAL_LOG_MSG_DELETE
Delete messageBAL_LOG_MSG_EXIST
Check existence of a message in memoryBAL_LOG_MSG_READ
Read message and other dataBAL_LOG_MSG_REPLACE
Replace last messageBAL_LOG_REFRESH
Delete log from memoryBAL_LOG_REFRESH
Delete log from memoryBAL_MSG_DISPLAY_ABAP
Output message as ABAP-MESSAGEBAL_OBJECT_SELECT
Read Application Log objects table recordBAL_OBJECT_SUBOBJECT
Check whether object and subobject exist and the combination is allowedBAL_SUBOBJECT_SELECT
Read subobject table record
Date(日期)
RP_CALC_DATE_IN_INTERVAL
日期计算LAST_DAY_OF_MONTHS
查询某月的最后一天CCM_GO_BACK_MONTHS
返回指定月以前的日期
1.HR_HK_DIFF_BT_2_DATES
计算两个日期键的天数(不排除节假日)
DATE_CHECK_PLAUSIBILITY
Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.DATE_COMPUTE_DAY
Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.DATE_GET_WEEK
will return the week that a date is in.DATE_IN_FUTURE
Calculate a date N days in the future.DAY_ATTRIBUTES_GET
Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuedsay), whether the day is a holiday, and more.(provided by Francois Henrotte)
F4
F4IF_SHLP_EXIT_EXAMPLE
documents the different reasons to use a search help exit, and shows how it is done.F4IP_INT_TABLE_VALUE_REQUEST
此函数在4.6及以上版本中不存在。使用F4IF_INT_TABLE_VALUE_REQUEST代替。F4_DATE
displays a calendar in a popup window and allows user to choose a date, or it can be displayed read only.F4_IF_FIELD_VALUE_REQUEST
Use values from a DDIC table to provide a list of possible values. TABNAME and FIELDNAME are required fields, and when MULTIPLE_CHOICE is selected, more than one value can be returned.F4IF_INT_TABLE_VALUE_REQUEST
F4 help that returns the values selected in an internal table. Very handy when programming your very own F4 help for a field.
FTP
FTP_COMMAND
在FTP服务器上执行命令FTP_CONNECT
打开连接(并登录)到FTP服务器FTP_DISCONNECT
关闭连接(并注销)FTP服务器
ABAP文档
- ABAP_DOCU_DOWNLOAD
下载HTML格式的ABAP文档
系统信息
- ARFC_GET_TID
will return the IP address of the terminal in hex.
常用算术运算函数
- ABS:返回输入参数的绝对值
- TRUNC:返回输入参数的整数部分
- FRAC:返回输入参数的小数部分
- STRLEN:获取字符串长度函数
其他
BP_EVENT_RAISE
Trigger an event from ABAP/4 programBP_JOBLOG_READ
Fetch job log executionsCHANGEDOCUMENT_READ_HEADERS
Get the change document header for a sales document, and put the results in an internal table.
Example:
CALL FUNCTION ‘CHANGEDOCUMENT_READ_HEADERS’
EXPORTING
objectclass = ‘EINKBELEG’
objectid = l_objectid
username = space
TABLES
i_cdhdr = lt_cdhdr.
LOOP AT lt_cdhdr WHERE udate IN s_aedat.
CALL FUNCTION ‘CHANGEDOCUMENT_READ_POSITIONS’
EXPORTING
changenumber = lt_cdhdr-changenr
TABLES
editpos = lt_editpos.
LOOP AT lt_editpos WHERE fname = ‘LOEKZ’
AND f_new = ‘L’.
p_desc = text-r01. ” Cancel Contract
ENDLOOP.
ENDLOOP.
- CHANGEDOCUMENT_READ_POSITIONS
Get the details of a change document, and store them in an internal table. This will tell you whether a field was changed, deleted, or updated.
Example:
CALL FUNCTION ‘CHANGEDOCUMENT_READ_HEADERS’
EXPORTING
objectclass = ‘EINKBELEG’
objectid = l_objectid
username = space
TABLES
i_cdhdr = lt_cdhdr.
LOOP AT lt_cdhdr WHERE udate IN s_aedat.
CALL FUNCTION ‘CHANGEDOCUMENT_READ_POSITIONS’
EXPORTING
changenumber = lt_cdhdr-changenr
TABLES
editpos = lt_editpos.
LOOP AT lt_editpos WHERE fname = ‘LOEKZ’
AND f_new = ‘L’.
p_desc = text-r01. ” Cancel Contract
ENDLOOP.
ENDLOOP.
CLAF_CLASSIFICATION_OF_OBJECTS
Return all of the characteristics for a materialCLOI_PUT_SIGN_IN_FRONT
Move the negative sign from the left hand side of a number, to the right hand side of the number. Note that The result will be left justified (like all character fields), not right justifed as numbers normally are.CLPB_EXPORT
Export a text table to the clipboard (on presentation server)CLPB_IMPORT
Import a Text Table from the Clipboard (on presentation server)COMMIT_TEXT
To load long text into SAPDYNP_VALUES_READ
Read the values from a dynpro. This function can be used to read the values from a report’s selection screen too (Another example).DYNP_VALUES_UPDATE
Similar to DYNP_VALUES_READ, this function will allow the updating of fields on a dynpro. Very useful when you want to change a field based on the value entered for another field.ENQUE_SLEEP
Wait a specified period of time before continuing processing.ENQUEUE_ESFUNCTION
Lock an abap program so that it cannot be executed.
Example:
Set the parameters as follows:
RELID = ‘ZZ’
SRTF2 = 0
SRTF = (your report name)
Please note that you should not use SY-REPID to pass your report name to the function. The value of SY-REPID will change as it is being passed to the function module, and will no longer hold the value of the calling report.FORMAT_MESSAGE
获取消息id和号码,并将其放入一个变量中。比WRITE_MESSAGE工作得更好,因为一些消息使用$作为占位符,而WRITE_MESSAGE不支持这一点,它只替换消息中的&符号。FU CSAP_MAT_BOM_READ
您可以使用此功能模块显示简单的物料bom。不能显示BOM组(例如,一个变体BOM的所有变体)。如事务CS03。当前限制:不能显示长文本。不能显示子项。不能批量显示BOM分类数据。您只能显示一个替代或变体。您不能为模块CSAP_MAT_BOM_READ输入替代选项,因此您总是看到替代选项01。下面的例子来自SAP-R3-L邮件列表上的帖子。
data:
begin of t_values occurs 2,
value like kna1-begru,
end of t_values,
t_return like ddshretval occurs 0 with header line.
t_values = ‘PAR*’.
append t_values.
t_values = ‘UGG’.
append t_values.
call function ‘F4IF_INT_TABLE_VALUE_REQUEST’
exporting
retfield = ‘BEGRU’
value_org = ‘S’
tables
value_tab = t_values
return_tab = t_return
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc = 0.
read table t_return index 1.
o_begru-low = t_return-fieldval.
if o_begru-low = ‘PAR*’.
o_begru-option = ‘CP’.
else.
o_begru-option = ‘EQ’.
endif.
o_begru-sign = ‘I’.
append o_begru to s_begru.
else.
o_begru = i_begru.
endif.