Entity and SAP B1 RRS feed

  • Question

  • Hello everyone. I am writing to you because I would like to have a recommendation.
    We are developing an c# application that communicates with an SAP B1 system.
    To communicate we use an API created by SAP that stores the information in the database (only through the API can be done, I can't do the insert directly in the database). 

    When the Entity generates the entities, it creates fields of type Decimal. The problem I have is that the SAP API does not accept fields of type Decimal, it only accepts Double type. (I do not know why)

    I was thinking about the following solutions:
    1- Every time I send the Entity's data to SAP and I find a field of Decimal type, I'll convert it to Double (I do not like it very much because I had to be doing the casting of data every time I save).
    2- Modify the TT of the Entity so when it is a Decimal field I will create a Double attribute in POCO class instead of Decimal (I do not know if this is possible)

    Thanks in advance for your help,

    • Edited by Jose Elias Wednesday, April 4, 2018 3:14 PM
    Wednesday, April 4, 2018 4:32 AM

All replies

  • You could just  map the entity data over to a DTO and use the DTO.


    Wednesday, April 4, 2018 9:46 PM
  • Hi Jose Elias,

    I would suggest that you could write partial class and add a double property in it, which could convert decimal property to double, like this:


    public partial class MyEntity
     public double MyValueAsDouble
       return Convert.ToDouble(MyValue);
       MyValue = Convert.ToDecimal(value);

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 5, 2018 2:09 AM