on 10-11-2013 11:28 AM
Hi,
I am trying to solve this runtime error when executing my service from firefox rest client.
I have an entity called Expense Period (ExpPeriod) which has 3 integer fields, zmonth (abap type int2 mapped to Edm.Int16), zyear(abap type int2 mapped to Edm.Int16) and totalamount (CURR13 mapped to Edm.Decimal) in my properties in service builder.
Runtime artifacts are being generated and but it shows following error in response body:
- <?xml version="1.0" encoding="utf-8"?>
- <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
- <code>/IWFND/CM_BEC/026</code>
- <message xml:lang="en">RFC Error: Error when converting a numeric field to XML.</message>
- <innererror>
- <transactionid>1B5E32E30AD8F1F4BCAE00155D087807</transactionid>
- <errordetails/>
- </innererror>
- </error>
Any ideas?
Hi,
Can you put a breakpoint in the just before RFC call and see what is the error? You can see the stack trace from /IWBEP/ERROR_LOG and /IWFND/ERROR_LOG
http://help.sap.com/saphelp_gateway20sp06/helpdata/en/d4/8614377c394bd492edbde3295a518e/content.htm
https://help.sap.com/saphelp_gateway20sp06/helpdata/en/d4/8614377c394bd492edbde3295a518e/content.htm
Regards,
atanu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot for the reply. Detail analysis leads to the ST22 logs in the backend system, which point to the xml transformation related class (/IWBEP/IF_MGW_ODATA_ENTITY_PRV~WRITE_FEED_DATA)
See the picture below:
Metadata looks like this:
lo_property = lo_entity_type->create_property( iv_property_name = 'Description' iv_abap_fieldname = 'DESCRIPTION' ). "#EC NOTEXT
lo_property->bind_data_element( 'CHAR20' ).
lo_property->set_nullable( abap_true ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Totalamount' iv_abap_fieldname = 'TOTALAMOUNT' ). "#EC NOTEXT
lo_property->bind_data_element( 'CATSBWGRL' ).
lo_property->set_nullable( abap_true ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Employeenumber' iv_abap_fieldname = 'EMPLOYEENUMBER' ). "#EC NOTEXT
lo_property->bind_data_element( 'ZPERSNO' ).
lo_property->set_nullable( abap_true ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Zyear' iv_abap_fieldname = 'ZYEAR' ). "#EC NOTEXT
lo_property->set_is_key( ).
lo_property->bind_data_element( 'INT2' ).
lo_property->set_nullable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Zmonth' iv_abap_fieldname = 'ZMONTH' ). "#EC NOTEXT
lo_property->set_is_key( ).
lo_property->bind_data_element( 'INT2' ).
lo_property->set_nullable( abap_false ).
lo_entity_type->bind_structure( iv_structure_name = 'ZCL_ZCIT_EXPENSES_MPC=>TS_EXPPERIOD' ). "#EC NOTEXT
***********************************************************************************************************************************
* ENTITY SETS
***********************************************************************************************************************************
lo_entity_set = lo_entity_type->create_entity_set( 'ExpPeriods' ). "#EC NOTEXT
lo_entity_set->set_filter_required( abap_true ).
You are using Bind_structure for the entity and also doing binding for each property. That is not right.
If the structure you mention in bind_structure method has all the right types, then bind element for each property is not necessary. So you need to retain either binding at property level or binding at entity level.
I feel that these duplicate bindings might be causing some problem.
Once you make changes, clear metadata cache and run this again.
Thanks
Krishna
Well this is actually an autogenerated code from service builder (Imported via an RFC/BOR).
Surprisingly, this works fine for an another entity called expenses. Here is the metadata for the working entity:
lo_property = lo_entity_type->create_property( iv_property_name = 'Employeenumber' iv_abap_fieldname = 'EMPLOYEENUMBER' ). "#EC NOTEXT
lo_property->set_is_key( ).
lo_property->bind_data_element( 'ZPERSNO' ).
lo_property->set_nullable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Zmonth' iv_abap_fieldname = 'ZMONTH' ). "#EC NOTEXT
lo_property->set_is_key( ).
lo_property->bind_data_element( 'INT2' ).
lo_property->set_nullable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Zyear' iv_abap_fieldname = 'ZYEAR' ). "#EC NOTEXT
lo_property->set_is_key( ).
lo_property->bind_data_element( 'INT2' ).
lo_property->set_nullable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Totalamount' iv_abap_fieldname = 'TOTALAMOUNT' ). "#EC NOTEXT
lo_property->bind_data_element( 'CATSBWGRL' ).
lo_property->set_nullable( abap_true ).
lo_entity_type->bind_structure( iv_structure_name = 'ZCL_ZCIT_EXPENSES_MPC=>TS_EXPENSE' ). "#EC NOTEXT
Hi ,
Had the same error.
Just after re-activation it started working fine.
Got lot of insights while going through this discussion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A SAP note available for this topic "2036728 - Error when converting a numeric field to XML"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would suggest you to put a breakpoint just after the RFC is called and to check if the RFC is returning valid numerical values every time it is called.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could it be just user id defaults in SU01? Check the decimal notation. It could be returning commas as decimal points.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.