【IT168 技术文章】
-----------------------------------------------------
获取生产定单状态
-----------------------------------------------------
call function 'STATUS_TEXT_EDIT'
EXPORTING
flg_user_stat = 'X'
objnr = LO_OBJNR
only_active = 'X'
spras = sy-langu
IMPORTING
line = ls_statu
EXCEPTIONS
object_not_found = 01.
使用:objnr 状态对象号,only_active 激活的 ,
-----------------------------------------------------
--------------------------------------------------
获取每个月的最后一天
---------------------------------------------------
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
day_in = date
IMPORTING
last_day_of_month = date1.
-------------------------------------------------------
--------------------------------------------------------------
去掉前面0
*&--------------------------------------------------------------------*
*& Form frm_alpha_output 去零
*&--------------------------------------------------------------------*
DEFINE alpha_minus.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = &1
importing
output = &1.
END-OF-DEFINITION.
---------------------------------------------------
前面加0
---------------------------------------------------
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = &1
importing
output = &1.
------------------------------------------------
踢用户
TH_DELETE_USER
---------------------------------------
CALL FUNCTION 'CUT_2BYTES_STRINGS'
EXPORTING
I_STR = T_STR
I_LEN = 4
IMPORTING
O_STR = T_TXT04
T_STR 输入字符 I_LEN 长度 T_TXT04输出字符
-------------------------------------------
金额转换成大写
---------------------------------------------
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = T_AMOUNT10
CURRENCY = 'RMB'
LANGUAGE = '1'
IMPORTING
IN_WORDS = S_AMWORD2
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
--------------------------------------------------------
用于比较新内表和原内表内容,key_length指原表'record'中所有字段的长度,
-------------------------------------------------------------------
*CALL FUNCTION 'CTVB_COMPARE_TABLES'
* EXPORTING
* TABLE_OLD = RECORD[] "原内表
* TABLE_NEW = RECORD2[] "新内表
* KEY_LENGTH = 91
* IMPORTING
* TABLE_DEL = RECORD3[]
** TABLE_ADD = RECORD4[]
** TABLE_MOD = RECORD5[]
--------------------------------------------------
把SAP里的负号放到前面来的函数
CLOI_PUT_SIGN_IN_FRONT
--------------------------------------------------
使用示例
DATA : t(10) TYPE c VALUE '65465-' .
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
value = t.
write : t .
-------------------------------------------
通过这个日期得出那天是星期几
DAY_IN_WEEK
----------------------------------------
用来得到将来/过去的日期的
RP_CALC_DATE_IN_INTERVAL
-------------------------------------------
日期的加减
BKK_ADD_MONTH_TO_DATE
--------------------------------------------------------------------
一组有用的用户交互窗口函数
POPUP_TO_CONFIRM_LOSS_OF_DATA 显示有YES/NO的弹出窗口,提示用户未保存的数据将丢失
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_INFO
-------------------------------------------------------------------
ABAP_DOCU_DOWNLOAD
Download ABAP documentation in HTML format.
---------------------------------------------------------------------
GET_CURRENT_YEAR
得到当前的财政年(fiscal year)
---------------------------------------------------------------------
察看某日期的属性,包括该日期是星期几,第几天(周2=2),是不是公共假期等,需要输入国家日历。
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)?
-----------------------------------------------------------------------------------------------------
CLPB_IMPORT :从剪贴板导入internal table
CLPB_EXPORT:从internal table输入到剪贴板
示例程序:GRCLPB_1
在SE38环境下的程序名输入栏输入'DEMO*'后按F4,你可以查到SAP所有的DEMO示例程序,会学到很多ABAP功能的实现方法,输入'BCALV*'后按F4,你可以查到很多ALV示例程序