Funtion:CONVERSION_EXIT_ALPHA_INPUT
功能:全数字则在前面补0
参数:
Import:
INPUT:输入的字符串
Export:
OUTPUT:输出的字符串
Funtion:CONVERSION_EXIT_ALPHA_INPUT
功能:和上面相反
Funtion:GET_JOB_RUNTIME_INFO
功能:获得job相关信息
参数:
Export:
EVENTID:后台处理的事件id
EVENTPARM:后台事件的参数(例如,job id,job名字)
TERNAL_PROGRAM_ACTIVE:没用过
JOBCOUNT:job id
JOBNAME:job 名称
Funtion:TERMINAL_ID_GET
功能:获得端末id
参数:
Import:
USERNAME:用户名
Export:
TERMINAL:terminal id
Funtion:DATE_CONVERT_TO_FACTORYDATE
功能:把输入日期转为工厂日历日期
参数:
Import:
CORRECT_OPTION:表示工作日计算方式的标记
DATE:必须转化为工厂日历日期的日期
FACTORY_CALENDAR_ID:工厂日历ID
Export:
DATE:必须转化为工厂日历日期的日期
FACTORYDATE:指定日历中的工作日数
WORKINGDAY_INDICATOR:表示某日期是否为工作日的标志
例子:
DATA:DATE1 LIKE SCAL-DATE,
DATE2 LIKE SCAL-DATE,
CORRECTION LIKESCAL-INDICATOR,
CALENDAR LIKE SCAL-FCALID,
FACTORYDATE LIKE SCAL-FACDATE,
WORKDAY LIKE SCAL-INDICATOR.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTINGDATE = DATE1
CORRECT_OPTION = CORRECTION
FACTORY_CALENDAR_ID = CALENDAR
IMPORTINGDATE = DATE2
FACTORYDATE = FACTORYDATE
WORKINGDAY_INDICATOR = WORKDAY
EXCEPTIONSCORRECT_OPTION_INVALID = 1
DATE_AFTER_RANGE = 2
DATE_BEFORE_RANGE = 3
DATE_INVALID = 4
FACTORY_CALENDAR_NOT_FOUND = 5.
Funtion:MESSAGE_TEXT_BUILD
功能:把消息转为文本
参数:
Import:
MSGID:消息id
MSGNR:消息号
MSGV1:参数1
MSGV2:参数2
MSGV3:参数3
MSGV4:参数4
Export:
MESSAGE_TEXT_OUTPUT:输出的字符串
说明:可以用write <message> to<text>代替。
每天函数讲解系列----2006.01.16
Function: POPUP_TO_CONFIRM
Group:SPO1
功能:弹出确认窗口
参数:
Import:
TITLEBAR:弹出窗口的标题,最多40位
TEXT_QUESTION:问题,最长80位,多出来的截断
TEXT_BUTTON_1:第一按钮的text,最长8位
ICON_BUTTON_1:第一按钮显示的icon
TEXT_BUTTON_2:第二按钮的text,最长8位
ICON_BUTTON_2:第二按钮显示的icon
DEFAULT_BUTTON:默认的按钮
DISPLAY_CANCEL_BUTTON:是否显示取消
POPUP_TYPE:弹出的类型:决定显示的icon
ICON_MESSAGE_QUESTION :问题
ICON_MESSAGE_INFORMATION:信息
ICON_MESSAGE_WARNING:警告
ICON_MESSAGE_ERROR:错误
ICON_MESSAGE_CRITICAL:冲突
START_COLUMN:弹出位置:列
START_ROW:弹出位置:行
IV_QUICKINFO_BUTTON_1:第一按钮的显示信息(鼠标放上去后看到的)
IV_QUICKINFO_BUTTON_2:第二按钮的显示信息(鼠标放上去后看到的)
Export:
ANSWER:返回点击的按钮
'1' :第一个按钮
'2' :第二个按钮
'A' :取消按钮
每天函数讲解系列----2006.01.20
物料号码转换函数,上传文件时可能会用到
1.CONVERSION_EXIT_MATN1_INPUT
EXPORTING
INPUT = '要转换的物料号'
IMPORTING
OUTPUT = '转换后的内部使用的物料号'.
比如输入123456,输出000000000000123456
2.CONVERSION_EXIT_MATN1_OUTPUT.
作用同上面相反,用法较简单,就不说了
call function'CONVERT_TO_LOCAL_CURRENCY' "按照指定日期汇率转换金额为指定货币类型
exporting
DATE = T_EKKO-BEDAT "日期
FOREIGN_AMOUNT =T_DATA-NETPR "待转换金额
FOREIGN_CURRENCY =WAERS "当前货币单位
LOCAL_CURRENCY ='USD' "目标货币
importing
LOCAL_AMOUNT = T_DATA-NETPR. "转换后金额
endif.
call function'SSF_FUNCTION_MODULE_NAME' "根据form名取得对应的函数名(SmartForm)
exporting
FORMNAME ='ZFI_06' "Form名
importing
FM_NAME =FUNC_MODULE_NAME "返回函数名
exceptions
NO_FORM = 1
NO_FUNCTION_MODULE = 2
others = 3.
由于开发机上开发smartform传入生产机后有可能会改变其函数名,所以在调用smartform前使用这个函数
每天函数讲解系列----2006.01.23
DATE_CHECK_PLAUSIBILITY 日期CHECK
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = i_date
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
cl_gui_frontend_services=>gui_upload 上传到服务器
CALL METHODcl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = i_filetype
has_field_separator = i_separator
* HEADER_LENGTH = 0
* DAT_MODE = SPACE
* CODEPAGE = SPACE
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* READ_BY_LINE = 'X'
* IMPORTING
* FILELENGTH =
* HEADER =
CHANGING
data_tab = o_tab_table
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed =10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
cl_gui_frontend_services=>gui_download 下载到服务器
CALL METHODcl_gui_frontend_services=>gui_download
EXPORTING
* BIN_FILESIZE =
filename = l_filename
filetype = i_filetype
* APPEND = SPACE
write_field_separator = i_separator
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = SPACE
* WRITE_LF = 'X'
* COL_SELECT = SPACE
* COL_SELECT_MASK = SPACE
* DAT_MODE = SPACE
* CONFIRM_OVERWRITE = SPACE
* NO_AUTH_CHECK = SPACE
* CODEPAGE = SPACE
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = SPACE
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* IMPORTING
* FILELENGTH =
CHANGING
data_tab = o_tab_table[]
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer =3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
SSF_FUNCTION_MODULE_NAME
SMARTFORMS输出报表时,生成一个函数名称,然后CALL这个名称
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME =CNS_SMART "SMARTFORMSの名称
IMPORTING
FM_NAME =W_FMNAME "SMARTFORMSの名称
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
* CALL FUNCTION W_FMNAME
* TABLES
* I_HEAD =I_HEAD
* EXCEPTIONS
* FORMATTING_ERROR = 1
* INTERNAL_ERROR = 2
* SEND_ERROR = 3
* USER_CANCELED = 4
* OTHERS = 5.
GRAPH_MATRIX_3D 把数据生成柱状3D
TIME_CHECK_PLAUSIBILITY 判断是不是时间
每天函数讲解系列----2006.02.11
Funtion:POPUP_TO_DECIDE_LIST
功能:弹出供选择窗口,最多25个选项,选择可以是单选按钮也可以是复选按钮,可以设定最多选择的个数。
参数:
Import:
CURSORLINE :默认光标所在行
MARK_FLAG:选择的标志,一般设为‘X’
MARK_MAX:最大选择的选项个数
START_COL:起始行
START_ROW :起始列,用来定位弹出窗口的位置
TEXTLINE1:文本行
TEXTLINE2:文本行
TEXTLINE3 :文本行
TITEL:弹出窗口的标题
DISPLAY_ONLY:仅显示
Export:
ANSWER:A:取消 空:做了选择
Tables:
T_SPOPLI:选择结果
例子:
REPORTZ_BOBO .
* 定义函数需要的变量
DATA: BEGIN OF SPOPLIST OCCURS 15.
INCLUDE STRUCTURE SPOPLI.
DATA: END OF SPOPLIST.
DATA: ANTWORT TYPE C.
* 添加选择参数
SPOPLIST-VAROPTION = 'Creditor'.
APPEND SPOPLIST.
SPOPLIST-VAROPTION = 'Material'.
APPEND SPOPLIST.
SPOPLIST-VAROPTION = 'Account '.
SPOPLIST-SELFLAG = 'X'.
CALL FUNCTION 'POPUP_TO_DECIDE_LIST'
EXPORTINGTITEL = 'Possible entra: Order'
TEXTLINE1 = 'By which criteria'
TEXTLINE2 = 'should orders'
TEXTLINE3 = 'be selected?'
MARK_MAX = 2
MARK_FLAG = 'X'
IMPORTINGANSWER = ANTWORT
TABLES T_SPOPLI = SPOPLIST
EXCEPTIONSTOO_MUCH_ANSWERS = 1
TOO_MUCH_MARKS = 2.
IF SY-SUBRC = 2.
WRITE: 'Toomany answers chosen.'.
ENDIF.
* 取消
IF ANTWORT = 'A'.
WRITE:'Popup canceled.'.
ELSE.
WRITE:'Options chosen:'.
LOOP ATSPOPLIST WHERE SELFLAG = 'X'.
WRITE: / SPOPLIST-VAROPTION.
ENDLOOP.
ENDIF.