资金管理电子支付集成EPIC_PROC相关设置步骤。
1.电子支付集成
1.1定义银行通信类型
1.2RFC Destination设置(TCODE:SM59)
SM59-外部服务器HTTP连接
1.3定义银行通信详细信息
1.4XML格式转换(TCODE:STRANS)
1 <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" exclude-result-prefixes="asx" version="1.0"> 2 3 <xsl:strip-space elements="*"/> 4 5 <xsl:template match="/asx:abap/asx:values/PARAMETERS"> 6 7 <fdlk> 8 9 <code> 10 <xsl:value-of select="CODE"/> 11 </code> 12 13 <batchNo> 14 <xsl:value-of select="BATCHNO"/> 15 </batchNo> 16 17 <nodeId> 18 <xsl:value-of select="NODEID"/> 19 </nodeId> 20 21 <channelId> 22 <xsl:value-of select="CHANNELID"/> 23 </channelId> 24 25 <ackCode> 26 <xsl:value-of select="ACKCODE"/> 27 </ackCode> 28 29 <clientId> 30 <xsl:value-of select="CLIENTID"/> 31 </clientId> 32 33 <clientName> 34 <xsl:value-of select="CLIENTNAME"/> 35 </clientName> 36 37 <txDateTime> 38 <xsl:value-of select="TXDATETIME"/> 39 </txDateTime> 40 41 <data> 42 43 <BillTx> 44 45 <sourceId> 46 <xsl:value-of select="BILLTX/SOURCEID"/> 47 </sourceId> 48 49 <txType> 50 <code> 51 <xsl:value-of select="BILLTX/TXTYPE/CODE"/> 52 </code> 53 <name> 54 <xsl:value-of select="BILLTX/TXTYPE/NAME"/> 55 </name> 56 </txType> 57 58 <paperBill> 59 <xsl:value-of select="BILLTX/PAPERBILL"/> 60 </paperBill> 61 62 <acceptBank> 63 <bankNo> 64 <xsl:value-of select="BILLTX/ACCEPTBANK/BANKNO"/> 65 </bankNo> 66 67 <frontNodeId> 68 <xsl:value-of select="BILLTX/FRONTNODEID"/> 69 </frontNodeId> 70 71 <txDate> 72 <xsl:value-of select="BILLTX/TXDATE"/> 73 </txDate> 74 75 <comment> 76 <xsl:value-of select="BILLTX/COMMENT"/> 77 </comment> 78 79 <list> 80 <xsl:for-each select="BILLTX/BILLINFO/ZSTR0720_BILLINFO"> 81 <BillInfo> 82 <billId> 83 <xsl:value-of select="BILLID"/> 84 </billId> 85 <billNo> 86 <xsl:value-of select="BILLNO"/> 87 </billNo> 88 </BillInfo> 89 </xsl:for-each> 90 91 </list> 92 93 <reserved1> 94 <xsl:value-of select="BILLTX/RESERVED1"/> 95 </reserved1> 96 97 <reserved2> 98 <xsl:value-of select="BILLTX/RESERVED2"/> 99 </reserved2> 100 101 <reserved3> 102 <xsl:value-of select="BILLTX/RESERVED3"/> 103 </reserved3> 104 105 <reserved4> 106 <xsl:value-of select="BILLTX/RESERVED4"/> 107 </reserved4> 108 109 <reserved5> 110 <xsl:value-of select="BILLTX/RESERVED5"/> 111 </reserved5> 112 113 </BillTx> 114 115 </data> 116 </fdlk> 117 118 </xsl:template> 119 </xsl:transform>
1.5发送HTTP请求至目标系统
参考类CL_EPIC_QC_UIL方法SEND_QUERY_TO_BANK ,发送XML至目标系统
参考类CL_EPIC_BANK_COMM_SERV
创建类ZCTR0110并调用接口IF_EPIC_BANK_COMM_IMPL重写类方法
1.5.1方法IF_EPIC_BANK_COMM_IMPL~CREATE_REQUEST
校验数据表EPIC_C_BCD
将内表数据转化为XML:
call transformation XML模板文件名
source parameters = 表结构
result xml String变量.
String转XString十六进制:
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = cv_message
IMPORTING
buffer = cv_xstring
EXCEPTIONS
failed = 1
OTHERS = 2.
1.5.2方法IF_EPIC_BANK_COMM_IMPL~PROCESS_RESPONSE
XML格式处理:
lo_conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
call method lo_conv->convert
exporting
data = lv_string
importing
buffer = lv_xstring.
call transformation (ls_boeintf-file_response)
source xml lv_xstring
result response = ls_result.
1.5.3方法IF_EPIC_BANK_COMM_IMPL~ADJUST_HTTP_REQUEST
zctr0010=>conv_cdata_into_soap(
changing
co_request = cr_request
).
1 METHOD conv_cdata_into_soap. 2 3 TYPES : BEGIN OF ty_xml, 4 soap_tag TYPE ztap0070-soap_tag, 5 tag_content TYPE string, 6 END OF ty_xml. 7 8 DATA lt_xml TYPE TABLE OF ty_xml VALUE IS INITIAL. 9 10 SELECT 11 soap_tag 12 tag_content 13 FROM ztap0070 14 INTO CORRESPONDING FIELDS OF TABLE lt_xml. 15 16 "获取原来的CDATA数据 17 DATA lv_message TYPE string VALUE IS INITIAL. 18 19 co_request->get_cdata( 20 RECEIVING 21 data = lv_message ). 22 23 "将sopa前面的标准格式删除 24 zctr0010=>conv_and_delete_soap_for_str( CHANGING cv_message = lv_message ). 25 26 "将值赋值到CDATA标签内 27 READ TABLE lt_xml ASSIGNING FIELD-SYMBOL(<fs_xml>) WITH KEY soap_tag = '5'. 28 29 CHECK sy-subrc = 0. 30 31 <fs_xml>-tag_content = lv_message. 32 UNASSIGN <fs_xml>. 33 34 "重新组织XML 35 CLEAR lv_message. 36 37 SORT lt_xml BY soap_tag. 38 39 LOOP AT lt_xml ASSIGNING <fs_xml>. 40 lv_message = lv_message && <fs_xml>-tag_content. 41 ENDLOOP. 42 43 "重新赋值 44 "先转成XSTRING 45 DATA lv_buffer TYPE xstring VALUE IS INITIAL. 46 47 CALL FUNCTION 'SCMS_STRING_TO_XSTRING' 48 EXPORTING 49 text = lv_message 50 IMPORTING 51 buffer = lv_buffer 52 EXCEPTIONS 53 failed = 1 54 OTHERS = 2. 55 56 DATA lt_bin_table TYPE sdokcntbins VALUE IS INITIAL. 57 DATA lv_bin_len TYPE i VALUE IS INITIAL. 58 59 "再转成2进制 60 CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' 61 EXPORTING 62 buffer = lv_buffer 63 IMPORTING 64 output_length = lv_bin_len 65 TABLES 66 binary_tab = lt_bin_table. 67 68 "再将2进制转成标准字符串 69 DATA lv_out_len TYPE i VALUE IS INITIAL. 70 71 CLEAR lv_message. 72 73 CALL FUNCTION 'SCMS_BINARY_TO_STRING' 74 EXPORTING 75 input_length = lv_bin_len 76 encoding = '4110' 77 IMPORTING 78 text_buffer = lv_message 79 output_length = lv_out_len 80 TABLES 81 binary_tab = lt_bin_table 82 EXCEPTIONS 83 failed = 1 84 OTHERS = 2. 85 86 co_request->set_cdata( 87 EXPORTING 88 data = lv_message 89 ). 90 91 "计算报文长度 92 DATA lv_len_str TYPE ihttpnvp-value VALUE IS INITIAL. 93 94 lv_len_str = lv_bin_len. 95 CONDENSE lv_len_str. 96 97 co_request->set_header_field( 98 EXPORTING 99 name = 'Content-Type' 100 value = 'application/xml;charset=UTF-8' 101 ). 102 103 co_request->set_header_field( 104 EXPORTING 105 name = 'Content-Length' 106 value = lv_len_str 107 ). 108 109 ENDMETHOD.
1.7接收目标系统HTTP请求
创建类并调用接口IF_HTTP_EXTENSION并重写
1 method if_http_extension~handle_request. 2 data:lr_dref type ref to data. 3 data:lt_return type table of zsap0010, 4 lt_0820 type table of zttr0820. 5 data:ls_boeintf type zttr0700 value is initial, 6 ls_initial type ty_init value is initial. 7 "调用函数模块,检查数据并保存,然后将返回数据转换成报文返回给九恒星 8 data ls_result type zsap0040 value is initial. 9 data:lv_request_method type string, 10 lv_msgv1 type syst_msgv, 11 lv_msgv2 type syst_msgv, 12 lv_error type c. 13 field-symbols: 14 <fs_any> type any. 15 16 try. 17 18 lv_request_method = server->request->get_header_field( name = '~request_method' ). 19 20 if lv_request_method <> 'POST'. 21 raise exception type zcx_tr0100 22 exporting 23 msgid = 'ZMCTR0040' 24 msgno = '084' 25 msgty = 'E' 26 msgv1 = space 27 msgv2 = space 28 msgv3 = space 29 msgv4 = space . 30 endif. 31 32 data lv_string type string value is initial. 33 data lv_xstring type xstring value is initial. 34 35 lv_string = server->request->get_cdata( ). 36 lv_xstring = server->request->get_data( ). 37 38 zctr0010=>conv_and_delete_soap_for_str( 39 changing 40 cv_message = lv_string 41 cv_xstring = lv_xstring ). 42 43 "将报文数据转换成结构数据 44 data ls_sign_result_request type ty_xyty value is initial. 45 data ls_result_initial type ty_init value is initial. 46 data lo_transformation_error type ref to cx_transformation_error value is initial. 47 48 try. 49 "获取初始CODE值 50 call transformation ztr_boe_initial_request 51 source xml lv_xstring 52 result response = ls_result_initial. 53 54 move-corresponding ls_result_initial to ls_initial. 55 56 catch cx_transformation_error into lo_transformation_error. 57 lv_msgv1 = gc_jhx. 58 lv_msgv2 = lo_transformation_error->get_text( ). 59 raise exception type zcx_tr0100 60 exporting 61 msgid = 'ZMCTR0040' 62 msgno = '000' 63 msgty = 'E' 64 msgv1 = lv_msgv1 65 msgv2 = lv_msgv2 66 msgv3 = space 67 msgv4 = space . 68 endtry. 69 70 "报文存储 71 resource_xml_save( 72 exporting 73 iv_code = ls_initial-code 74 iv_batchno = ls_initial-batchno 75 iv_boeintf = space 76 iv_xstring = lv_xstring 77 changing 78 it_0820 = lt_0820 79 ). 80 81 "根据CODE及接口类型获取参数 82 select single * 83 into ls_boeintf 84 from zttr0700 85 where zptype = gc_response 86 and code = ls_result_initial-code. 87 if sy-subrc <> 0. 88 lv_msgv1 = gc_response. 89 lv_msgv2 = ls_result_initial-code. 90 91 raise exception type zcx_tr0100 92 exporting 93 msgid = 'ZMCTR0040' 94 msgno = '066' 95 msgty = 'E' 96 msgv1 = lv_msgv1 97 msgv2 = lv_msgv2 98 msgv3 = space 99 msgv4 = space . 100 endif. 101 102 "获取动态结构 103 dynamic_stru_create( 104 exporting 105 iv_struname = ls_boeintf-stru_request 106 importing 107 et_data = lr_dref ). 108 109 assign lr_dref->* to <fs_any>. 110 111 try. 112 "根据动态结构解析数据 113 call transformation (ls_boeintf-file_request) 114 source xml lv_xstring 115 result response = <fs_any> . 116 117 catch cx_transformation_error into lo_transformation_error. 118 lv_msgv1 = gc_jhx. 119 lv_msgv2 = lo_transformation_error->get_text( ). 120 121 move-corresponding <fs_any> to ls_result. 122 ls_result-resultcode = text-101. 123 ls_result-resultmsg = text-103 && lv_msgv2. 124 125 raise exception type zcx_tr0100 126 exporting 127 msgid = 'ZMCTR0040' 128 msgno = '000' 129 msgty = 'E' 130 msgv1 = lv_msgv1 131 msgv2 = lv_msgv2 132 msgv3 = space 133 msgv4 = space . 134 endtry. 135 136 137 ls_result = me->call_function( 138 exporting 139 iv_xstring = lv_xstring 140 is_boeintf = ls_boeintf 141 is_initial = ls_initial 142 is_request = <fs_any> 143 importing 144 ev_error = lv_error 145 changing 146 it_0820 = lt_0820 147 ). 148 149 "将返回结果转成报文 150 data lv_response_string type string value is initial. 151 152 try. 153 154 call transformation (ls_boeintf-file_response) 155 source parameters = ls_result 156 options xml_header = 'no' 157 result xml lv_response_string 158 parameters encoding = 'UTF-8'. 159 160 catch cx_transformation_error into lo_transformation_error. 161 lv_msgv1 = gc_jhx. 162 lv_msgv2 = lo_transformation_error->get_text( ). 163 raise exception type zcx_tr0100 164 exporting 165 msgid = 'ZMCTR0040' 166 msgno = '000' 167 msgty = 'E' 168 msgv1 = lv_msgv1 169 msgv2 = lv_msgv2 170 msgv3 = space 171 msgv4 = space . 172 endtry. 173 174 server->response->set_cdata( lv_response_string ). 175 176 "反馈报文存储 177 response_string_save( 178 exporting 179 is_0040 = ls_result 180 it_0820 = lt_0820 181 it_return = lt_return 182 iv_string = lv_response_string 183 ). 184 185 save_message( ). 186 187 catch zcx_tr0100 into data(lr_tr0100). 188 get_message( 189 exporting 190 ir_tr0100 = lr_tr0100 191 importing 192 et_return = lt_return 193 ). 194 195 if ls_result is not initial. 196 call transformation (ls_boeintf-file_response) 197 source parameters = ls_result 198 options xml_header = 'no' 199 result xml lv_response_string 200 parameters encoding = 'UTF-8'. 201 endif. 202 203 "反馈报文存储 204 response_string_save( 205 exporting 206 is_0040 = ls_result 207 it_0820 = lt_0820 208 it_return = lt_return 209 iv_string = lv_response_string 210 ). 211 212 save_message( ). 213 endtry. 214 215 endmethod.
2.付款F110
2.1设置所有公司代码及付款公司代码
2.2国家支付方式
DMEE格式设置
3.付款申请F111