function - config
来源:互联网 发布:新经济政策知乎 编辑:程序博客网 时间:2024/05/22 11:55
data:lcl_json_stw TYPE REF TO cl_stw_parse_json.data:lr_root type REF TO cx_static_check. .
DATA: func TYPE string,
ptab TYPE abap_func_parmbind_tab,
ptab_line TYPE abap_func_parmbind,
etab TYPE abap_func_excpbind_tab,
etab_line TYPE abap_func_excpbind.
data:lo_result type REF TO data .
data:lo_param type REF TO data .
data:ls_fucfg type ztwm_fucfg .
FIELD-SYMBOLS:<fs_param> type any .
"the function has the importing parameter and table parameter .
loop at lt_fucfg into ls_fucfg .
ptab_line-name = ls_fucfg-PARAM ."参数明年
ptab_line-kind = ls_fucfg-KIND ."参数类型
if ls_fucfg-KIND = abap_func_tables."30
create data lo_result TYPE TABLE OF (ls_fucfg-TYPENAME).
ptab_line-value = lo_result .
else.
if ls_fucfg-KIND = abap_func_exporting ."10
create data lo_param type (ls_fucfg-TYPENAME) .
ptab_line-value = lo_param .
elseif ls_fucfg-KIND = abap_func_importing .
create data lo_result type (ls_fucfg-TYPENAME) .
ptab_line-VALUE = lo_result .
endif.
if ls_fucfg-KIND = abap_func_exporting ."10
if lcl_json_stw is INITIAL .
CREATE OBJECT lcl_json_stw.
endif.
TRY.
"change the content into the interal table
ASSIGN lo_param->* to <fs_param> .
CALL METHOD LCL_JSON_STW->JSON_TO_DATA
EXPORTING
IV_JSON = input-MT_WMS_SERVICE_REQ-CONTENT
CHANGING
C_DATA = <fs_param>.
CATCH CX_STW_TECHNICAL into lr_root .
* output-MT_WMS_SERVICE_RESP-CONTENT = lr_root->get_text( ) .
output-MT_WMS_SERVICE_RESP-CONTENT = lr_root->GET_LONGTEXT( ).
RETURN .
ENDTRY.
ptab_line-value = lo_param .
endif.
endif.
INSERT ptab_line INTO TABLE ptab.
ENDLOOP .
"the exception parameter
etab_line-name = 'OTHERS'.
etab_line-value = 1.
INSERT etab_line INTO TABLE etab.
func = ls_iftyp-FUNCT .
" call the funciton in run time
CALL FUNCTION func
PARAMETER-TABLE
ptab
EXCEPTION-TABLE
etab.
if sy-subrc ne 0 .
data:l_msg type char255 .
MESSAGE id sy-msgid TYPE sy-msgty NUMBER sy-msgno
with sy-msgv1 sy-msgv2 sy-MSGV3 sy-msgv4 into l_msg .
output-MT_WMS_SERVICE_RESP-CONTENT = l_msg .
else.
data: cl_serializer type ref to cl_trex_json_serializer.
data: json_data type string .
*data: lv_json type string .
FIELD-SYMBOLS:<fs> type any .
ASSIGN lo_result->* to <fs> .
if <fs> is ASSIGNED .
CREATE OBJECT cl_serializer
EXPORTING
data = <fs>.
cl_serializer->serialize( )."//转化为json
JSON_DATA = cl_serializer->get_data( ) .
*<<<处理特殊字符 &
REPLACE all OCCURRENCES OF '\&' in json_data with '&' .
output-MT_WMS_SERVICE_RESP-CONTENT = json_data .
endif.
endif.
0 0
- function - config
- some function config about IPV6
- Config
- .config
- config
- Config
- config
- config
- config
- config
- Config
- Config
- config
- config
- config
- config
- Deprecated: Function ereg_replace() is deprecated in x:\rootwww\dede\config.php on line
- phpmyadmin:Call to undefined function __() Config.class.php on line 755 解决办法
- 【android学习】handler用法与应对内存泄露
- 推荐系统开源软件列表汇总和点评
- 前端面试题汇总2
- O(nlog(n)) LCS 白书 P66例题27 UVa10635
- spark必须知道的几个观点
- function - config
- Linux下利用backtrace追踪函数调用堆栈以及定位段错误
- NodeJs实现数字翻转
- 糗百爬虫
- div+css布局小结
- dp和px互相转换的方法
- xUtils数据库第三方框架使用步骤
- 计算从[1,n]的素数个数
- JZOJ 4787. 数格子