SAP 常用函数

合集下载

SAP 常用函数

SAP 常用函数

1、获取订单状态(STATUS_READ 和 STATUS_TEXT_EDIT)1.STATUS_READ 改函数的实现原理大概是通过订单的对象好(OR+订单号)到JEST 中取出字段STAT INACT.JEST表中STAT是一串从字面看不出意思的字符,可以根据STAT到表TJ02T中找到具体的描述。

下面是具体用法DATA:objnr TYPE aufk-objnr.objnr = 'OR000000100014'.DATA:t_status TYPE TABLE OF jstat WITH HEADER LINE."结果存放在STATUS表中CALL FUNCTION 'STATUS_READ'EXPORTINGclient = sy-mandtobjnr = objnrTABLESstatus = t_statusEXCEPTIONSobject_not_found = 1OTHERS = 2.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.LOOP AT t_status.IF t_status = 'I0046'.WRITE:'订单已关闭'.EXIT.ENDIF.ENDLOOP.2.STATUS_TEXT_EDIT 改函数读取的结果是将订单状态拼接到一个字符串中,而且这个字符串是在前台订单上看到的状态,比较直接,这样做的结果就可能由于状态较多导致长度过长,在某些情况下取的数据可能不准。

下面是一段代码DATA:line TYPE bsvx-sttxt.CALL FUNCTION 'STATUS_TEXT_EDIT'EXPORTINGclient = sy-mandtobjnr = objnrspras = sy-languIMPORTINGline = lineEXCEPTIONSobject_not_found = 1OTHERS . "IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.SEARCH line FOR 'CLSD'.IF sy-subrc = 0.WRITE:'订单已关闭'.ENDIF.DATA i_jstat LIKE jstat OCCURS 0 WITH HEADER LINE.CALL FUNCTION 'STATUS_READ'EXPORTINGclient = sy-mandtobjnr = i_caufv_resb-objnr ”对象号only_active = 'X'* IMPORTING* OBTYP =* STSMA =* STONR =TABLESstatus = i_jstat “目前的所有状态EXCEPTIONSobject_not_found = 1OTHERS = 2.LOOP AT i_jstat WHERE stat = 'I0013' "DLT 删除标识符.OR stat = 'I0012' "DLV 交货OR stat = 'I0045' "TECO 技术实现OR stat = 'I0043' "LKD 冻结OR stat = 'I0001' "CRTD 建立OR stat = 'I0046' "CLSD 已结算OR stat = 'I0076'. "DLID 删除标志l_delete = 'X'.EXIT.ENDLOOP.2、图标的函数ICON_CREATE1、定义字段data: status_icon type icons-text.2、创建屏幕,并在屏幕定义创建一个"Status Icon"控件,命名为:status_icon3、利用ICON_CREATE函数在输出是设置ICON。

SAP常用的函数

SAP常用的函数

SAP常用的函数函数名描述CONVERSION_EXIT_ALPHA_INPUT 料号前面补0CONVERSION_EXIT_ALPHA_OUTPUT 料号前面减0CONVERSION_EXIT_MATN1_INPUT 料号前面补0CONVERSION_EXIT_MATN1_OUTPUT 料号前面减0LAST_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”EXPORTINGinput = matnr_inIMPORTINGoutput = matnr_out.说明:1)数字料号入Table需要补0,不会自动产生,有字母料号却会自动补0.2)只能用’字符型’CONVERSION_EXIT_MATN1_INPUT功能:料号前面补0实例:CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT' "料号前面补0”EXPORTINGinput = matnr_inIMPORTINGoutput = matnr_outEXCEPTIONSlength_error = 1OTHERS = 2.说明: 1)数字料号入Table需要补0,不会自动产生,有字母料号却会自动补0.2)只能用于料号转换CONVERSION_EXIT_ALPHA_OUTPUT功能:料号前面去0实例:CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' "料号前面去0. EXPORTINGinput = wa_ysy1-matnrIMPORTINGoutput = wa_ysy1-matnr.说明:CONVERSION_EXIT_MATN1_OUTPUT功能:料号前面去0实例:CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'EXPORTINGinput = t_afpo-matnrIMPORTINGoutput = t_afpo-matnrEXCEPTIONSOTHERS = 1.说明:LAST_DAY_OF_MONTHS功能:查询某日期的在当月的最后一天CALL FUNCTION 'LAST_DAY_OF_MONTHS'EXPORTINGday_in = f_date "月任意一天类型必须为D(要完成日期##IMPORTINGlast_day_of_month = p_date "月最后一天类型必须为D(完整日期)EXCEPTIONSday_in_no_date = 1OTHERS = 2.说明:CO_SF_CAUFVD_GET功能: 根据工单号查询订单抬头和项目实例:DATA: wa_caufvd TYPE caufvd.CALL FUNCTION 'CO_SF_CAUFVD_GET'"取得订单抬头和项目EXPORTINGaufnr_imp = aufnrIMPORTINGcaufvd_exp = wa_caufvd “订单抬头和项目结构EXCEPTIONSnot_found = 1OTHERS = 2.说明:SO_NEW_DOCUMENT_ATT_SEND_API1功能:邮件发送 SAPoffice: Send new document with attachments usingRFC 实例:FORM email_itab. “邮件内容“WRITE: '编号' TO email_itab-line+0(3), "255个长度的文本字段:文本"'记帐日期' TO email_itab-line+3(10),ENDFORM. "email_itabFORM 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_objpackFORM 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_chngFORM reset_reclist .SELECT zmaaddrINTO it_receivers-receiverFROM ziebtemail.it_receivers-rec_type = 'U'. "互联网地址APPEND it_receivers.CLEAR it_receivers.ENDSELECT.ENDFORM. "reset_reclistDATA: 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'EXPORTINGdocument_data = gd_doc_data “新文档的属性”PUT_IN_OUTBOX = 'X' “标志:发送后将文档移到outbox* COMMIT_WORK = ' '* IMPORTINGSENT_TO_ALL = gd_sent_all “Flag: Document sent to all”* NEW_OBJECT_ID = ID of created object (not document!)tablespacking_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'EXPORTINGaction = '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 enameINTO CORRESPONDING FIELDS OF TABLE itabFROM pa0001WHERE pernr <50.LOOP AT itab.WRITE: /02 sy-vline, itab-pernr, 15 sy-vline, itab-ename, 50sy-vline.ENDLOOP.*receiversreceiver_list-recextnam = 'eric.guh@'. “直接外部地址作为接收方”receiver_list-recesc = ‘U’. “收件人类型的说明; U 互联网地址”receiver_list-sndart = ‘MAIL'. “输出设备; MAIL 邮件”receiver_list-sndpri = '1'. “发送:优先级; 1 最高优先权”APPEND receiver_list.*general dataw_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.*contentmessage_content-line = 'Message content'. “发送的内容”APPEND message_content.CALL FUNCTION 'SO_OBJECT_SEND'EXPORTINGobject_hd_change = w_object_hd_change “通常头数据”object_type = 'RAW' “对象类型”OUTBOX_FLAG = 'X' “标志:发送后将文档移到outboxowner = sy-uname “负责传送的用户”TABLESobjcont = message_content “发送的内容”receivers = receiver_list “接收对象属性”att_cont = compressed_attachment.。

SAP常用Function一览

SAP常用Function一览
No.5 数据转换函数 1. CONVERSION_EXIT_CUNIT_OUTPUT 内部单位转化为外部单位输出 2. CONVERSION_EXIT_CUNIT_INPUT 外部计量单位转化输入 3. UNIT_CONVERSION_SIMPLE 计量单位转换 4. BAPI_CURRENCY_CONV_TO_EXTERNAL 货币金额转化为外部数据格式输出
6. READ_TEXT 读取长文本
7. MESSAGE_TEXT_BUILD 把消息转化为文本
8. REUSE_ALV_FIELDCATALOG_MERGE 根据数据字典结构或者内表创建字段目录
9. POPUP_WITH_TABLE_DISPLAY 弹出一个简单的列表画面,可以选择某一行,返回选择行的索引
19. HELP_VALUES_GET_WITH_TABLE_EXT 17,18的功能合
20. VRM_SET_VALUES 做LIST BOX 会用 到的一个函数
21. TERM_CONTROL_EDIT 弹出一个文本编辑框
22. POPUP_GET_VALUES 对于显示和值请求的会话框, 没有检查 23. COMPLEX_SELECTIONS_DIALOG 在Dialog 里设置复杂选择标准
5. BAPI_CURRENCY_CONV_TO_INTERNAL 6. CURRENCY_AMOUNT_SAP_TO_DISPLAY 显示存储的货币金額 7. CURRENCY_AMOUNT_DISPLAY_TO_SAP 存储输入的货币金額 8. CONVERT_TO_LOCAL_CURRENCY 按照指定日期汇率转换金额为指定货币类型
15.DYNP_VALUES_READ 读取屏幕上字段值
16. DYNP_VALUES_UPDATE 选择F4后,将选定表行值返回到屏幕

sap abap 整行读取长文本 函数

sap abap 整行读取长文本 函数

SAP ABAP 整行读取长文本函数在SAP ABAP编程中,我们经常需要处理大量的文本数据。

以下是一些常用的函数,用于在ABAP中整行读取长文本。

1. GET_LINE_LENGTH( )```abapGET_LINE_LENGTH( )```这个函数无参数,调用它将会返回当前文本行的长度。

2. GET_LINE( )```abapGET_LINE( )```这个函数无参数,调用它将会读取当前文本行的内容,返回的是文本行的字符串。

3. CONCATENATE( )```abapCONCATENATE( )```此函数接受两个字符串参数,将它们连接在一起并返回结果字符串。

4. SUBSTITUTE( )```abapSUBSTITUTE( source string; search string; replace string [; occurrence [; pattern type ] ] )```此函数接受最多五个参数。

它在指定字符串(source string)中查找指定的子字符串(search string),并用指定的替换字符串(replace string)替换它。

可以选择指定替换的特定次数(occurrence),也可以选择指定使用的特定模式类型(pattern type)。

5. TRANSLATE( )```abapTRANSLATE( source string; search string; replace string [; occurrence [; pattern type ] ] )```此函数类似于SUBSTITUTE( ),但它还有一个额外的功能:删除源字符串中所有匹配的子字符串。

6. GET_TRANSLATION( )```abapGET_TRANSLATION( source string; search string; replace string [; occurrence [; pattern type ] ] )```此函数类似于SUBSTITUTE( )和TRANSLATE( ),但它返回一个新字符串,其中所有匹配的子字符串都被替换为指定的替换字符串,并且所有其他字符都被删除。

sap-function 常用 大全

sap-function 常用 大全

可以显示定制的提 示信息的确认窗口 64 POPUP_TO_CONFIRM_WITH_MESSAGE 。系统在窗口上显 示一个绿色问号图 标。
65 POPUP_TO_CONFIRM_WITH_VALUE
显示确认用户对某 个特定对象的操作 的弹出窗口。系统 在窗口上显示一个 绿色问号图标。 将待确认选项以单 选按钮的方式显示 的弹出窗口
39 HOLIDAY_CHECK_AND_GET_INFO
判断某天是否是假 日
40 INIT_TEXT
上传长文本到SAP。
41 INIT_TEXTSAVE_TEXTCOMMIT_TEXT
会計伝票テキスト を登録
42 JOB_CLOSE
ジョブをリリース
43 JOB_OPEN
設定されたョブ名 称によりジョブを オープン
61 POPUP_TO_CONFIRM
该函数是POPUP函数 的增强版,可以自 定义按钮文本和图 标。
显示有YES/NO的弹 62 POPUP_TO_CONFIRM_LOSS_OF_DATA 出窗口,提示用户 未保存的数据将丢 失。 系统在窗口上 63 POPUP_TO_CONFIRM_STEP 提示是否确认操作 的弹出窗口
函数名
描述
1 BKK_ADD_MONTH_TO_DATE
日期的加减
2 C14B_ADD_TIME
加時間到某月某日 某時得其結果
3 CATS_NUMERIC_INPUT_CHECK
数値チェック
4 CLOI_PUT_SIGN_IN_FRONT
把SAP里的负号放到 前面来的函数
5 CO_R0_CHECK_DECIMAL_POINT
根据语言决定单位 的显示
10 CONVERT_DATE_INPUT

常用的SAP标准函数

常用的SAP标准函数

常⽤的SAP标准函数Function Module DescriptionABAP4_CALL_TRANSACTION Call transaction code, also see SAPGUI_SET_FUNCTIONCODEGet additional user address details not retrived bySUSR_USER_ADDRESS_READ (i.e. email address)Retrieve fiscal year and payrole period (based on date andcompany code)CALCULATE_DATE Increase/decrease DATE by a specific number of Days/Months CONVERT_DATE_TO_EXTERNAL Converts date from system storage format to users specifieddisplay formatCREATE_TEXTS Create standard texts (i.e. PO headers texts)Convert currency value from value stored in SAP to displayedcurrencyConvert currency value from displayed currency value to valuestored in SAPCLPB_EXPORT Export files to clipboardCLBP_IMPORT Copies clipboard into tableDATE_COMPUTE_DAY Returns day of the week for a particular date(1=Monday, 5=Fridayetc.)DATE_TO_DAY Returns day of the week for a particular date('Monday', 'Friday','Sat.')ENQUEUE_READ Returns list if active lock objectsRetrieve fiscal year and payrole period (Note: verision parameter isfiscal year varient from table T009)Return values (i.e. from an F4 value request) into respective fieldson a dynpro.F4IF_INT_TABLE_VALUE_REQUEST Display internal table as search help (documented in SAP)FILE_GET_NAME Retrieve Logical file path. Use Transaction 'FILE' to view/createlogical file pathsFTI_FISCAL_YEAR_MONTH_GET Returns fiscal year for specific dateDownload file to PCUpload file from PCHR_SEN_CRULE_0100_DATE Increase/decrease DATE by a specific number ofDays/Months/YearsJOB_OPEN, JOB_SUBMIT, JOB_CLOSE Create and submit background jobs.Builds actual message based on info returned from CalltransactionNUMBER_GET_NEXT Get the next unique number in a number range. Use tcode SNROfor maintaining number ranges.NUMBER_CHECK Check if number is within a number range (see tcode SNRO) NUMBER_GET_INFO Get info about number range (see tcode SNRO).POPUP*Display Pop-up Screen(s)Retrive standard texts (i.e. PO headers texts)READ_EXCHANGE_RATE Retrieve exchange rate on a particular dateRS_CREATE_VARIANT Creating a Report VariantRS_VARIANT_CONTENTS Returns contents of a variant, is also useful as the result lists allvariable names that could be set on screen.Get list of files within specific directory(Application Server) SAPGUI_SET_FUNCTIONCODE Execute SAP function code. Can also be used to executetransaction code by using '/o' i.e. '/OSE80'.STUM_WP_TOTAL_ACTIVITY Retrieves list of all process from all servers (i.e. SM50, SM66).Also returns a second table, containing a list of all the servers. STUM_WP_SERVER_ACTIVITYS &Retrieves list of processes on current server.EW_TH_WPINFOGet user address details stored under 'Own data'SUSR_USER_PARAMETERS_GET Get user parameter details stored under 'Own data'SUSR_USER_DISPLAY_WITH_AUTHS Displays user authorisation objects (Note: may have to debugaround authority checks)SUSR_USER_AGR_ACTIVITYGR_GET Get users activity group detailsSUSR_SYNC_USER_TABLES Sync USR tablesExecute external command(FTP data in & out of SAP)TH_POPUP Display Windows Message on Users ScreenWS_EXECUTE Execute External Program。

SAPABAP函数总结常用函数解释

SAPABAP函数总结常用函数解释

SAPABAP函数总结常用函数解释SAPABAP是一种流行的编程语言,常用于SAP系统开发。

在ABAP中,函数是可重复使用的代码块,用于执行特定的任务或操作。

这些函数可以在ABAP程序中调用,以提高代码的可维护性和重用性。

下面是一些常用的SAPABAP函数以及它们的解释。

1.STRLEN函数:返回一个字符串的长度。

这个函数可以用于计算字符串的字符数,以便于处理和操作字符串。

2.CONCATENATE函数:将多个字符串连接成一个字符串。

这个函数可以用于连接两个或多个字符串,使其成为一个新的字符串。

3.REPLACE函数:替换字符串中指定的内容。

这个函数可以用于替换一个字符串中的一些子串,以实现特定的文本替换需求。

4.SPLIT函数:将一个字符串按照指定的分隔符分割成一个字符串表。

这个函数可以用于将一个长字符串以指定的分隔符分割为多个小字符串,并存储在表中。

5.TRANSLATE函数:替换字符串中的字符。

这个函数可以用于替换一个字符串中的特定字符或字符串,以实现文本的转换或调整。

6.NUMERIC_CHECK函数:检查一个字符串是否为合法的数字。

这个函数可以用于验证一个字符串是否为合法的数字,以确保数据的准确性。

7.DATE_CONVERSION_FUNCTIONS函数:日期转换函数。

这个函数可以用于在不同日期格式之间进行转换,以满足不同日期格式的需求。

8.DYNPRO_NOT_FOUND函数:检查屏幕元素是否存在。

这个函数可以用于检查SAP屏幕中是否存在一个指定的屏幕元素,以便根据结果来决定后续的操作。

9.WRITE函数:向输出窗口或内部表写入数据。

这个函数可以用于将数据写入SAP输出窗口,或写入内部表,以进行后续的数据处理。

10.SY-SUBRC函数:获取最近一次操作的执行状态。

这个函数可以用于获取最近一次操作的执行结果,以便根据结果进行进一步的处理和判断。

11.CONVERSION_EXIT_ALPHA_INPUT函数:输入转换函数。

SAP几个常用函数.doc

SAP几个常用函数.doc

SAP几个常用函数.docSAP中几个常用函数函数名描述ABAP_DOCU_DOWNLOAD Download ABAP documentation in HTML format.ARFC_GET_TID-以十六进制形式返回终端的IP地址。

ADDR_GET_COMPLETE_ALL_TYPES 功能:获得地址的相关信息BP_EVENT_RAISE-在ABAP/4程序屮触发一个事件。

BKK_ADD_MONTH_TO_DATE 日期的加减BAPI_COMPANYCODE_GET_PERIOD功能:获得公司的会计年度以及过账日期CONVERT_OTFSPOOLJOB_2_PDF ? converts a OTF spool to PDF (i。

e。

Sap script document)CONVERT_ABAPSPOOLJOB_2_PDF -convert ABAP spool output to PDFCLPBJMPORT :从剪贴板导入internal tableCLPB_EXPORT :从internal table 输入到剪贴板COMMIT_TEXT -To load long text into SAP。

CONVERT_OTF -将SAP文档(SAP Script)转换成其他类型。

CONVERT_TO_LOCAL_CURRENCY按照指定日期汇率转换金额为指定货币类型cLgui_frontend_services=>gui_upload 上传到服务器cLguiJrontend_services=>gui_download下载至U服本地CURRENCY_AMOUNT_SAP_TO_BAPI 数量因货币变化CONVERSION_EXIT_CUNIT_OUTPUTCONVERSION_EXIT_ALPHA_INPUT CONVERSION_EXIT_ALPHA_ OUTPUT CONVERSION_EXIT_MATN1_INPUT 功能:根据语言决定单位的显示全数字则在前面补0和上面相反物料号码转换函数CONVERSION EXIT MATN1 OUTPUT 同上相反CLOI_PUT_SIGN_IN_FRONT CO RO CHECK DECIMAL POINT 功能:将负号提前功能:根据单位检查数据的小数位DAY_ATTRIBUTES_GETReturn 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 byFrancois Henrotte)?DATE_CHECK_PLAUSIBILITY 检查日期合法性DAY_IN_WEEK 通过这个日期得出那大是星期几DATE GET WEEK- 返回一个口期所在的周数。

sap 常用函数

sap 常用函数

GUI_REMOVE_DIRECTORY 删除PC目录
GUI_RUN 运行PC程序(ShellExecute)
GUI_UPLOAD 从PC上传程序
判断某天是否是假日
HOLIDAY_CHECK_AND_GET_INFO
ABAP_DOCU_DOWNLOAD
Download ABAP documentation in HTML format.
-------------------------------------------
通过这个日期得出那天是星期几
DAY_IN_WEEK
----------------------------------------
用来得到将来/过去的日期的
RP_CALC_DATE_IN_INTERVAL
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = &1
importing
output = &1.
------------------------------------------------
input = &1
importing
output = &1.
END-OF-DEFINITIOห้องสมุดไป่ตู้.
---------------------------------------------------
前面加0
---------------------------------------------------
GET_GLOBAL_SYMBOLS – 返回一个程序的tables, select options, texts, etc 。甚至包含selection screen的文本定义。

ABAP常用函数

ABAP常用函数

abap函数荟萃2009年04月02日星期四08:331 .函数WS_UPLOAD功能﹕将TXT文件转换成SAP中的内表定义的数据表格文件注意﹕1函数将按参数data_tab的实际参数(假设为table1) table1定义的各个字段的长度来依次将TXT文件间隔开﹐并依次将对应的值付给table1的字段,table中的各个字段必须为C型2 TXT文件中﹐各个字段值之间不能有空格事例: ZBC400_JOHN_262 .函数TH_POPUP功能:向函数入口参数client , user决定的用户发送信息(信息为入口参数message决定的信息)事例﹕ZBC_LSL_0173.函数HELP_V ALUES_GET_WITH_TABLE功能﹕弹出用户所需要的信息﹐让用户选择﹐并把选种的信息付给输入框﹐相当与建立起SEARCH HELP注意: 1 tables的参数fields , valuetab需要固定的内表结构2 importing的参数select_value有高﹐低两个值﹐即用户选种的值付给相应的输入框的最小值﹐最大值3 tables的参数fields , valuetab的实际参数(假设为tab_field, field_value)tab_field, field_value的付值,其tab_field内表中﹐有且仅有一个字段的selectflag = 'X’事例﹕ZPP0002934 .函数Z_UDARBID功能﹕根据工单号﹐当前工作中心代号﹐读出上一工作中心代号﹐上一工作中心名称﹐下一工作中心代号﹐下一工作中心名称事例﹕ZPP000224_EDIT说明﹕取得上下组别的函数更正确的函数z_udarbid_change(可以解决组别循环问题)示例﹕ZBAK_ZPP000222_LSL5 .函数Z_COLORANDSIZE功能﹕根据该物料的组态﹐得出该物料的颜色尺码.注意﹕入口参数IP_SPRAS = 'E’表示本厂款号﹐’M’表示客户款号6 .函数Z_PRINTTITLE功能﹕打印标准报表头事例﹕ZBC_LSL_7777 .函数Z_PAGECHANGE功能﹕许多记录时﹐进行翻叶操作8 .函数READ_TEXT功能﹕读取内文假设﹕FORM get_pitext USING pn LIKE thead-tdname .REFRESH tabline.CALL FUNCTION 'READ_TEXT'EXPORTINGclient = sy-mandtid = '0006'language = 'M'object = 'VBBK'name = pnarchive_handle = 0IMPORTINGheaders = theadTABLESlines = tablineEXCEPTIONSnot_found = 2.注意﹕1 tabline必须为固定格式, headers的实际参数必须为thead name的实际参数必须为thead-tdname形式,靠它来确定取谁的内文2 client , language , archive_handle的入口值基本固定如上3 id为va03?转到?表头?内文?(双击要读取的内文项)?goto?headertext id既是参数id的值text object既是参数object的值事例﹕ZPP0002209 .函数Z_CURR_TO_CHAR .功能﹕把curr型的数据转化成char型的数据﹐转化后的数据仍然按curr型数据显示(“###,###,###.##”)并可以在char型数前后添加固定个特殊字符(“**12,111,456.23”, ”**********12.45”)假设p_curr为CURR型﹐p_char = '*’CALL FUNCTION 'Z_CURR_TO_CHAR'EXPORTINGp_curr_i = p_curr* p_char_i = p_char* p_num_i = 2* p_bore_i =* p_nums_i = 20IMPORTINGp_char_o = t_chrEXCEPTIONno_p_curr_i = 1curr_type_wrong = 2not_bore_i = 3OTHERS = 4.说明﹕p_curr :必须输入参数﹐不能超过15个长度,被转化的参数p_char :可线参数﹐须添加的特殊字符p_num_I :可线参数﹐当参数p_nums_I为空时有效﹐要添加的特殊字符的个数p_bore_I:可线参数﹐决定是在前/后添加特殊字符,b?前﹐e?后﹐默认为b,只能输入b/e否则函数不转化p_nums_I:可线参数﹐决定转化成固定个字符长度的﹐若参数p_char_I有值﹐则不足位时补特殊字符﹐若参数p_char_I为空时﹐该参数无效﹐若该参数输入值﹐则参数p_num_I无效。

SAP-HR模块中有用的函数

SAP-HR模块中有用的函数
CALLFUNCTION'RH_READ_INFTY_NNNN'
EXPORTING
PLVAR ='01'
OTYPE ='O'
OBJID = OBJID
INFTY ='9774'
SUBTY ='0002'
begda = G_BEGDA
endda = G_ENDDA
TABLES
INNNN = TAB9774
DEFINE alpha_minus.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = &1
importing
output = &1.
END-OF-DEFINITION.
---------------------------------------------------
GUI_DELETE_FILE 删除PC上的文件
GUI_DOWNLOAD 文件下载函数
GUI_EXEC 执行PC上的程序,或者打开文件
GUI_GET_DESKTOP_INFO 得到PC客户端的系统信息,比如操作系统等
GUI_REMOVE_DIRECTORY 删除PC目录
GUI_RUN 运行PC程序(ShellExecute)
* MOLGA =
TABLES
in_rgdir = tab_in_rgdir "pc261结果表
EXCEPTIONS
no_record_found =1
OTHERS=2.
--------------------------------------------------------------------------------

SAP ABAP 常用函数清单

SAP ABAP 常用函数清单

ABAP_DOCU_DOWNLOAD Download ABAP documentation in HTMLformat.APPL_LOG_DELETE With this function module you delete logsin the database according to specifiedselection conditionsAPPL_LOG_DISPLAY With this function module you can analyzelogs in the database.APPL_LOG_DISPLAY_INTERN With this function module you can analyzelogs in local memory, e.g. when you haveonly collected log records at runtime anddo not want to write to the database.APPL_LOG_INIT This function module checks whether thespecified object or sub-object existsand deletes all existing associated datain local memory.APPL_LOG_READ_DB With this function module you read thelog data in the database for an object orsub-object according to specifiedselection conditions.APPL_LOG_READ_INTERN With this function module you read alllog data whose log class has at least thespecified value, from local memory, forthe specified object or sub-object.APPL_LOG_SET_OBJECT With this function module, you create anew object or sub-object for writing inlocal memory. With a flag you can controlwhether the APPL_LOG_WRITE_... messagesare written in local memory or are outputon the screen.APPL_LOG_WRITE_DB With this function module you write alldata for the specified object orsub-object in local memory to thedatabase. If the log for the object orsub-object in question is new, the lognumber is returned to the callingprogram.APPL_LOG_WRITE_HEADER With this function module, you write thelog header data in local memory.APPL_LOG_WRITE_LOG_PARAMETERS With this function module, you write thename of the log parameters and theassociated values for the specifiedobject or sub-object in local memory. Ifthis function module is calledrepeatedly for the same object orsub-object, the existing parameters areupdated accordingly. If you do notspecify an object or sub-object with thecall, the most recently used is assumed.APPL_LOG_WRITE_MESSAGE_PARAMS With this function module you write asingle message, with parameters, inlocal memory. Otherwise the functionmodule works likeAPPL_LOG_WRITE_SINGLE_MESSAGE.APPL_LOG_WRITE_MESSAGES With this function module you write oneor more messages, without parameters, inlocal memory.APPL_LOG_WRITE_SINGLE_MESSAGE With this function module you write asingle message, without parameters, inlocal memory. If no header entry has yetbeen written for the object orsub-object, it is created. If you do notspecify an object or sub-object with thecall, the most recently used is assumed.ARFC_GET_TID will return the IP address of theterminal in hex.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 calla callback routine (based on the data inBAL_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 calla callback routine (based on the data inBAL_S_MSG-PARAMS)BAL_DSP_MSG_TECHNICAL_DATA Output technical data of a message suchas 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 log BAL_DSP_PROFILE_STANDARD_GET Standard profile (SLG1) for a lot of logs BAL_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 fromABAP-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 memory BAL_LOG_HDR_CHANGE Change log headerBAL_LOG_HDR_CHECK Check log header data for consistency BAL_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 consistency BAL_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 memory BAL_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 tablerecordBAL_OBJECT_SUBOBJECT Check whether object and subobject existand the combination is allowedBAL_SUBOBJECT_SELECT Read subobject table recordBP_EVENT_RAISE Trigger an event from ABAP/4 program BP_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.objectclass = 'EINKBELEG'objectid = l_objectidusername = spaceTABLESi_cdhdr = lt_cdhdr.LOOP AT lt_cdhdr WHERE udate IN s_aedat.CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS' EXPORTINGchangenumber = lt_cdhdr-changenrTABLESeditpos = lt_editpos.LOOP AT lt_editpos WHERE fname = 'LOEKZ'AND f_new = 'L'.p_desc = text-r01. " Cancel ContractENDLOOP.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'EXPORTINGobjectclass = 'EINKBELEG'objectid = l_objectidusername = spaceTABLESi_cdhdr = lt_cdhdr.LOOP AT lt_cdhdr WHERE udate IN s_aedat.CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS' EXPORTINGchangenumber = lt_cdhdr-changenrTABLESeditpos = lt_editpos.LOOP AT lt_editpos WHERE fname = 'LOEKZ'AND f_new = 'L'.p_desc = text-r01. " Cancel ContractCLAF_CLASSIFICATION_OF_OBJECTS Return all of the characteristics for amaterialCLOI_PUT_SIGN_IN_FRONT Move the negative sign from the left handside of a number, to the right hand sideof the number. Note that The result willbe left justified (like all characterfields), not right justifed as numbersnormally are.CLPB_EXPORT Export a text table to the clipboard (onpresentation server)CLPB_IMPORT Import a Text Table from the Clipboard(on presentation server)COMMIT_TEXT To load long text into SAPCONVERSION_EXIT_ALPHA_INPUT converts any number into a string fillwith zeroes, with the number at theextreme rightCONVERSION_EXIT_ALPHA_OUTPUT converts any number with zeroes rightinto a simple integerCONVERT_ABAPSPOOLJOB_2_PDF convert abap spool output to PDFCONVERT_OTF Convert SAP documents (SAPScript) toother types.CONVERT_OTFSPOOLJOB_2_PDF converts a OTF spool to PDF (i.e.Sapscript document)CONVERT_TO_FOREIGN_CURRENCY Convert local currency to foreigncurrency.CONVERT_TO_LOCAL_CURRENCY Convert from foreign currency to localcurrencyDATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid formatfor SAP. Works well when validating datesbeing passed in from other systems. DATE_COMPUTE_DAY Returns a number indicating what day ofthe week the date falls on. Monday isreturned 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)DOWNLOAD download a file to the presentationserver (PC)DYNP_VALUES_READ Read the values from a dynpro. Thisfunction can be used to read the valuesfrom a report's selection screen too(Another example).DYNP_VALUES_UPDATE Similar to DYNP_VALUES_READ, thisfunction will allow the updating offields on a dynpro. Very useful when youwant to change a field based on the valueentered for another field.ENQUE_SLEEP Wait a specified period of time beforecontinuing processing.ENQUEUE_ESFUNCTION Lock an abap program so that it cannot beexecuted.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_DIRECTORY_LISTING return a list of filenames from a localor network driveEPS_GET_FILE_ATTRIBUTES Pass in a filename and a path, and willreturn attributes for the fileF4_DATE displays a calendar in a popup window andallows user to choose a date, or it canbe displayed read only.F4_IF_FIELD_VALUE_REQUEST Use values from a DDIC table to providea list of possible values. TABNAME andFIELDNAME are required fields, and whenMULTIPLE_CHOICE is selected, more thanone value can be returned.F4IF_INT_TABLE_VALUE_REQUEST F4 help that returns the values selectedin an internal table. Very handy whenprogramming your very own F4 help for afield.Example: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'exportingretfield = 'BEGRU'value_org = 'S'tablesvalue_tab = t_valuesreturn_tab = t_returnexceptionsparameter_error = 1no_values_found = 2others = 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.F4IF_SHLP_EXIT_EXAMPLE documents the different reasons to use asearch help exit, and shows how it isdone.F4IP_INT_TABLE_VALUE_REQUEST This function does not exist in 4.6 andabove. Use F4IF_INT_TABLE_VALUE_REQUESTinstead.FILENAME_GET popup to get a filename from a user,returns blank filename if user selectscancelFORMAT_MESSAGE Takes a message id and number, and putsit into a variable. Works better thanWRITE_MESSAGE, since some messages use$ as a place holder, and WRITE_MESSAGEdoes not accommadate that, it onlyreplaces the ampersands (&) in themessage.FTP_COMMAND Execute a command on the FTP server FTP_CONNECT Open a connection (and log in) to an FTPserverFTP_DISCONNECT Close the connection (and log off) theFTP serverFU CSAP_MAT_BOM_READ You can use this function module todisplay simple material BOMs. You cannotdisplay BOM groups (for example, allvariants of a variant BOM). as intransaction CS03. Current restrictions:You cannot display long texts. You cannotdisplay sub-items. You cannot displayclassification data of BOM items forbatches. You can only display onealternative or variant. You cannot enteran alternative for moduleCSAP_MAT_BOM_READ, so you always seealternative 01. The following examplecame from a posting on the SAP-R3-Lmailing list.Example:data: begin of tstk2 occurs 0.include structure stko_api02.data: end of tstk2.data: begin of tstp2 occurs 0.include structure stpo_api02.data: end of tstp2.data: begin of tdep_data occurs 0.include structure csdep_data.data: end of tdep_data.data: begin of tdep_descr occurs 0.include structure csdep_descr.data: end of tdep_descr.data: begin of tdep_source occurs 0.include structure csdep_source.data: end of tdep_source.data: begin of tdep_order occurs 0.include structure csdep_order. data: end of tdep_order.data: begin of tdep_doc occurs 0.include structure csdep_doc. data: end of tdep_doc.data: flg_warning like capiflag-flwarning.call function 'CSAP_MAT_BOM_READ'exportingmaterial = 'MAT100'plant = '0001'bom_usage = '1'valid_from = '20.12.1996'* valid_toimportingfl_warning = flg_warningtablest_stko = tstk2t_stpo = tstp2t_dep_data = tdep_datat_dep_descr = tdep_descrt_dep_source = tdep_sourcet_dep_order = tdep_ordert_dep_doc = tdep_docexceptionserror = 1.Function Group GRAP is now obsolete.SAP recommends using functions in function group SFES instead. Below is an overview of the changes.G_SET_GET_ALL_VALUES Fetch values from a set. GET_CURRENT_YEAR Get the current fiscal year.GET_GLOBAL_SYMBOLS Returns a list of all tables, selectoptions, texts, etc for a program. Evenincludes the text definitions for theselection screenGET_INCLUDETAB Returns a list of all INCLUDES in aprogramGET_JOB_RUNTIME_INFO Get the current job number from a program. Also returns other useful info about the current job.GUI_CREATE_DIRECTORY Create a directory on the presentationserverGUI_DELETE_FILE Replaces WS_FILE_DELETE. Delete a fileon the presentation serverGUI_DOWNLOAD Replaces WS_DOWNLOAD. Download tablefrom the app server to presentationserverGUI_EXEC Replaces WS_EXECUTE. Start a File orProgram Asynchronously with WinExecGUI_GET_DESKTOP_INFO Replaces WS_QUERY. Delivers InformationAbout the Desktop (client)GUI_REMOVE_DIRECTORY Delete a directory on the presentationserverGUI_RUN Start a File or Program Asynchronouslywith ShellExecuteGUI_UPLOAD Replaces WS_UPLOAD. Upoad file frompresentation server to the app serverHELP_START Display help for a field. Useful fordoing AT SELECTION SCREEN ON VALUEREQUEST for those fields that do notprovide F4 help at the DDIC level.HELP_VALUES_GET_WITH_TABLE Show a list of possible values for F4popup help on selection screens. Thisfunction module pops up a screen that isjust like all the other F4 helps, so itlooks like the rest of the SAP system.Very useful for providing dropdowns onfields that do not have them predefined.Example:tables: t001w.DATA: lc_werks LIKE t001w-werks,ltab_fields LIKE help_value OCCURS 0 with header line,BEGIN OF ltab_values OCCURS 0,feld(40) TYPE c,END OF ltab_values.*-- Set up fields to retrieve dataltab_fields-tabname = 'T001W'.ltab_fields-fieldname = 'WERKS'.ltab_fields-selectflag = 'X'.APPEND ltab_fields.ltab_fields-tabname = 'T001W'.ltab_fields-fieldname = 'NAME1'.ltab_fields-selectflag = space.APPEND ltab_fields.*-- Fill valuesselect * from t001w.ltab_values-feld = t001w-werks.append ltab_values.ltab_values-feld = t001w-name1.append ltab_values.endselect.CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'EXPORTINGfieldname = 'WERKS'tabname = 'T001W'title_in_values_list = 'Select a value'IMPORTINGselect_value = lc_werksTABLESfields = ltab_fieldsvaluetab = ltab_valuesHOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not adate is a holiday. Give the function adate, and a holiday calendar, and you candetermine if the date is a holiday bychecking the parameter HOLIDAY_FOUND.Example:data: ld_date like scal-datum default sy-datum,lc_holiday_cal_id like scal-hcalid default 'CA',ltab_holiday_attributes like thol occurs 0 with header line,lc_holiday_found like scal-indicator.CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'EXPORTINGdate = ld_dateholiday_calendar_id = lc_holiday_cal_idWITH_HOLIDAY_ATTRIBUTES = 'X'IMPORTINGHOLIDAY_FOUND = lc_holiday_foundtablesholiday_attributes = ltab_holiday_attributesEXCEPTIONSCALENDAR_BUFFER_NOT_LOADABLE = 1DATE_AFTER_RANGE = 2DATE_BEFORE_RANGE = 3DATE_INVALID = 4HOLIDAY_CALENDAR_ID_MISSING = 5HOLIDAY_CALENDAR_NOT_FOUND = 6OTHERS = 7.if sy-subrc = 0 andlc_holiday_found = 'X'.write: / ld_date, 'is a holiday'.else.write: / ld_date, 'is not a holiday, or there was an error calling the function'.endif.HOLIDAY_GET Provides a table of all the holidaysbased upon a Factory Calendar &/ HolidayCalendar.HR_DISPLAY_BASIC_LIST is an HR function, but can be used for anydata. You pass it data, and columnheaders, and it provides a table controlwith the ability to manipulate the data,and send it to Word or Excel. Also see theadditional documentation here.HR_GET_LEAVE_DATA Get all leave information (includesleave entitlement, used holidays/paidout holidays)HR_IE_NUM_PRSI_WEEKS Return the number of weeks between twodates.HR_PAYROLL_PERIODS_GET Get the payroll period for a particular date. (provided by Francois Henrotte)Example:DATA: IT_T549Q TYPE T549Q OCCURS 0 WITH HEADER LINE, IT_ZL TYPE PC2BF OCCURS 0 WITH HEADER LINE.W_BEGDA = '20010101'.W_PERNR = '00000001'.CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'EXPORTINGget_begda = w_begdaTABLESget_periods = it_t549qEXCEPTIONSno_period_found = 1no_valid_permo = 2.CHECK sy-subrc = 0.CALL FUNCTION 'HR_TIME_RESULTS_GET'EXPORTINGget_pernr = w_pernrget_pabrj = it_t549q-pabrjget_pabrp = it_t549q-pabrpTABLESget_zl = it_zlEXCEPTIONSno_period_specified = 1wrong_cluster_version = 2HR_TIME_RESULTS_GET Get the time results for a payroll period. (provided by Francois Henrotte)Example:DATA: IT_T549Q TYPE T549Q OCCURS 0 WITH HEADER LINE, IT_ZL TYPE PC2BF OCCURS 0 WITH HEADER LINE.W_BEGDA = '20010101'.W_PERNR = '00000001'.CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'EXPORTINGget_begda = w_begdaTABLESget_periods = it_t549qEXCEPTIONSno_period_found = 1no_valid_permo = 2.CHECK sy-subrc = 0.CALL FUNCTION 'HR_TIME_RESULTS_GET'EXPORTINGget_pernr = w_pernrget_pabrj = it_t549q-pabrjget_pabrp = it_t549q-pabrpTABLESget_zl = it_zlEXCEPTIONSno_period_specified = 1wrong_cluster_version = 2no_read_authority = 3cluster_archived = 4technical_error = 5.NOTE: it_zl-iftyp = 'A' absenceit_zl-iftyp = 'S' at workINIT_TEXT To load long text into SAPK_WERKS_OF_BUKRS_FIND Return a list of all plants for a givencompany code.LIST_FROM_MEMORY Retrieves the output of a report frommemory when the report was executed usingSUBMIT... EXPORTING LIST TO MEMORY. Seealso WRITE_LIST.LIST_TO_ASCII convert an ABAP report (displayed onscreen) from OTF to ASCII formatMBEW_EXTEND Get the stock position for the previous month. This displays the same info that you see in MM03.MONTH_NAMES_GET It returns all the month and names inrepective language.MONTH_PLUS_DETERMINE Add or subtract months from a date. Tosubtract a month, enter a negative valuefor the 'months' parameter.Example:data: new_date type d.CALL FUNCTION 'MONTH_PLUS_DETERMINE'EXPORTINGmonths = -5 " Negative to subtract from old date, positive to addolddate = sy-datumIMPORTINGNEWDATE = new_date.write: / new_date.MS_EXCEL_OLE_STANDARD_OLE will build a file, and automaticallystart ExcelOTF_CONVERT wraps several other function modules.Will convert OTF to ASCII or PDFPOPUP_TO_CONFIRM_LOSS_OF_DATA Create a dialog box in which you make aquestion whether the user wishes toperform a processing step with loss ofdata.POPUP_TO_CONFIRM_STEP Create a dialog box in which you make aquestion whether the user wishes toperform the step.POPUP_TO_CONFIRM_WITH_MESSAGE Create a dialog box in which you informthe user about a specific decision pointduring an action.POPUP_TO_CONFIRM_WITH_VALUE Create a dialog box in which you make aquestion whether the user wishes toperform a processing step with aparticular object.POPUP_TO_DECIDE Provide user with several choices asradio buttonsPOPUP_TO_DECIDE_WITH_MESSAGE Create a dialog box in which you informthe user about a specific decision pointvia a diagnosis text.POPUP_TO_DISPLAY_TEXT Create a dialog box in which you displaya two line messagePOPUP_TO_SELECT_MONTH Popup to choose a monthPOPUP_WITH_TABLE_DISPLAY Provide a display of a table for user toselect one, with the value of the tableline returned when selected.PRICING Return pricing conditions in an internaltable. Use structure TCOMK for parameterCOMM_HEAD_1, and structure TCOMP forparameter COMM_ITEM_1, and setCALCULATION_TYPE to B. The pricingconditions will be returned in XOMV. Youmust fill TCOMP, and TCOMK with theappropriate values before callling thefunction in order for it to work.PROFILE_GET Read an Entry in an INI File on thefrontendPROFILE_SET Write an Entry in an INI File on thefrontendREAD_TEXT To load long text into SAPREGISTRY_GET Read an Entry from the Registry REGISTRY_SET Set an entry in the RegistryRFC_ABAP_INSTALL_AND_RUN Runs an ABAP program that is stored in thetable PROGRAM when the MODE = 'F'. TableWRITES contains the ouput of the program.Allows you to run a program withouthaving the source code in the targetsystem.RH_GET_ACTIVE_WF_PLVAR Return the active HR PlanRH_GET_DATE_DAYNAME return the day based on the date proviedRH_START_EXCEL_WITH_DATA starts Excel with the contents of aninternal table. This function findsExcel in the desktop registry. It alsouses a local PC working directory to savethe file (that's what the 'W' value fordata path flag does). Very transparent touser!RH_STRUC_GET Returns all related org infoRHP0_POPUP_F4_SEARK is a matchcode for any type of HR Planning object, including the possibility to fill the field that you wantExample:Examples: search for any organizational structureF4 = 'X'PLVAR = '01'OTYPE = 'O 'search for any personsF4 = 'X'PLVAR = '01'OTYPE = 'P 'MULTI_SELECT = 'X' to allow multiple selectionEASY = 'X' for user-dependent matchcodeUnfortunately, the use of table BASE_OBJIDS is disabled, so you can't specifya root for the hierarchy you displayRKD_WORD_WRAP Convert a long string or phrase intoseveral lines.RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from adateRP_LAST_DAY_OF_MONTHS Determine last day of monthRPY_DYNPRO_READ Read dynpro, including screen flowRPY_TRANSACTION_READ Given a transaction, return the programand screen or given a program and screen,return the transactions that use theprogram and screen.RS_COVERPAGE_SELECTIONS Returns an internal table that containsa formatted list of all the selectionparameters entered for a report. Table isready to print out.RS_REFRESH_FROM_SELECTOPTIONS Get the current contents of selectionscreenRS_SEND_MAIL_FOR_SPOOLLIST Send message from ABAP/4 program toSAPoffice.RS_VARIANT_CONTENTS Returns the contents of the specifiedvariant in a table.RSPO_DOWNLOAD_SPOOLJOB Download the spool from a program to afile. Requires spool number.RSPO_RETURN_ABAP_SPOOLJOB Fetch printer spool according to thespool number informed.RZL_READ_DIR If the server name is left blank, it readsa directory from local presentationserver, otherwise it reads the directoryof the remote serverRZL_READ_DIR_LOCAL Read a directory on the ApplicationServerRZL_READ_FILE Read a file from the presentation serverif no server name is given, or read filefrom remote server. Very useful to avoidauthority checks that occur doing an OPENDATASET. This function using a SAP Cprogram to read the data.RZL_SLEEP Hang the current application from 1 to 5seconds.RZL_SUBMIT Submit a remote report.RZL_WRITE_FILE_LOCAL Saves table to the presentation server(not PC). Does not use OPEN DATASET, soit does not suffer from authority checks!SAP_CONVERT_TO_XLS_FORMATConvert data to Microsoft Excel format.SAPGUI_PROGRESS_INDICATOR Display a progress bar on the SAP GUI, andgive the user some idea of what ishappeningSAVE_TEXT To load long text into SAP SCROLLING_IN_TABLE If you are coding a module pool and usinga table control, you can use thisfunction SCROLLING_IN_TABLE to handleany scrolling. (provided by Paul Kjaer) SD_DATETIME_DIFFERENCE Give the difference in Days and Time for2 datesSO_NEW_DOCUMENT_ATT_SEND_API1Send a document as part of an email. Thedocumentation is better than normal forthis function, so please read it.SO_SPLIT_FILE_AND_PATH Split a fully pathed filename into afilename and a path.SO_SPOOL_READ Fetch printer spool according to thespool number informed. See alsoRSPO_RETURN_ABAP_SPOOLJOBSO_WIND_SPOOL_LIST Browse printer spool numbers accordingto user informed.SWD_HELP_F4_ORG_OBJECTS HR Matchcode tailored for organizational units. Includes a button so that you can browse the hierarchy too.SX_OBJECT_CONVERT_OTF_PDF Conversion From OTF to PDF (SAPScriptconversion)SX_OBJECT_CONVERT_OTF_PRT Conversion From OTF to Printer Format(SAPScript conversion)SX_OBJECT_CONVERT_OTF_RAW Conversion From OTF to ASCII (SAPScriptconversion)SXPG_CALL_SYSTEM you can check the user's authorizationfor the specified command and run thecommand. The command runs on the hostsystem on which the function module isexecuted. The function module is RFCcapable. It can therefore be run on thehost system at which a user happens to beactive or on another designated hostsystem at which an R/3 server is active.SXPG_COMMAND_CHECK Check whether the user is authorized toexecute the specified command on thetarget host system with the specifiedarguments.SXPG_COMMAND_DEFINITION_GET Read the definition of a single externalOS command from the R/3 System'sdatabase.SXPG_COMMAND_EXECUTE Check a user's authorization to use acommand, as in SXPG_COMMAND_CHECK. Ifthe authorization check is successful,then execute the command on the targethost system.SXPG_COMMAND_LIST_GET Select a list of external OS commanddefinitions.TERMINAL_ID_GET Return the terminal idTH_DELETE_USER Logoff a user. Similar results to usingSM04.TH_ENVIRONMENT Get the UNIX environmentTH_POPUP Display a popup system message on aspecific users screen.TH_REMOTE_TRANSACTION Run a transaction on a remote server.Optionally provide BDC data to be used inthe transactionTH_USER_INFO Give information about the current user(sessions, workstation logged in from,etc)TH_USER_LIST Show which users are logged into an appserverTMP_GUI_DIRECTORY_LIST_FILES Retrieve all of the files andsubdirectories on the PresentationServer (PC) for a given directory.When a value other than * or *.* is used for the filter, you will not get any directories, unless they match your wildcard filter. For example, if you entered *.png, then only files and directories that end in png will be returned by the function.。

abap常用函数收集

abap常用函数收集

abap常用函数收集一、单位换算call function 'Z_FICO_DWHS'EXPORTINGa_matnr = tab01-ymatnr "物料号码a_unit_from = 'PNL' "基本计量单位meinsa_unit_to = 'PC' "itab_fp-vrkme "销售单位IMPORTINGa_rate = tybrgew.二、 CONVERSION_EXIT_ALPHA_OUTPUT功能:删除输入的数字编号中的前置 0。

这个基本上不太用得到。

输入参数:INPUT:不限制类型,必须输入。

原始编号。

输出参数:OUTPUT:日期类型。

计算出的结果。

测试结果:如果 INPUT 输入为纯数字(就是只有 0~9 之间的字符),结果删除该数字的前置 0。

如果 INPUT 输入不为纯数字(就是包含 0~9 之外的字符),结果就跟输入值一样。

代码说明:调用了一个系统函数 CONVERSION_EXIT_ALPHA_OUTPUT,这个函数是 SAP 用 C 语言写的,仅供 SAP 公司内部使用,我们的开发时无法使用。

三、正确地使用SAP的标准对话框函数在用户设计sap的程序时,经常需要一些对话框,用户可以自己编写,但使用SAP系统中提供了的对话框函数将减少许多开发工作。

12.3.1. 将货币转成外部储存值CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL' EXPORTINGcurrency =amount_internal =IMPORTINGAMOUNT_EXTERNAL =exceptionsOTHERS = 1.12.3.2. 将货币转成内部CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_INTERNALEXPORTINGcurrency =amount_external =max_number_of_digits =IMPORTINGAMOUNT_INTERNAL =RETURN =exceptionsOTHERS = 1.12.3.3. 求汇率CALL FUNCTION 'CALCULATE_EXCHANGE_RATE'EXPORTINGDATE = ITAB1-INVDTFOREIGN_AMOUNT = ITAB1-AMTFOREIGN_CURRENCY = ITAB1-CURRLOCAL_AMOUNT = ITAB1-AMTNTD LOCAL_CURRENCY = 'NTD'TYPE_OF_RATE = 'M'IMPORTINGEXCHANGE_RATE = ITAB1-EXRAT* FOREIGN_FACTOR =* LOCAL_FACTOR =EXCEPTIONSNO_RATE_COMPUTABLE = 1NO_RATE_FOUND = 2RATE_TOO_BIG = 3* NO_FACTORS_FOUND = 4NO_SPREAD_FOUND = 5OTHERS = 6.CALL FUNCTION 'READ_EXCHANGE_RATE' EXPORTINGdate = eket-eindtforeign_currency = ekko-waerslocal_currency = 'NTD'type_of_rate = 'M'IMPORTINGexchange_rate = zexchange_rate FOREIGN_FACTOR =LOCAL_FACTOR =VALID_FROM_DATE =EXCEPTIONSno_rate_found = 1no_factors_found = 2no_spread_found = 3OTHERS = 4.1、sap的函数组列表和用途说明适用情况Function group提示用户将可能丢失数据SPO1提示用户对某个问题选择Yes或者NoSPO1提示用户将可能丢失数据, 并询问用户是否继续操作SPO1提示用户在多个操作中选择一个操作SPO2提示用户是继续当前操作或者取消当前操作SPO2提示用户输入数据 (可以根据一个表检查或者不检查输入值)SPO4将数据显示给用户SPO4将详细数据显示给用户SPO6从列表中选择数据 SP05用可滚动的对话框显示数据给用户STAB从视图或者数据表中打印数据STPR2、函数列表和说明2.1 SPO1的函数* POPUP_TO_CONFIRM_STEP* POPUP_TO_CONFIRM_WITH_MESSAGE类似POPUP_TO_CONFIRM_STEP,只是多三行的文本错误诊断提示。

SAP常用的一些函数

SAP常用的一些函数
ENQUE_SLEEP –在继续处理之前等待一个指定的时间。
ENQUEUE_ESFUNCTION – 锁定一个 ABAP 程序使它不可以被执行:
RELID = 'ZZ' SRTF2 = 0 SRTF = (your report name)
注意不要用 SY-REPID 来传递你的报表名字,当把 SY-REPID 作为参数传递给函数模块的时候,SY-REPID 的值实际上已经发生了变化。
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 accommodate that, it only replaces the ampersands (&) in the message。
EPS_GET_FILE_ATTRIBUTES – 获得文件属性。
EPS_GET_DIRECTORY_LISTING – 返回一个本地或网络目录的文件列表。
F4_DATE - 弹出一个窗口显示一个日历允许用户选择一个日期。
F4IF_SHLP_EXIT_EXAMPLE – F4 接口模块。
FILENAME_GET – 弹出一个文件选择对话框。
BP_JOBLOG_READ –获得 job log 的执行结果。
CLOI_PUT_SIGN_IN_FRONT – 将负号前置, SAP 默认将负号放在数字后面。
CLPB_EXPORT –从内表导入到剪贴板。

sap 计算周的有关函数

sap 计算周的有关函数

SAP提供了各种功能和工具来帮助企业进行业务流程管理。

关于SAP中与“周”有关的计算,通常涉及到日历和时间管理。

以下是一些SAP中与周相关的常用函数:
1. WKSDOTAB: 这是一个表函数,用于返回特定日期所在周的天数。

2. WKSDOT: 这是一个函数,返回指定日期所在周的起始日期。

3. WKSDOTSB: 与WKSDOT 类似,但考虑了周六作为一周的开始。

4. WKSDOTSW: 与WKSDOT 类似,但考虑了周日作为一周的开始。

5. WKSDOTSB_US: 这是一个美国版本的函数,考虑周六作为一周的开始。

6. WKSDOTSW_US: 这是一个美国版本的函数,考虑周日作为一周的开始。

使用这些函数时,你需要提供具体的日期作为输入参数。

例如,要查找特定日期(如'20231023')所在周的起始日期,你可以使用WKSDOT 函数。

SAP函数大全

SAP函数大全

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 显示检索helpREAD_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 全数字则在前面补0CONVERSION_EXIT_ALPHA_INPUT 和上面相反GET_JOB_RUNTIME_INFO 获得job相关信息TERMINAL_ID_GET 获得端末idDATE_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 日期CHECKcl_gui_frontend_services=>gui_upload 上传到服务器cl_gui_frontend_services=>gui_download 下载到服本地SSF_FUNCTION_MODULE_NAME SMARTFORMS输出报表时,生成一个函数名称,然后CALL 这个名称POPUP_TO_DECIDE_LIST 弹出供选择窗口ABAP_DOCU_DOWNLOAD –以HTML格式下载ABAP文档。

SAP常用Function一览

SAP常用Function一览

No.1 日期时间相关函数 1. DAY_IN_WEEK 根据日期返回星期几2. DATE_GET_WEEK 根据日期返回第几周3. NEXT_WEEK 根据当前周返回下周信息,比如200846.返回200847,Monday: 2008.11.17 Sun4. WEEK_GET_FIRST_DAY 取得一周的第一天5. RP_LAST_DAY_OF_MONTHS 根据一个月的第一天获得一个月的最后一天6. RP_CALC_DATE_IN_INTERVAL 年月日加减7. CONVERSION_EXIT_INVDT_INPUT 转化日期格式为内部格式8. CONVERSION_EXIT_INVDT_OUTPUT 转化内部日期格式为输出格式9. DATE_CHECK_PLAUSIBILITY 日期有效性检查10. ATE_STRING_CONVERT 把日期字符串转化为指定的格式11. DATE_CONVERT_TO_FACTORYDATE 把输入日期转化为工厂日历日期12. FACTORYDATE_CONVERT_TO_DATE 根据工厂日历日期返回日期13. LAST_FACTORYDATE_GET 根据工厂日历ID返回最后一个工厂日期14. RE_ADD_MONTH_TO_DATE 给日期加月15. BKK_ADD_MONTH_TO_DATE 给一个日期加月计算出新的日期16. DAY_ATTRIBUTES_GET 某日期的属性,包括该日期是星期几,第几天(周2=2),是不是公共假期17. HOLIDAY_CHECK_AND_GET_INFO 判断某天是否是假日18. F4_DATE 弹出一个窗口显示一个日历允许用户选择一个日期。

19. F4_CLOCK 弹出时间的输入帮助20. POPUP_TO_SELECT_MONTH 年月的输入帮助21. HOLIDAY_GET 根据工厂日历/节日日历返回一个节日表22. .MONTH_NAMES_GET 取得所有月和月的名字23. DAY_NAMES_GET 取得一周各天的名称No.2 DDIC相关函数1. DDIF_TABL_GET 根据数据库表读取数据库表的所有技术信息(例如字段,数据类型,检索帮助,che2. DD_DOMVALUES_GET 根据域名返回域的相关信息3. DD_DOMA_GET 根据domain名字取得domain的相关信息4. DD_SHLP_CALL_FROM_DYNP 可以显示DDIC的F4输入帮助No.3 数据CHECK相关函数1. DATE_CHECK_PLAUSIBILITY 日期有效性检查2. CATS_NUMERIC_INPUT_CHECK 检查是否为数字3. CO_R0_CHECK_DECIMAL_POINT 根据数量单位检查小数位4. POSTAL_CODE_CHECK 检查邮政编码5. ADDR_POSTAL_CODE_CHECK 检查邮政编码(地址服务)No. 4 字符,字符串处理相关函数1. CLOI_PUT_SIGN_IN_FRONT 负号前置2.CONVERSION_EXIT_ALPHA_INPUT 数字字符串补前导零3. CONVERSION_EXIT_ALPHA_OUTPUT 数字字符串去前导零4. SJIS_DBC_TO_SBC 全角转化为半角5. SJIS_SBC_TO_DBC 半角转换为全角6. STRING_REVERSE 字符串反向7. STRING_CENTER 居中字符串8. STRING_MOVE_RIGHT 字符串居右9. STRING_LENGTH 计算字符串长度10. TEXT_SPLIT 字符串分割11. RKD_WORD_WRAP 把字符串按任意长度分割存入内表No.5 数据转换函数1. CONVERSION_EXIT_CUNIT_OUTPUT 内部单位转化为外部单位输出2. CONVERSION_EXIT_CUNIT_INPUT 外部计量单位转化输入3. UNIT_CONVERSION_SIMPLE 计量单位转换4. BAPI_CURRENCY_CONV_TO_EXTERNAL 货币金额转化为外部数据格式输出5. BAPI_CURRENCY_CONV_TO_INTERNAL6. CURRENCY_AMOUNT_SAP_TO_DISPLAY 显示存储的货币金額7. CURRENCY_AMOUNT_DISPLAY_TO_SAP 存储输入的货币金額8. CONVERT_TO_LOCAL_CURRENCY 按照指定日期汇率转换金额为指定货币类型No. 6 其他函数1. POPUP_TO_INFORM 弹出信息框2. POPUP_TO_CONFIRM 弹出确认窗口3. POPUP_TO_CONFIRM_STEP 弹出一个对话框询问用户是否操作继续4. SAPGUI_PROGRESS_INDICATOR 显示处理进度条5. CREATE_TEXT 创建长文本6. READ_TEXT 读取长文本7. MESSAGE_TEXT_BUILD 把消息转化为文本8. REUSE_ALV_FIELDCATALOG_MERGE 根据数据字典结构或者内表创建字段目录9. POPUP_WITH_TABLE_DISPLAY 弹出一个简单的列表画面,可以选择某一行,返回选择行的索引10. LVC_FIELDCATALOG_MERGE 半自动创建Field catalog11. CALL_BROWSER 调用IE浏览器12. F4IF_INT_TABLE_VALUE_REQUEST 显示自定义的F4检索帮助14. HELP_DOCU_SHOW_FOR_FIELD 调用F1帮助15. HELP_VALUES_GET_EXTEND 根据屏幕一字段值显示F4,并可以把其他关联字段值填充到屏幕15.DYNP_VALUES_READ 读取屏幕上字段值16. DYNP_VALUES_UPDATE 选择F4后,将选定表行值返回到屏幕17. HELP_VALUES_GET_NO_DD_NAME 显示没有数据字典参考的内部表18. HELP_VALUES_GET_WITH_DD_NAME 显示有数据字典参考的内部表19. HELP_VALUES_GET_WITH_TABLE_EXT 17,18的功能合20. VRM_SET_VALUES 做LIST BOX 会用 到的一个函数21. TERM_CONTROL_EDIT 弹出一个文本编辑框22. POPUP_GET_VALUES 对于显示和值请求的会话框, 没有检查23. COMPLEX_SELECTIONS_DIALOG 在Dialog 里设置复杂选择标准7 Sunday:2008.11.23共假期等,需要输入国家日历。

SAPABAP函数总结常用函数解释

SAPABAP函数总结常用函数解释

SAPABAP函数总结常用函数解释1.CONCATENATE:该函数用于连接多个字符串。

它可以将两个或多个字符串连接在一起,并生成一个新的字符串。

2.REPLACE:REPLACE函数用于将一个字符串中的一些字符替换成其他字符。

开发人员可以指定要替换的字符以及替换后的字符。

3.SPLIT:SPLIT函数用于将一个字符串分割成一个内部表。

开发人员可以指定分隔符,并且可以将分隔后的子字符串存储在一个内部表中。

4.STRLEN:STRLEN函数用于获取一个字符串的长度。

它返回字符串中字符的数量。

5.CONDENSE:CONDENSE函数用于去掉一个字符串中的多余空格。

它会去掉字符串开头和结尾的空格,并将连续的多个空格替换成一个空格。

6.CONVERT:CONVERT函数用于在不同的字符集之间进行转换。

它可以将一个字符串从一种字符集转换成另一种字符集。

7.TRANSLATE:TRANSLATE函数用于将一个字符串中的一些字符替换成其他字符。

它可以将一个字符集中的字符映射到另一个字符集中的字符。

8.TO_UPPERCASE:TO_UPPERCASE函数用于将一个字符串中的所有字符转换为大写形式。

9.TO_LOWERCASE:TO_LOWERCASE函数用于将一个字符串中的所有字符转换为小写形式。

10.SHIFT:SHIFT函数用于将一个字符串中的字符向左或向右移动。

它可以将字符串中的所有字符向左或向右移动指定的数量。

11.STRIP:STRIP函数用于去掉一个字符串中的多余字符。

开发人员可以指定要去掉的字符,并将被去掉的字符替换成指定的字符。

12.NUMERIC_CHECK:NUMERIC_CHECK函数用于检查一个字符串是否只包含数字字符。

它可以用于验证用户输入的数据是否为数字。

13.CURRENCY_CONVERSION:CURRENCY_CONVERSION函数用于将一个金额从一种货币转换为另一种货币。

sap常用函数(SAP常用函数)

sap常用函数(SAP常用函数)

sap 常用函数(SAP常用函数)WS_DOWNLOAD: downloading forms to local files may be inefficient without class methodsRP_LAST_DAY_OF_MONTHS: take the last day of the monthUNIT_CONVERSION_SIMPLE: Unit ConversionsWS_FILENAME_GET: the way to call open dialogC14B_ADD_TIME: add time to one yearBAPI_CURRENCY_CONV_TO_INTERNAL: convert the currency to internal storage valuesBAPI_CURRENCY_CONV_TO_EXTERNAL: convert the currency to external storage valuesCONVERSION_EXIT_ALPHA_OUTPUT: remove 0 of the number beforeNUMERIC_CHECK: determine whether it is a numberSPELL_AMOUNT: Translate numbers into wordsTMP_GUI_FILE_OPEN_DIALOG call select file dialog boxALSM_EXCEL_TO_INTERNAL_TABLE Excel data to internal tableCATS_NUMERIC_INPUT_CHECK: numerical checkCommonly used Function--------------------------------------------------Get the last day of each monthAwayCALL FUNCTION'LAST_DAY_OF_MONTHS'EXPORTINGDay_in = dateIMPORTINGLast_day_of_month = date1.--------------------------------------------------------------Remove the front 0*&--------------------------------------------------------------------** * Form frm_alpha_output to zero*&--------------------------------------------------------------------*DEFINE alpha_minus.Call function'CONVERSION_EXIT_ALPHA_OUTPUT' ExportingInput = &1ImportingOutput = &1.END-OF-DEFINITION.AwayAdd 0 to the frontAwayCall function'CONVERSION_EXIT_ALPHA_INPUT' ExportingInput = &1ImportingOutput = &1.------------------------------------------------Kicking usersTH_DELETE_USER---------------------------------------CALL FUNCTION'CUT_2BYTES_STRINGS'EXPORTINGI_STR = T_STRI_LEN = 4IMPORTINGO_STR = T_TXT04T_STR input characters, I_LEN length, T_TXT04 output charactersAmount converted into capitalCALL FUNCTION'SPELL_AMOUNT'EXPORTINGAMOUNT = T_AMOUNT10CURRENCY ='RMB'LANGUAGE ='1'IMPORTINGIN_WORDS = S_AMWORD2EXCEPTIONSNOT_FOUND = 1TOO_LARGE = 2OTHERS = 3.The SAP's function in front of the sign CLOI_PUT_SIGN_IN_FRONTUse exampleDATA: t (10) TYPE, C, VALUE,'65465-'CALL FUNCTION'CLOI_PUT_SIGN_IN_FRONT' CHANGINGValue = t.Write: t-------------------------------------------What day is this date by this date?DAY_IN_WEEK----------------------------------------Used to obtain future / past datesRP_CALC_DATE_IN_INTERVAL-------------------------------------------Addition and subtraction of datesbkk_add_month_to_date--------------------------------------------------------------------一组有用的用户交互窗口函数popup_to_confirm_loss_of_data显示有是/否的弹出窗口,提示用户未保存的数据将丢失popup_to_confirm_step提示是否确认操作的弹出窗口popup_to_confirm_with_message可以显示定制的提示信息的确认窗口popup_to_confirm_with_value显示确认用户对某个特定对象的操作的弹出窗口popup_to_decide将待确认选项以单选按钮的方式显示的弹出窗口popup_to_decide_with_message带消息的确认窗口popup_to_display_text显示多行信息的窗口popup_to_select_month月份选择窗口popup_with_table_display有表格对象的确认窗口一组操纵客户端文件系统的函数gui_create_directory在PC上建立文件目录gui_delete_file删除PC上的文件gui_download文件下载函数gui_exec执行PC上的程序,或者打开文件gui_get_desktop_info得到PC客户端的系统信息,比如操作系统等gui_remove_directory删除PC目录gui_run运行PC程序(ShellExecute)gui_upload从PC上传程序判断某天是否是假日holiday_check_and_get_infoabap_docu_download下载HTML格式的ABAP文档。

sap常用函数

sap常用函数
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = T_GM_HEAD
GOODSMVT_CODE = T_GM_CODE
O_DATACHECK = DATACHECK .
********************************************
"create routing
CALL FUNCTION 'ZPP_ROUTING_CREATE'
TABLES
I_ROUTING = I_ROUTING
filename = l_filename
query = 'FE'
IMPORTING
return = l_return
EXCEPTIONS
inv_query = 1
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
OTHERS = 3.
********************************************
"do MB1B or MB1A etc.
invalid_filesize = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
TABLES
bom_result = temp_bom.
********************************************
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1、获取订单状态(STATUS_READ 和 STATUS_TEXT_EDIT)1.STATUS_READ 改函数的实现原理大概是通过订单的对象好(OR+订单号)到JEST 中取出字段STAT INACT.JEST表中STAT是一串从字面看不出意思的字符,可以根据STAT到表TJ02T中找到具体的描述。

下面是具体用法DATA:objnr TYPE aufk-objnr.objnr = 'OR000000100014'.DATA:t_status TYPE TABLE OF jstat WITH HEADER LINE."结果存放在STATUS表中CALL FUNCTION 'STATUS_READ'EXPORTINGclient = sy-mandtobjnr = objnrTABLESstatus = t_statusEXCEPTIONSobject_not_found = 1OTHERS = 2.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.LOOP AT t_status.IF t_status = 'I0046'.WRITE:'订单已关闭'.EXIT.ENDIF.ENDLOOP.2.STATUS_TEXT_EDIT 改函数读取的结果是将订单状态拼接到一个字符串中,而且这个字符串是在前台订单上看到的状态,比较直接,这样做的结果就可能由于状态较多导致长度过长,在某些情况下取的数据可能不准。

下面是一段代码DATA:line TYPE bsvx-sttxt.CALL FUNCTION 'STATUS_TEXT_EDIT'EXPORTINGclient = sy-mandtobjnr = objnrspras = sy-languIMPORTINGline = lineEXCEPTIONSobject_not_found = 1OTHERS . "IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.SEARCH line FOR 'CLSD'.IF sy-subrc = 0.WRITE:'订单已关闭'.ENDIF.DATA i_jstat LIKE jstat OCCURS 0 WITH HEADER LINE.CALL FUNCTION 'STATUS_READ'EXPORTINGclient = sy-mandtobjnr = i_caufv_resb-objnr ”对象号only_active = 'X'* IMPORTING* OBTYP =* STSMA =* STONR =TABLESstatus = i_jstat “目前的所有状态EXCEPTIONSobject_not_found = 1OTHERS = 2.LOOP AT i_jstat WHERE stat = 'I0013' "DLT 删除标识符.OR stat = 'I0012' "DLV 交货OR stat = 'I0045' "TECO 技术实现OR stat = 'I0043' "LKD 冻结OR stat = 'I0001' "CRTD 建立OR stat = 'I0046' "CLSD 已结算OR stat = 'I0076'. "DLID 删除标志l_delete = 'X'.EXIT.ENDLOOP.2、图标的函数ICON_CREATE1、定义字段data: status_icon type icons-text.2、创建屏幕,并在屏幕定义创建一个"Status Icon"控件,命名为:status_icon3、利用ICON_CREATE函数在输出是设置ICON。

call function'ICON_CREATE'exportingname= 'ICON_RED_LIGHT'text= '图标后的文本'info= '提示'add_stdinf= 'X'importingresult= status_iconexceptionsicon_not_found= 1outputfield_too_short = 2others= 3.可以通过函数ICON_CREATE将alv中的单元格(Cell)变成ICON. LOOP AT git_alv ASSIGNING <lfs_alv>.CALL FUNCTION'ICON_CREATE'EXPORTINGname = icon_pdf "图标名字info = 'PDF'IMPORTINGresult = <lfs_alv>-pdf_orderEXCEPTIONSOTHERS = 0.ENDLOOP另外不要忘了声明一个TYPE-POOLS:icon.TYPE-POOLS:icon.3、进度条函数SAPGUI_PROGRESS_INDICATOR DATA: ll_lines(10),"行数ll_tabix(10),"循环标号ll_pecnt TYPE p LENGTH 6 DECIMALS 2,"百分比ll_pecet(6),"百分数ll_text(40)."消息CLEAR: ll_lines,ll_tabix,ll_pecnt,ll_pecet,ll_text.DESCRIBE TABLE it_vbrk LINES ll_lines."获取内表行数*LOOP AT it_vbrk INTO wa_vbrk.ll_tabix = sy-tabix."当前处理的行号ll_pecnt = ll_tabix / ll_lines * 100."已处理百分比ll_pecet = ll_pecnt."拼接显示消息CONCATENATE'已完成' ll_pecet '%,共' ll_tabix '条/' ll_lines '条'INTO ll_text.CONDENSE ll_text."整理格式,去掉多余空格,格式更整齐CALL FUNCTION'SAPGUI_PROGRESS_INDICATOR'"调用进度条函数,传入百分比和消息EXPORTINGpercentage = ll_pecnttext = ll_text.CLEAR: ll_pecnt,ll_pecet,ll_text.……ENDLOOP.4、GET_GLOBALS_FROM_SLVC_FULLSCR创建alv grid时,有时需要修改alv中的数据。

修改后将数据传到alv多所对应内表,我们在alv的usercommand事件中可以这样写:FORM usercommand USING ucomm TYPE sy-ucommselfield TYPE slis_selfield.DATA: lr_grid TYPE REF TO cl_gui_alv_grid.DATA l_tabix LIKE sy-tabix.CALL FUNCTION ‘GET_GLOBALS_FROM_SLVC_FULLSCR’IMPORTINGe_grid = lr_grid.CALL METHOD lr_grid->check_changed_data.selfield-refresh = ‘X’.selfield-row_stable = ‘X’.selfield-col_stable = ‘X’.*otherENDFORM.5、创建供应商找到一个类和方法来创建,类名:VMD_EI_API 方法名:MAINTAIN_DIRECT_INPUT,类似的* 供应商表头ls_vendors-header-object_instance-lifnr = lv_vendor. "供应商ls_vendors-header-object_task = 'M'. "创建/更改* 通用数据ls_vendors-central_data-central-data-stceg = stceg. "增值税登记号 ls_vendors-central_data-central-data-ktokk = '0001'. "账户组ls_vendors-central_data-central-data-j_1kfrepre = j_1kfrepre. "代表名称 ls_vendors-central_data-central-datax-stceg = 'X'. "增值税登记号ls_vendors-central_data-central-datax-ktokk = 'X'. "账户组ls_vendors-central_data-central-datax-j_1kfrepre = 'X'. "代表名称ls_phone-contact-data-telephone = phone. " 电话APPEND ls_phone TO ls_vendors-central_data-address-communication-phone-phone.CLEAR ls_phone.ls_smtp-contact-data-e_mail = smtp. " 邮箱APPEND ls_smtp TO ls_vendors-central_data-address-communication-smtp-smtp.CLEAR ls_smtp.ls_vendors-central_data-address-postal-data-name = name. "名称ls_vendors-central_data-address-postal-data-name_2 name. "名称ls_vendors-central_data-address-postal-data-sort1 = sort1. "属性(SAP为搜索项 1)ls_vendors-central_data-address-postal-data-street = street. "街道/门牌号ls_vendors-central_data-address-postal-data-postl_cod1 = postl_cod1. "邮政编码ls_vendors-central_data-address-postal-data-city = city. "城市ls_vendors-central_data-address-postal-data-country = country. "国家ls_vendors-central_data-address-postal-data-region = region. "地区ls_vendors-central_data-address-postal-data-langu = '1'. "语言 ls_vendors-central_data-address-postal-datax-name = 'X'.ls_vendors-central_data-address-postal-datax-name_2 = 'X'.ls_vendors-central_data-address-postal-datax-sort1 = 'X'.ls_vendors-central_data-address-postal-datax-street = 'X'.ls_vendors-central_data-address-postal-datax-postl_cod1 = 'X'.ls_vendors-central_data-address-postal-datax-city = 'X'.ls_vendors-central_data-address-postal-datax-country = 'X'.ls_vendors-central_data-address-postal-datax-region = 'X'.ls_vendors-central_data-address-postal-datax-langu = 'X'.* 采购组织数据ls_purchasing-task = 'M'.ls_purchasing-data_key-ekorg = '1000'.ls_purchasing-data-waers = waers.ls_purchasing-data-verkf = verkf.ls_purchasing-data-telf1 = telf1.ls_purchasing-data-eikto = eikto.ls_purchasing-data-webre = 'X'.ls_purchasing-datax-waers = 'X'.ls_purchasing-datax-verkf = 'X'.ls_purchasing-datax-telf1 = 'X'.ls_purchasing-datax-webre = 'X'.ls_purchasing-datax-eikto = 'X'.IF requesttype = 'CREATE'.ls_functions-task = 'I'.ls_functions-data_key-parvw = 'BA'. ls_functions-data-defpa = ''.ls_functions-data-partner = lv_vendor.s_functions-datax-defpa = 'X'._functions-datax-partner = 'X'.APPEND ls_functions TO lt_functions. ls_functions-data_key-parvw = 'LF'.ls_functions-data-defpa = ''.ls_functions-data-partner = lv_vendor. ls_functions-datax-defpa = 'X'.ls_functions-datax-partner = 'X'.APPEND ls_functions TO lt_functions.ls_functions-data_key-parvw = 'RS'.ls_functions-data-defpa = ''.ls_functions-data-partner = lv_vendor.ls_functions-datax-defpa = 'X'.ls_functions-datax-partner = 'X'.APPEND ls_functions TO lt_functions.ls_purchasing-functions-functions = lt_functions.ENDIF.APPEND ls_purchasing TO ls_vendors-purchasing_data-purchasing. CLEAR ls_purchasing.APPEND ls_vendors TO lt_vendors.CLEAR ls_vendors.ls_main-vendors = lt_vendors.* 创建或者更新供应商CALL METHOD vmd_ei_api=>maintain_direct_input EXPORTINGis_master_data = ls_mainIMPORTINGes_master_data_correct = l1es_message_correct = l2es_master_data_defective = l3es_message_defective = l4.IF l4-is_error = ''.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTINGwait = 'X'.return_status = 'S'.IF requesttype = 'CREATE'.return_value = '供应商创建成功!'.ELSEIF requesttype = 'UPDATE'.return_value = '供应商更新成功!'.ENDIF.sapcode = lv_vendor.ELSE.CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.return_status = 'F'.CLEAR ls_message.READ TABLE l4-messages INTO ls_message WITH KEY type = 'E'. IF sy-subrc = 0.MESSAGE ID ls_message-idTYPE ls_message-typeNUMBER ls_message-numberWITH ls_message-message_v1ls_message-message_v2ls_message-message_v3ls_message-message_v4INTO return_value.ENDIF.ENDIF.6、READ_TEXT 读取长文本们需要填入的值是ID LANGUAGE NAME OBJECT 这几个值7、去除前导零地址:ZSDR00070DATA: G_NUMBER(14) TYPE C .*去除p_out的前导零CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTINGINPUT = G_NUMBERIMPORTINGOUTPUT = G_NUMBER.8、取流水号地址:ZSDR00070DATA: G_NUMBER(14) TYPE C .*&取流水号CALL FUNCTION 'NUMBER_GET_NEXT'EXPORTINGNR_RANGE_NR = 'SD' "这个就是维护的间隔号OBJECT = 'ZSD_KPSQ' "这个就是流水号对象 QUANTITY = '1'IMPORTINGNUMBER = G_NUMBER. "获得的流水号9、GET_GLOBALS_FROM_SLVC_FULLSCR修改ALV数据传到alv多所对应内表地址:ZSDR00070DATA: L_GRID TYPE REF TO CL_GUI_ALV_GRID.CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'IMPORTINGE_GRID = L_GRID.CALL METHOD L_GRID->CHECK_CHANGED_DATA.10、文件上传和下载地址:ZMMR0013010.1 下载PARAMETERS: P_FILE TYPE RLGRAP-FILENAME.CALL FUNCTION 'F4_FILENAME'EXPORTINGFIELD_NAME = 'P_FILE'IMPORTINGFILE_NAME = P_FILE.10.2 上传TYPES: BEGIN OF T_DATATAB,EBELN TYPE EBELN,END OF T_DATATAB.DATA: IT_DATATAB TYPE STANDARD TABLE OF T_DATATAB,WA_DATATAB TYPE T_DATATAB.DATA: IT_RAW TYPE TRUXS_T_TEXT_DATA.CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'EXPORTINGI_LINE_HEADER = 'X'I_TAB_RAW_DATA = IT_RAWI_FILENAME = P_FILETABLESI_TAB_CONVERTED_DATA = IT_DATATAB[]EXCEPTIONSCONVERSION_FAILED = 1OTHERS = 2.11、前缀补零函数:ZMM_GETMATERIELINVENTORYCALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' "前缀补零EXPORTINGinput = MATERIALIMPORTINGoutput = MATERIAL.。

相关文档
最新文档