sap里部分函数说明

本文介绍了众多SAP相关的函数模块及其功能,涵盖文件下载、日期处理、数据转换、FTP操作、GUI操作等多个方面。如ABAP_DOCU_DOWNLOAD可下载HTML格式的ABAP文档,CONVERSION_EXIT_ALPHA_INPUT能将数字转换为右补零的字符串等。

ABAP_DOCU_DOWNLOAD  - Download ABAP documentation in HTML format.

ARFC_GET_TID  - will return the IP address of the terminal in hex.  

BAL_*  - All function modules used for SAP's application logging can be found here.

BP_EVENT_RAISE  - Trigger an event from ABAP/4 program

BP_JOBLOG_READ  - Fetch job log executions

CLOI_PUT_SIGN_IN_FRONT  - Place the negative sign after a number.  SAP default is place the negative sign after the number.

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 SAP

CONVERSION_EXIT_ALPHA_INPUT  - converts any number into a string fill with zeroes-right

example:

input = 123

output = 0000000000000...000000000000123

CONVERSION_EXIT_ALPHA_OUTPUT  - converts any number with zeroes-right into a simple integer

example:

input = 00000000000123

output = 123

CONVERT_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.

DATE_GET_WEEK  - will return the week that a date is in.

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.

DOWNLOAD  - download a file to the presentation server (PC)

DYNP_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.  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.

EPS_GET_FILE_ATTRIBUTES  - Pass in a filename and a path, and will return attributes for the file

EPS_GET_DIRECTORY_LISTING  - return a list of filenames from a local or network drive

F4_DATE  - displays a calendar in a popup window and allows user to choose a date, or it can be displayed read only.

F4IF_SHLP_EXIT_EXAMPLE  - documents the different reasons to use a search help exit, and shows how it is done.

FILENAME_GET  - popup to get a filename from a user, returns blank filename if user selects cancel

FTP _CONNECT  - Open a connection (and log in) to an FTP server

FTP _COMMAND  - Execute a command on the FTP server

FTP _DISCONNECT  - Close the connection (and log off) the FTP server

FORMAT_MESSAGE  - Takes a message id and number, and puts it into a variable. Works better than WRITE_MESSAGE, since some messages use $ as a place holder, and WRITE_MESSAGE does not accommadate that, it only replaces the ampersands (&) in the message.

GET_GLOBAL_SYMBOLS  - Returns a list of all tables, select options, texts, etc for a program.  Even includes the text definitions for the selection screen

GET_INCLUDETAB  - Returns a list of all INCLUDES in a program

G_SET_GET_ALL_VALUES  - Fetch values from a set.

Function Group GRAP is now obsolete. SAP recommends using functions in function group SFES instead. Below is an overview of the changes.

GUI_CREATE_DIRECTORY  - Create a directory on the presentation server 

GUI_DELETE_FILE  - Replaces WS_FILE_DELETE . Delete a file on the presentation server 

GUI_DOWNLOAD  - Replaces WS_DOWNLOAD . Download table from the app server to presentation server

GUI_EXEC  - Replaces WS_EXECUTE . Start a File or Program Asynchronously with WinExec

GUI_GET_DESKTOP_INFO  - Replaces WS_QUERY. Delivers Information About the Desktop (client)

GUI_REMOVE_DIRECTORY  - Delete a directory on the presentation server 

GUI_RUN  - Start a File or Program Asynchronously with ShellExecute 

GUI_UPLOAD  - Replaces WS_UPLOAD . Upoad file from presentation server to the app server

HELP_START  - Display help for a field.  Useful for doing AT SELECTION SCREEN ON VALUE REQUEST for those fields that do not provide F4 help at the DDIC level.

HOLIDAY_GET  - Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.

HR_DISPLAY_BASIC_LIST  - is an HR function, but can be used for any data.  You pass it data, and column headers, and it provides a table control with the ability to manipulate the data, and send it to Word or Excel. Also see the additional documentation here.

HR_GET_LEAVE_DATA  - Get all leave information (includes leave entitlement, used holidays/paid out holidays) 

INIT_TEXT  - To load long text into SAP

K_WERKS_OF_BUKRS_FIND  - Return a list of all plants for a given company code.

LIST_TO_ASCII  - convert an ABAP report (displayed on screen) from OTF to ASCII format LIST_FROM_MEMORY - Retrieves the output of a report from memory when the report was executed using SUBMIT... EXPORTING LIST TO MEMORY. See also WRITE_LIST .

MONTH_NAMES_GET  - It returns all the month and names in repective language.

MS_EXCEL_OLE_STANDARD_OLE  - will build a file, and automatically start Excel

OTF_CONVERT  - wraps several other function modules.  Will convert OTF to ASCII or PDF

CONVERT_OTFSPOOLJOB_2_PDF  - converts a OTF spool to PDF (i.e. Sapscript document)

CONVERT_ABAPSPOOLJOB_2_PDF  - convert abap spool output to PDF

POPUP_TO_CONFIRM_LOSS_OF_DATA  - Create a dialog box in which you make a question whether the user wishes to perform a processing step with loss of data.

POPUP_TO_CONFIRM_STEP  - Create a dialog box in which you make a question whether the user wishes to perform the step.

POPUP_TO_CONFIRM_WITH_MESSAGE  - Create a dialog box in which you inform the user about a specific decision point during an action.

POPUP_TO_CONFIRM_WITH_VALUE  - Create a dialog box in which you make a question whether the user wishes to perform a processing step with a particular object.

POPUP_TO_DECIDE  - Provide user with several choices as radio buttons 

POPUP_TO_DECIDE _WITH_MESSAGE - Create a dialog box in which you inform the user about a specific decision point via a diagnosis text.

POPUP_TO_DISPLAY_TEXT  - Create a dialog box in which you display a two-line message.

POPUP_TO_SELECT_MONTH  - Popup to choose a month

POPUP_WITH_TABLE_DISPLAY  - Provide a display of a table for user to select one, with the value of the table line returned when selected.

PRICING  - Return pricing conditions in an internal table.  Use structure TCOMK for parameter COMM_HEAD_1, and structure TCOMP for parameter COMM_ITEM_1, and set CALCULATION_TYPE to B.  The pricing conditions will be returned in XOMV.  You must fill TCOMP, and TCOMK with the appropriate values before callling the function in order for it to work.

PROFILE_GET  - Read an Entry in an INI File on the frontend

PROFILE_SET  - Write an Entry in an INI File on the frontend

READ_TEXT  - To load long text into SAP

REGISTRY_GET  - Read an Entry from the Registry

REGISTRY_SET  - Set an entry in the Registry

RFC_ABAP_INSTALL_AND_RUN  - Runs an ABAP program that is stored in the table PROGRAM when the MODE = 'F'.  Table WRITES contains the ouput of the program. Allows you to run a program without having the source code in the target system.

RH_GET_ACTIVE_WF_PLVAR  - Return the active HR Plan

RH_GET_DATE_DAYNAME  - return the day based on the date provied

RH_START_EXCEL_WITH_DATA  -starts Excel with the contents of an internal table.  This function finds Excel in the desktop registry. It also uses a local PC working directory to save the file (that's what the "W" value for data path flag does). Very transparent to user!

RH_STRUC_GET  - Returns all related org info

RP_CALC_DATE_IN_INTERVAL  - Add/subtract years/months/days from a date

RP_LAST_DAY_OF_MONTHS  - Determine last day of month

RPY_DYNPRO_READ  - Read dynpro, including screen flow

RPY_TRANSACTION_READ  - Given a transaction, return the program and screen or given a program and screen, return the transactions that use the program and screen.

RS_COVERPAGE_SELECTIONS  - Returns an internal table that contains a formatted list of all the selection parameters  entered for a report.  Table is ready to print out.

RS_REFRESH_FROM_SELECTOPTIONS  - Get the current contents of selection screen

RS_SEND_MAIL_FOR_SPOOLLIST  - Send message from ABAP/4 program to SAPoffice.

RS_VARIANT_CONTENTS  - Returns the contents of the specified variant  in a table.

RZL_SLEEP  - Hang the current application from 1 to 5 seconds.

RZL_SUBMIT  - Submit a remote report.

RZL_READ_DIR _LOCAL  - Read a directory on the Application Server

RZL_READ_DIR  - If the server name is left blank, it reads a directory from local presentation server, otherwise it reads the directory of the remote server

RZL_READ_FILE  - Read a file from the presentation server if no server name is given, or read file from remote server. Very useful to avoid authority checks that occur doing an OPEN DATASET . This function using a SAP C program to read the data.

RZL_WRITE_FILE_LOCAL  - Saves table to the presentation server (not PC). Does not use OPEN DATASET , so it does not suffer from authority checks!

SAPGUI_PROGRESS_INDICATOR  - Display a progress bar on the SAP GUI, and give the user some idea of what is happening

SAVE_TEXT  - To load long text into SAP

SCROLLING_IN_TABLE  -If you are coding a module pool and using a table-control, you can use this function SCROLLING_IN_TABLE  to handle any scrolling. (provided by Paul Kjaer)

SD_DATETIME_DIFFERENCE  - Give the difference in Days and Time for 2 dates        

SO_NEW_DOCUMENT_ATT_SEND_API1  - Send a document as part of an email. The documentation is better than normal for this function, so please read it.

SO_SPLIT_FILE_AND_PATH  - Split a fully pathed filename into a filename and a path.

SO_SPOOL_READ  - Fetch printer spool according to the spool number informed.

SO_WIND_SPOOL_LIST  - Browse printer spool numbers according to user informed.

SX_OBJECT_CONVERT_OTF _PDF - Conversion From OTF to PDF (SAPScript conversion)

SX_OBJECT_CONVERT_OTF _PRT - Conversion From OTF to Printer Format (SAPScript conversion)

SX_OBJECT_CONVERT_OTF _RAW - Conversion From OTF to ASCII (SAPScript conversion)

SXPG_CALL_SYSTEM  -  you can check the user's authorization for the specified command and run the command. The command runs on the host system on which the function module is executed. The function module is RFC-capable. It can therefore be run on the host system at which a user happens to be active or on another designated host system at which an R/3 server is active.

SXPG_COMMAND_LIST_GET  - Select a list of external OS command definitions.

SXPG_COMMAND_DEFINITION_GET  - Read the definition of a single external OS command from the R/3 System's database.

SXPG_COMMAND_CHECK  - Check whether the user is authorized to execute the specified command on the target host system with the specified arguments.

SXPG_COMMAND_EXECUTE  - Check a user's authorization to use a command, as in SXPG_COMMAND_CHECK . If the authorization check is successful, then execute the command on the target host system.

TERMINAL_ID_GET  - Return the terminal id

TH_DELETE_USER  - Logoff a user.  Similar results to using SM04.

TH_ENVIRONMENT  - Get the UNIX environment

TH_POPUP  - Display a popup system message on a specific users screen.

TH_REMOTE_TRANSACTION  - Run a transaction on a remote server. Optionally provide BDC data to be used in the transaction

TH_USER_INFO  - Give information about the current user (sessions, workstation logged in from, etc)

TH_USER_LIST  - Show which users are logged into an app server

UNIT_CONVERSION_SIMPLE  - convert weights from one UOM to another.

UPLOAD  - upload a file to the presentation server (PC)

UPLOAD _FILES - Will load one or more files from app or presentation server

WRITE_LIST  -Useful for writing out the list contents that result from the function LIST_FROM_MEMORY.

WS_DOWNLOAD  - Save Internal Table as File on the Presentation Server

WS_EXCEL  - Start EXCEL on the PC

WS_EXECUTE  - execute a program on a windows PC

WS_FILE_DELETE  - Delete File at the Frontend

WS_FILENAME_GET  - Call File Selector

WS_MSG  - Create a dialog box in which you display an one-line message.

WS_UPLOAD  - Load Files from the Presentation Server to Internal ABAP Tables

WS_VOLUME_GET  - Get the label from a frontend device.

WWW_LIST_TO_HTML   - After running a report, call this function to convert the list output to HTML.
<think> 嗯,用户想了解SAP HANA CE函数的相关信息,这个问题其实很有技术深度。从用户提供的站内引用来看,ta应该已经有了一定的SAP HANA基础,现在想深入理解CE函数这个特定模块。 用户可能正在做性能优化相关的工作,因为引用[2]特别提到了CE函数的效率优势。不过ta可能没意识到这个技术现在处于维护状态,引用[1]说得很清楚,从HANA SPS05开始就没有新功能了。这个信息对用户决策很重要,得放在开篇强调。 关于技术细节部分,需要重点解释三个层面:首先是CE函数的本质是绕过SQL处理器直接操作存储引擎,这个架构特性决定了它的优缺点;然后要说明典型用法,像CE_PROJECTION这种核心函数必须举例;最后必须提醒限制条件,特别是混合使用时的性能陷阱——引用[2]那个引擎间数据传递的问题在实际开发中经常被忽视。 注意到用户提供了rowid的引用[3],虽然不直接相关,但说明ta可能在处理分页或行定位需求。因此考虑在相关问题加入rowid的衔接问题,这样既能延续当前主题,又照顾到用户可能的后续需求。 准备在回答结构上这样安排:先用时间线说明CE函数的现状,再分优缺点阐述技术特性,接着给出典型代码示例,最后附注意事项。特别要把“避免混合SQL”这个警告加粗显示,很多开发人员栽在这个点上。 用户没有问但可能想知道的是:既然CE函数不再更新,那替代方案是什么?所以考虑在相关问题加入开源替代方案的选项。 </think> 以下是关于 SAP HANA **CE函数(Calculation Engine Functions)** 的详细介绍,结合引用内容和关键技术要点: --- ### **一、CE函数概述** 1. **定位与作用** CE函数SAP HANA底层计算引擎(Calculation Engine)的直接接口,允许绕过SQL处理器执行高性能操作。适用于对海量数据进行**低延迟处理**的场景,尤其在OLAP和实时分析中优势显著[^2]。 2. **发展现状** - 自 **HANA SPS05** 版本后,CE函数**不再有新功能更新**,官方转向优化SQLScript和核心引擎[^1]。 - 主要因SAP主力产品(如BW、Business Suite)未深度依赖CE技术,导致其开发优先级降低[^1]。 --- ### **二、核心特性与优势** 1. **性能优势** - 直接由计算引擎处理,**减少SQL解析开销**,例如: ```sql product3 = CE_PROJECTION(:product1, ["NAME","COLOR","PRICE", CE_CALC('rownum()',integer) as "ROWNUM"], '"ROWNUM"<5'); ``` 此操作比等效SQL语句执行更快[^2]。 2. **常用函数示例** | 函数名 | 作用 | 等效SQL操作 | |------------------|------------------------|------------------| | `CE_PROJECTION` | 列筛选与计算 | `SELECT` | | `CE_JOIN` | 内连接/左连接 | `INNER JOIN` | | `CE_UNION_ALL` | 合并结果集(不去重) | `UNION ALL` | | `CE_CALC` | 动态计算表达式 | 计算字段 | --- ### **三、使用限制与注意事项** 1. **功能局限性** - **不支持完整SQL语法**:例如缺失 `UNION`(仅支持`UNION_ALL`)、无原生`FULL OUTER JOIN`[^2]。 - 需通过组合其他CE函数实现复杂逻辑(如外连接需用`CE_LEFT_OUTER_JOIN` + `CE_RIGHT_OUTER_JOIN`模拟)。 2. **关键使用原则** - **避免混合引擎操作**:CE函数与标准SQL语句**不可混合使用**,否则因数据在计算引擎(CE)和SQL引擎间反复传递导致性能下降[^2]。 - **优先独立使用**:在SQLScript中封装纯CE函数调用链以实现最优性能。 --- ### **四、替代方案与演进** 1. **现代HANA的替代技术** - **SQLScript优化**:SAP推荐使用**存储过程**中的SQLScript,其编译器已深度优化,性能接近CE函数。 - **核心引擎增强**:HANA 2.0后列存储引擎的计算下推能力显著提升,标准SQL亦可高效执行。 2. **适用场景建议** - **遗留系统维护**:现有使用CE函数的代码无需立即重构,但新开发应优先选择SQLScript[^1][^2]。 - **极端性能需求**:若需亚秒级响应且SQL无法满足,可评估CE函数(注意技术冻结风险)。 --- ### **代码示例:获取RowID的CE实现** 若需在CE函数中模拟行号(类似SQL `ROW_NUMBER()`),可结合`CE_CALC`: ```sql -- 使用CE函数生成行号并筛选 output = CE_PROJECTION(:input, [*, CE_CALC('rownum()', INTEGER) AS "ROWNUM"], '"ROWNUM" BETWEEN 1 AND 100'); ``` > **注意**:原生获取RowID需通过`$rowid$`(物理地址),但CE函数无直接等价操作[^3]。 --- ### **相关问题** 1. CE函数在HANA 2.0中是否完全被弃用?新项目是否应避免使用? 2. 如何将现有CE函数代码迁移到SQLScript?迁移过程中有哪些性能陷阱? 3. CE函数与HANA的列存储计算下推机制有何异同? 4. 除了`rownum()`,CE函数还有哪些特有的计算函数不可用SQL替代? > 参考资料: > [^1]: SAP HANA CE Function历史演进与技术定位 > [^2]: SAP HANA SQLScript Reference (CE函数章节) > [^3]: SAP HANA RowID操作指南
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值