标准常用方法总结

Convert

  1. 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…000000000000123

  2. CONVERSION_EXIT_ALPHA_OUTPUT
    converts any number with zeroes right into a simple integer
    Example:
    input = 00000000000123
    output = 123

  3. CONVERT_ABAPSPOOLJOB_2_PDF
    convert abap spool output to PDF

  4. 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.
  5. CONVERT_OTFSPOOLJOB_2_PDF
    converts a OTF spool to PDF (i.e. Sapscript document)

  6. CONVERT_TO_FOREIGN_CURRENCY
    Convert local currency to foreign currency.

  7. CONVERT_TO_LOCAL_CURRENCY
    Convert from foreign currency to local currency

File

  1. EPS_GET_DIRECTORY_LISTING
    return a list of filenames from a local or network drive

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

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

  4. DOWNLOAD
    download a file to the presentation server (PC)

APPL_LOG

  1. APPL_LOG_DELETE
    通过该功能模块,您可以根据指定的选择条件删除数据库中的日志

  2. APPL_LOG_DISPLAY
    通过该功能模块,可以对数据库中的日志进行分析。

  3. APPL_LOG_DISPLAY_INTERN
    使用此功能模块,您可以在本地内存中分析日志,例如,当您仅在运行时收集日志记录并且不想写入数据库时。

  4. APPL_LOG_INIT
    该功能模块检查指定的对象或子对象是否存在,并删除本地内存中所有存在的关联数据

  5. APPL_LOG_READ_DB
    使用此功能模块,您可以根据指定的选择条件从数据库中读取对象或子对象的日志数据。

  6. APPL_LOG_READ_INTERN
    使用此功能模块,您可以从本地内存中读取指定对象或子对象的日志类至少具有指定值的所有日志数据。

  7. APPL_LOG_SET_OBJECT
    使用此函数模块,您可以创建一个新对象或子对象,以便在本地内存中进行写入。通过一个标志,您可以控制APPL_LOG_WRITE_…消息是写入本地内存还是输出到屏幕上。

  8. APPL_LOG_WRITE_DB
    使用此函数模块,您可以将本地内存中指定对象或子对象的所有数据写入数据库。如果所讨论的对象或子对象的日志是新的,则将日志号返回给调用程序。

  9. APPL_LOG_WRITE_HEADER
    使用这个功能模块,您可以将日志头数据写入本地内存。

  10. APPL_LOG_WRITE_LOG_PARAMETERS
    使用此功能模块,您可以在本地内存中为指定对象或子对象写入日志参数的名称和相关值。如果为同一对象或子对象重复调用此函数模块,则会相应地更新现有参数。如果没有使用调用指定对象或子对象,则假定最近使用的对象。

  11. APPL_LOG_WRITE_MESSAGE_PARAMS
    使用此函数模块,您可以在本地内存中编写带有参数的单个消息。否则,函数模块就像APPL_LOG_WRITE_SINGLE_MESSAGE一样工作。

  12. APPL_LOG_WRITE_MESSAGES
    With this function module you write one or more messages, without parameters, in local memory.

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

  1. BAL_CNTL_CREATE
    Create Control for log display

  2. BAL_CNTL_FREE
    Release Control

  3. BAL_CNTL_REFRESH
    Put new data in log display

  4. BAL_DB_DELETE
    Delete logs from the database

  5. BAL_DB_DEQUEUE
    Unlock log

  6. BAL_DB_ENQUEUE
    Lock log

  7. BAL_DB_LOAD
    Load logs from the database

  8. BAL_DB_LOAD
    Load log(s)

  9. BAL_DB_SAVE
    Save logs in the database

  10. BAL_DB_SAVE
    Save log(s)

  11. BAL_DB_SAVE_PREPARE
    Prepare save

  12. BAL_DB_SEARCH
    Find logs in the database

  13. BAL_DSP_LOG_DISPLAY
    Display messages in memory

  14. BAL_DSP_LOG_DISPLAY
    Display Log

  15. BAL_DSP_LOG_PARAMETERS
    Either output extended long text or call a callback routine (based on the data in BAL_S_LOG-PARAMS)

  16. BAL_DSP_LOG_TECHNICAL_DATA
    Output all log header data

  17. BAL_DSP_MSG_LONGTEXT
    Display message long text

  18. BAL_DSP_MSG_PARAMETERS
    Either output extended long text or call a callback routine (based on the data in BAL_S_MSG-PARAMS)

  19. BAL_DSP_MSG_TECHNICAL_DATA
    Output technical data of a message such as work area, error number, etc.

  20. BAL_DSP_OUTPUT_FREE
    End output

  21. BAL_DSP_OUTPUT_INIT
    Initialize output

  22. BAL_DSP_OUTPUT_SET_DATA
    Set dataset to be displayed

  23. BAL_DSP_PROFILE_DETLEVEL_GET
    Message hierarchy in DETLEVEL

  24. BAL_DSP_PROFILE_NO_TREE_GET
    Display without tree (fullscreen)

  25. BAL_DSP_PROFILE_POPUP_GET
    Display without tree (popup)

  26. BAL_DSP_PROFILE_SINGLE_LOG_GET
    Standard profile (SLG1) for one log

  27. BAL_DSP_PROFILE_STANDARD_GET
    Standard profile (SLG1) for a lot of logs

  28. BAL_GLB_AUTHORIZATION_GET
    Assign authorization

  29. BAL_GLB_AUTHORIZATION_RESET
    Reset authorization

  30. BAL_GLB_CONFIG_GET
    Read configuration

  31. BAL_GLB_CONFIG_SET
    Set configuration

  32. BAL_GLB_MEMORY_EXPORT
    Put function group memory in ABAP-MEMORY

  33. BAL_GLB_MEMORY_IMPORT
    Get function group memory from ABAP-MEMORY

  34. BAL_GLB_MEMORY_REFRESH
    (Partially) reset global memory

  35. BAL_GLB_MEMORY_REFRESH
    (Partially) initialize memory

  36. BAL_GLB_MSG_CURRENT_HANDLE_GET
    Get current message handle

  37. BAL_GLB_MSG_DEFAULTS_GET
    Get message defaults

  38. BAL_GLB_SEARCH_LOG
    Find logs in memory

  39. BAL_GLB_SEARCH_MSG
    Find messages in memory

  40. BAL_LOG_CREATE
    Create log with header data

  41. BAL_LOG_CREATE
    Create log with header data

  42. BAL_LOG_DELETE
    Delete log (from database also at Save)

  43. BAL_LOG_EXIST
    Check existence of a log in memory

  44. BAL_LOG_HDR_CHANGE
    Change log header

  45. BAL_LOG_HDR_CHECK
    Check log header data for consistency

  46. BAL_LOG_HDR_READ
    Read log header and other data

  47. BAL_LOG_MSG_ADD
    Put message in log

  48. BAL_LOG_MSG_ADD
    Put message in log

  49. BAL_LOG_MSG_CHANGE
    Change message

  50. BAL_LOG_MSG_CHANGE
    Change message

  51. BAL_LOG_MSG_CHECK
    Check message data for consistency

  52. BAL_LOG_MSG_CUMULATE
    Add message cumulated

  53. BAL_LOG_MSG_DELETE
    Delete message

  54. BAL_LOG_MSG_DELETE
    Delete message

  55. BAL_LOG_MSG_EXIST
    Check existence of a message in memory

  56. BAL_LOG_MSG_READ
    Read message and other data

  57. BAL_LOG_MSG_REPLACE
    Replace last message

  58. BAL_LOG_REFRESH
    Delete log from memory

  59. BAL_LOG_REFRESH
    Delete log from memory

  60. BAL_MSG_DISPLAY_ABAP
    Output message as ABAP-MESSAGE

  61. BAL_OBJECT_SELECT
    Read Application Log objects table record

  62. BAL_OBJECT_SUBOBJECT
    Check whether object and subobject exist and the combination is allowed

  63. BAL_SUBOBJECT_SELECT
    Read subobject table record

Date(日期)

  1. RP_CALC_DATE_IN_INTERVAL
    日期计算

  2. LAST_DAY_OF_MONTHS
    查询某月的最后一天

  3. CCM_GO_BACK_MONTHS
    返回指定月以前的日期

1.HR_HK_DIFF_BT_2_DATES
计算两个日期键的天数(不排除节假日)

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

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

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

  4. DATE_IN_FUTURE
    Calculate a date N days in the future.

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

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

  2. F4IP_INT_TABLE_VALUE_REQUEST
    此函数在4.6及以上版本中不存在。使用F4IF_INT_TABLE_VALUE_REQUEST代替。

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

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

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

  1. FTP_COMMAND
    在FTP服务器上执行命令

  2. FTP_CONNECT
    打开连接(并登录)到FTP服务器

  3. FTP_DISCONNECT
    关闭连接(并注销)FTP服务器

ABAP文档

  1. ABAP_DOCU_DOWNLOAD
    下载HTML格式的ABAP文档

系统信息

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

常用算术运算函数

  • ABS:返回输入参数的绝对值
  • TRUNC:返回输入参数的整数部分
  • FRAC:返回输入参数的小数部分
  • STRLEN:获取字符串长度函数

其他

  1. BP_EVENT_RAISE
    Trigger an event from ABAP/4 program

  2. BP_JOBLOG_READ
    Fetch job log executions

  3. CHANGEDOCUMENT_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.
  1. 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.
          
  1. CLAF_CLASSIFICATION_OF_OBJECTS
    Return all of the characteristics for a material

  2. CLOI_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.

  3. CLPB_EXPORT
    Export a text table to the clipboard (on presentation server)

  4. CLPB_IMPORT
    Import a Text Table from the Clipboard (on presentation server)

  5. COMMIT_TEXT
    To load long text into SAP

  6. 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).

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

  8. ENQUE_SLEEP
    Wait a specified period of time before continuing processing.

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

  10. FORMAT_MESSAGE
    获取消息id和号码,并将其放入一个变量中。比WRITE_MESSAGE工作得更好,因为一些消息使用$作为占位符,而WRITE_MESSAGE不支持这一点,它只替换消息中的&符号。

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