cancel
Showing results for 
Search instead for 
Did you mean: 

Getting an error while calling GW service from rest client

Former Member
0 Kudos

Hi Experts,

I Have developed GW Service using Odata Channel in that i have developed A Function Module for the there two import parameters i.e WKSTRT_DATE (Data Ele: DATS) and WKEND_DATE (Data Ele: DATS). for this i am passing input from web Browser Rest Client as (http://server_name:8000/sap/opu/odata/sap/service_name?$filter=WKSTRT_DATE eq '12112012'&$filter=WKEND_DATE eq '12112012'). for this i am getting an error which mentioned below

<error>

<code>005056A509B11ED199D891E6C1C14103</code>

<message xml:lang="en">Invalid parametertype used at function 'eq'</message>

</error>


and i tried with all the date formats like(DDMMYYYY, MMDDYYYY, DD/MM/YYYY, MM/DD/YYYY, YYYY/MM/DD, YYYY/DD/MM, DD.MM.YYYY, MM.DD.YYYY)

Can any one please tell me how i should resolve.


Accepted Solutions (0)

Answers (1)

Answers (1)

jibin_joy
Contributor
0 Kudos

Hi Suman,

   Follow Odata Doc ( Plz ref topic Primitive data types)

http://www.odata.org/documentation/overview

Date has to be passed has datetime'2012-11-23T00:00'

Regards,

Jibin Joy

Former Member
0 Kudos

Hi Jibin,

Thanks for your reply.

But in my project i am getting date fields as MMDDYYYY .

Actually what happened in my project is one screen is there it has date range search criteria i.e WKSTRT_DATE and WKEND _DATE, this dates is input fields to SAP Service.  Hence i defined WKSTRT_DATE & WKEND_DATE fields as DATS Data type fields in my service Model Provider Class and Function Module.

So, Can you please tell me how to resolve this error.

jibin_joy
Contributor
0 Kudos

Hi Suman,

   This Format is defined by  Odata Protocol so we have to pass date as datetime'yyyy-mm-ddThh:mm[:ss[.fffffff]]' NOTE: Spaces are not allowed between datetime and quoted portion. datetime is case-insensitive.

    Most probably its SAP Netweaver Gateway  Job for date format conversion based on the Domain .

If u r still getting error ... can u post me error response

Regards,

Jibin Joy

  


Former Member
0 Kudos

Hi Jibin,

I tried with this format 'yyyy-mm-ddThh:mm[:ss[.fffffff]]'

but still i am getting same error

i.e

<error>

<code>005056A509B11ED199D891E6C1C14103</code>

<message xml:lang="en">Invalid parametertype used at function 'eq'</message>

</error>

jibin_joy
Contributor
0 Kudos

Hi,

     http://server_name:8000/sap/opu/odata/sap/service_name?$filter=IWKSTRT_DATE eq datetime'2012-10-18T00:00:00' and WKEND_DATE eq datetime'2012-10-20T00:00:00'

If still getting error can u post if ur metadata

Need one more query

       R u doing RFC mapping or custom Coding .

Regards,

Jibin Joy


Former Member
0 Kudos

Hi Jibin,

Still i am getting error

i.e

<error>

<code>005056A509B11ED199D88292AB9400FE</code>

<message xml:lang="en">

In the context of Data Services an unknown internal server error occured

</message>

</error>


and Metadata is

<edmx:Edmx Version="1.0">

<edmx:DataServices m:DataServiceVersion="2.0">

<Schema Namespace="SERVICE_NAME" xml:lang="en">
<EntityType Name="....." sap:content-version="1">
<Key>
<PropertyRef Name="WKSTRT_DATE"/>

</Key>

<Property Name="WKSTRT_DATE" Type="Edm.DateTime" Nullable="false" sap:label="Date/Time"/>

<Property Name="WKEND_DATE" Type="Edm.DateTime" sap:label="Date/Time"/>

<Property Name="WBS_NO" Type="Edm.String" MaxLength="24" sap:label="Wbs Element"/>

<Property Name="CHD_PERSON" Type="Edm.String" MaxLength="12" sap:label="Changed by"/>

<Property Name="NOTE_TITLE" Type="Edm.String" MaxLength="30" sap:label="Smart Note Title"/>

<Property Name="TIME_STAMP" Type="Edm.String" MaxLength="14" sap:label="Date/Time"/>

<Property Name="SN_MESSAGE" Type="Edm.String" MaxLength="255" sap:label="SNMesg"/>

</EntityType>
<EntityContainer Name="SERVICE_NAME" m:IsDefaultEntityContainer="true">

<EntitySet Name="...Collection" EntityType="SERVICE_NAME....." sap:content-version="1"/>

</EntityContainer>

</edmx:DataServices>

And I am using RFC mapping


jibin_joy
Contributor
0 Kudos

Hi Suman,

  

     In SEGW ,  Entity Property  with the Type Edm.DateTime  nullable Flag has to be set .

In Above Metadata , WKSTRT_DATE nullable flag is  false make it true .

      

Goto Tcode /iwfnd/error_log ....

   Can u find the error Information

If  u r still getting error .

Can u post me screen shot for  list of error in getting /iwfnd/error_log

Regards,

Jibin Joy

Former Member
0 Kudos

Hi Jibin,

I am passing date fields from rest client as  datetime'2012-11-12T00:00:00' and datetime'2012-11-12T23:59:59'.

and i have defined date fields in GET_ENTITY and GET_ENTITYSET methods as DATS Type will it convert rest client format or we need to convert. 

Can you please tell me.

jibin_joy
Contributor
0 Kudos

Hi Suman,

    Based on my observation SAP NetWeaver Gateway will convert it (Rest client is just and it will not convert  ). Rest client will send request  to SAP NetWeaver Gateway  . Gateway convert this protocol information to SAP technical information ,After all things are done  it will call Mapped RFC .

Try to write  datetime'2012-11-12T00:00:00' instead datetime'2012-11-12T23:59:59'      because  field are defined as dats so it will not consider timestamp (there are some chance of throwing error ).

Data lv_date type dats. (yyyy/mm/dd)

Data lv_timestamp type timestamp.

datetime'2012-11-12T00:00:00'   -> lv_date (20121112)

datetime'2012-11-12T23:59:59'  ->  lv_timestamp (20121112235959)

datetime'2012-11-12T23:59:59'  ->  No idea

R u getting the same error as mentioned above.

Regards,

Jibin Joy

Former Member
0 Kudos

Hi Jibin,

Thanks For your reply.

Now i am passing input dates as

datetime'2012-11-12T00:00:00' and datetime'2012-11-12T23:59:59' to rest client, it is not allowing other than this date foramt.

so i changed my input parameters to TIMESTAMP type in methods (get_entity & get_entityset) and RFC also. But now i am not getting any error and its not fetching any data just giving below response


<<title type="text">PODCollection</title>

<updated>2012-11-23T09:55:45Z</updated>

<author>

<name/>

</author>

<link href= "PODCollection" rel="self" title="PODCollection"/>

</feed>

Let me know one thin, we are passing date formats as datetime'2012-11-12T00:00:00' from rest client. In which format get_entity & get_entityset methods take it as input. because methods can passing input to RFC.

Can you please tell me.



jibin_joy
Contributor
0 Kudos

Hi suman,

    it has mentioned in above post

   Can post me the screen shoot  for Rest client Request Information.

Regards,

Jibin Joy

jibin_joy
Contributor
0 Kudos

Hi Suman,

datetime'2012-11-12T00:00:00'   -> lv_date (20121112)

datetime'2012-11-12T23:59:59'  ->  lv_timestamp (20121112235959)

datetime'2012-11-12T23:59:59'  ->  No idea For lv_date (Never tried)

Former Member
0 Kudos

Hi Jibin,

Here i am posting the screen shoot for rest client Info.

Former Member
0 Kudos

k Jibin,

datetime'2012-11-12T23:59:59'  ->  lv_timestamp (20121112235959)

You have any idea about how to convert


datetime'2012-11-12T23:59:59' to lv_timestamp (20121112235959)

Which you posted in the earlier post

jibin_joy
Contributor
0 Kudos

Hi Suman,

Trouble Shoot

1. http://host_name:8000/sap/opu/odata/sap/service_name?$filter=IWKSTRT_DATE eq datetime'2012-10-18T00:00:00' and WKEND_DATE eq datetime'2012-10-20T00:00:00'

combine Both Filter as mentioned above.

2. Put debug in that RFC FM and check  both field data Format

   Based on my Gateway knowledge , it has to handle date formats but dont know to covert explicitly.anyway try above produces .

Reagards,

Jibin Joy