cancel
Showing results for 
Search instead for 
Did you mean: 

Gateway Service Builder and Data Source Boolean Mapping

Steven_UM
Contributor
0 Kudos

Hi folks,

I am using the service builder to define my gateway ODATA services ...

I have some data model fields which are booleans and are defined as type 'Edm.Boolean' ...

I am unable to map those fields to RFC ABAP fields with domain 'BOOLEAN' (char 1) ... I am always getting the error:

Data source attribute ACTIVE and model property IsActive have different types

Message no. /IWBEP/SBDSP_DM031

I looked at the help documentation and did some searches here  but I could not find any specific information on the requirements for this EDM type ...

Thanks,

Steven

Accepted Solutions (0)

Answers (4)

Answers (4)

Steven_UM
Contributor
0 Kudos

Thanks folks for all the suggestions & replies ...

SP06 seems to have solved this issue apparently 🙂

Former Member
0 Kudos

Hi Steven,

I entered TIMESTAMPL as the data element ,  which worked for me.

Regards,

Vidya

Former Member
0 Kudos

By the way, I was looking at this document on MSDN, according to which EDM.Boolean can have true/false by default. Which means that C1 is not a ideal mapping for Boolean. EDM.Byte was mentioned as alternative to EDM.Boolean in one of the threads.

http://msdn.microsoft.com/en-us/library/vstudio/ee382832(v=vs.100).aspx

As you said this has been fixed in SP06, this i no longer valid.

Former Member
0 Kudos

Hello,

just now I ran into the same problem for a prototype implementation. Since I couldn't get around the error, I switched the type in the Entity Type back to Edm.String:

However, if I call my service/$metadata, it suprisingly yields an Edm.Boolean

<Property Name="Selected" Type="Edm.Boolean" Nullable="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>

Have a nice evening,

Björn

Former Member
0 Kudos

There doesn't seem to be an issue with C(1) and Edm.Boolean in SP6, it works fine. Code in that mentioned area has changed slightly.

Bjorn, you may find that the model cache needs to be cleared; it looks like the metadata is coming from the cached copy, not your update.

regards

Ron.

Former Member
0 Kudos

Hi Ron,

in my case, I am running on GW 2.0 SP6, but the error message does appear.

I did clear the metadata cache before posting my last message.

B.

Former Member
0 Kudos

Hi Björn,

For SP6, note 1803227 should solve the issue you are facing with the
errors for mapping an Edm.Boolean:

https://service.sap.com/sap/support/notes/1803227

Best regards,

Sagi

Steven_UM
Contributor
0 Kudos

Hi Folks,

Did some further debugging and to me this seems to be a BUG in the standard SAP code which determines the EDM type for the linked attribute data.

Method 'get_ds_attr_edm_type' of class '/IWBEP/CL_SBDSP_UTILITY' creates an internal data type with the internal length ( = 2 ) for a type C length 1 in a unicode system ...

when 'c' or 'n' or 'x'.
  create data lo_ds_dref type lv_ds_data_type) length lv_ds_int_length.

Then in method 'get_edm_type_from_ddic_type' of class '/iwbep/cl_mgw_med_edm_util' the length needs to be 'one' in order to potentially qualify as a 'boolean' ... but it is always '2' for a type C length 1 ... hence the mismatch ...

when cl_abap_typedescr=>typekind_char.

      rs_edm_type-core_type = /iwbep/if_mgw_med_odata_types=>gcs_edm_data_types-string.       "'Edm.String'.

      if ls_dfies is initial.         "Not a DDIC type, that is it is ABAP Core type

        rs_edm_type-length = rs_edm_type-length.  "number of characters

        rs_edm_type-internal_length = rs_edm_type-length * cl_abap_char_utilities=>charsize.  "length in bytes / Unicode needs double

     elseif rs_edm_type-length eq 1."boolean detection (guessing)

        if ls_dfies-domname cs 'BOOL'.

          rs_edm_type-core_type = /iwbep/if_mgw_med_odata_types=>gcs_edm_data_types-boolean.  "'Edm.Boolean'.

        endif.

      endif.

Hopefully somebody from the SAP gateway team is watching this   Will see whether we can create an OSS customer request as well ...

Regards,

Steven

Former Member
0 Kudos

Hi Steven,

Did you manage to find a solution to this.

I am having the same problem on Date and time fields.

Rod

Steven_UM
Contributor
0 Kudos

Hi Rod,

I didn't follow up on that issue unfortunately ... Maybe SAP has a SAP Note in the meanwhile for the above mentioned code ?

Regards,

Steven

Former Member
0 Kudos

Hi,

This is usually because the data type in the implementation is different that the data type in the model. Could you check out that?

Regards

Steven_UM
Contributor
0 Kudos

Hi Jorge,

Thanks for your feedback ...

At first sight there does not seem to be a difference in type ...

The model class defines it local type as:

isactive type c length 1,

The data dictionary domain linked with the actual field is 'BOOLEAN' which has the same data type 'C' with length '1'.

To me that seems like being identical .. not sure what the 'Edm.Boolean' type would otherwise expect ?

Thanks,

Steven

Former Member
0 Kudos

I am getting the exact error as well. I am trying to map a Timestamp field to ABAP timestamp datadomain. I tried setting the edm data type to edm.DateTime, edm.Decimal, Edm.float  and still getting the same error.

Please let me know how you solved this issue.

Rajesh Sundar

Steven_UM
Contributor
0 Kudos

Hi Rajesh,

Currently I don't have a solution yet ... will update this topic if I do ...

Regards,

Steven

Steven_UM
Contributor
0 Kudos

Hi Rajesh,

Did you check out the following SAP Note ?

Note 1763390 - Date Time data source mapping validations (SEGW transaction)

Regards,

Steven

Former Member
0 Kudos

Hi Steven,

    Thanks for your response. I checked this note already and this note is not relevant for my system. I am already at patch 6.

Rajesh Sundar

Steven_UM
Contributor
0 Kudos

Hi Rajesh,

Are you using a data element with one of the following domains ?

'TZNTSTMPS'
'TZNTSTMPL'

According to the code that's the only way to get an 'Edm.DateTime' back ...

Regards,

Steven