cancel
Showing results for 
Search instead for 
Did you mean: 

RFC Error: Error when converting a numeric field to XML

former_member184598
Participant
0 Kudos

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:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  3.   <code>/IWFND/CM_BEC/026</code>
  4.   <message xml:lang="en">RFC Error: Error when converting a numeric field to XML.</message>
  5.   <innererror>
  6.     <transactionid>1B5E32E30AD8F1F4BCAE00155D087807</transactionid>
  7.     <errordetails/>
  8.   </innererror>
  9. </error>

Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor
0 Kudos

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

former_member184598
Participant
0 Kudos

Thanks for the response, I couldn't make out much from the logs actually.

After debugging, I found out that RFC is giving right response to gateway classes and the error appears at the time of xml transformation. Tried clearing/deactivating metadata cache..did not help.

Any other idea?

kammaje_cis
Active Contributor
0 Kudos

You see three errors there. That means all three fields are failing. Any use clicking on the question mark next to errors to get the error long text?

Also can you show that part of the metadata for these three fields?

Thanks

Krishna

former_member184598
Participant
0 Kudos

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 ).

kammaje_cis
Active Contributor
0 Kudos

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

former_member184598
Participant
0 Kudos

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

former_member184598
Participant
0 Kudos

Hi Krishna,

Tried what you have suggested about the bindings in MPC_EXT class, cleared the cache on both systems and ran but still the error remains.

Regards,

Saumil Jyotishi

kammaje_cis
Active Contributor
0 Kudos

hmmm .. now it is tricky. The problem may be with the data that is coming out of RFC.

Against the each error you have (in the screenshot you gave earlier), there is a question mark and glass. If you click on them do you get more details?

Thanks

Krishna

former_member184598
Participant
0 Kudos

Yes, thats how I fixed it.

Had to remove some junk data from the tables because we had done some changes in keys after we created the entities.

Regards,

Saumil Jyotishi

Answers (4)

Answers (4)

pinakipatra
Contributor
0 Kudos

Hi ,

Had the same error.

Just after re-activation it started working fine.

Got lot of insights while going through this discussion.

Former Member
0 Kudos

Hi,

I am facing same issue, while rebuilding BWA. Could you please let me know, whether your issue is fixed after applying note: 2036728 - "Error when converting a numeric field to XML".

Thanks inadvance

Regards,

Siva

0 Kudos

A SAP note available for this topic "2036728 - Error when converting a numeric field to XML"

former_member184867
Active Contributor
0 Kudos

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. 

Former Member
0 Kudos

Could it be just user id defaults in SU01?  Check the decimal notation.  It could be returning commas as decimal points.