cancel
Showing results for 
Search instead for 
Did you mean: 

OData service: unsupported format.

former_member592880
Participant
0 Kudos

hello,

I am working on posting log using odata service and I keep getting an error stating unsupported format.

I tried changing the content type to application/xml but that also didn't work.

where am i going wrong??

entityset

class

METHOD DATALOGSET_CREATE_ENTITY.
  DATA: IT_ENTITY TYPE ZCL_ZIOT_DATAENTRY_MPC=>TS_DATALOG,
        EXREF     TYPE REF TO CX_ROOT,
        IT_IOT    TYPE ZIOT_DATA_REC=>TT_IOT,
        WA_IOT    TYPE ZIOT_DATA_REC=>TS_IOT,
        G_REF     TYPE REF TO ZIOT_DATA_REC.
  CREATE OBJECT G_REF.


  TRY.
      CALL METHOD IO_DATA_PROVIDER->READ_ENTRY_DATA
        IMPORTING
          ES_DATA = IT_ENTITY.
    CATCH /IWBEP/CX_MGW_TECH_EXCEPTION INTO EXREF.
  ENDTRY.

  IF IT_ENTITY IS NOT INITIAL.
    CALL FUNCTION 'ABI_TIMESTAMP_CONVERT_FROM'
      EXPORTING
        IV_TIMESTAMP = IT_ENTITY-DATETIME
      IMPORTING
        O_DATE       = WA_IOT-POSTING_DATE
        O_TIME       = WA_IOT-POSTING_TIME
*       EXCEPTIONS
*         CONVERSION_ERROR       = 1
*         OTHERS       = 2
      .
    APPEND WA_IOT TO IT_IOT.

    CALL METHOD ZIOT_DATA_REC=>GET_DATA
      EXPORTING
        IM_IOT = IT_IOT
*        IMPORTING
*         EX_STATUS =
      .
  ENDIF.
ENDMETHOD.

service maintainance

input:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xml:base="http://IILTEST:8000/sap/opu/odata/sap/ZIOT_DATAENTRY_SRV/">
   <id>http://IILTEST:8000/sap/opu/odata/sap/ZIOT_DATAENTRY_SRV/dataLogSet</id>
   <title type="text">dataLogSet</title>
   <updated>2019-08-08T10:04:09Z</updated>
   <author>
      <name />
   </author>
   <link href="dataLogSet" rel="self" title="dataLogSet" />
   <entry>
      <id>http://IILTEST:8000/sap/opu/odata/sap/ZIOT_DATAENTRY_SRV/dataLogSet('0000000001')</id>
      <title type="text">dataLogSet('0000000001')</title>
      <updated>2019-08-08T10:04:09Z</updated>
      <category term="ZIOT_DATAENTRY_SRV.dataLog" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
      <link href="dataLogSet('0000000001')" rel="self" title="dataLog" />
      <content type="application/xml">
         <m:properties>
            <d:MachineId>0000000001</d:MachineId>
            <d:Set>Prod1</d:Set>
            <d:DateTime>2019-07-26T12:39:14</d:DateTime>
            <d:Approve>X</d:Approve>
            <d:Reject />
            <d:Hold />
         </m:properties>
      </content>
   </entry>
</feed>

error

please help

thanking in advance

Siddharth

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
former_member592880
Participant
0 Kudos

I checked the blog out, it talks more about passing the date to odata. I think,(i might be wrong) mine is giving issues on receiving it as the data I'm sending it is the one I got from it using the get_entityset method.

View Entire Topic
kyo_choi2
Participant
0 Kudos

You can also set the DateTime field Nullable. You can check Nullable in property.

former_member592880
Participant
0 Kudos
doesn't work, OData does not accept a blank date. you have to at least pass some blank value
kyo_choi2
Participant
0 Kudos

@sid4597 If the field is key field then you must fill it. Check the size of the field, it must be at least 8 character.