cancel
Showing results for 
Search instead for 
Did you mean: 

Getting an error while executing GET service

Former Member
0 Kudos

Hi Experts,

I have created an OData service(GET). Whenever I call the service from rest client I am getting an error like "In the context of Data Services an unknown internal server error occurred".

I checked in the NetWeaver system error log(/IWFND/ERROR_LOG) there it's showing error info like "Invalid format (return table): Row Number 1, Property Name 'XXXX',  Property Value 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.

Property type is Char, length 1250 and output type is 255 Char.

whenever property value contains 255 characters length of data at that time it's throwing the above error if property value contains less than 255 chars length of data at that time it's working as expected.

I checked metadata there the property max length is 255, I don't understand why it is still throwing an error.

Can you please help in this issue.

Thanks in advance.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Suman,

In MPC class => DEFINE method, for each field, we maintain its property. Similarly one of the property is of max length.

Eg: lo_property->set_maxlength( iv_max_length = 2 ).

In define method, if you have set the max length, then comment this line. The system will itself take care of length from the ABAP field which it's referring to.

Regards,

Aashika

SyambabuAllu
Contributor
0 Kudos

Hi Suman,

What is property type ..it means like Date?

Thanks,

Syam

kammaje_cis
Active Contributor
0 Kudos

Suman,

You are saying that maxlength as per metadata is 255. When you send more than 255 you are bound to get an error.

You may remove max length from SEGW, mark it as edm.string, generate runtime artefacts, ensure that max length is removed. Then try with lengths more than 255.

regards

Krishna

Former Member
0 Kudos

Hi Krishna,

I have created these service using SE80 not with SEGW.

Can you please suggest how can I remove max length. Max length will be defined based on the reference data type which we will give in the Model provider class.

So, is there any other solution for the same.

Thanks,

Suman

AshwinDutt
Active Contributor
0 Kudos

Hello Suman,

Put a Break-point in the appropriate method and check the format & length of data which u r getting as response from the back-end logic.

Based on this maintain appropriate length and data type in GW level.

U need to maintain appropriate Edm type & length in GW level based on the type of data u r mapping as GW response from the back-end logic.

However, the filed length which u maintain in GW level need to be same/greater than the length maintained in ur back-end logic.

Also u need to be careful regarding the length u maintain in GW level when u r dealing with other language text/characters.

For example if u sending back THAI text/characters as part of GW response from BackEnd, they occupy more space and sufficient length has to be maintained in the GW level.

Check the above points.

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin Thanks for your reply.

I checked all those things every where length and data types are same only..

but still I am facing the issue.

Thanks,

Suman

AshwinDutt
Active Contributor
0 Kudos

Hello Suman,

Did u debug and check ? What is the length of the data which u r getting from ur back-end logic ?

What is that data u r dealing with ? Share a sample data which u r getting from the Back-end.

Set it as a String and remove the MAX Length and check :

If u have written any code as shown in the highlighted section, then comment that.

lo_property->set_type_edm_string( ). - - > Make it as String

lo_property->set_maxlength( iv_max_length = 5 ). - - >Remove This line of code in ur MPC Class


I would suggest u to maintain the length and data type of the field same as that are maintained in ur Back-End logic.

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin,

I have debugged it I am getting data which is length 255 chars.

Property type is Char length is 255.

If I change the data type to String it will return data length more than 255 chars also in that case front end application will not be able to render it on the application.

There is no such code to restrict max length in MPC. But as I said max length will be defined based reference data type.

Any how Property type is CHAR length is 255 then it hold 255 chars length of data right that's what my concern.

Thanks,

Suman

AshwinDutt
Active Contributor
0 Kudos

Hello Suman,

Now can u please add the below code and check again ?

Add this in the MPC class of ur service.

lo_property->set_maxlength( iv_max_length = 255 ).

When u don't have direct access to ur back-end metadata ( domain i mean ),

Explicitly specify the appropriate Edm Type and Length in GW Model Class.

U need to note its good to Maintain the length of the filed in the structure only which u have created to bind to ur entity.

Good to have the below code :

lo_property->set_type_edm_string( ).

lo_property->set_maxlength( iv_max_length = 255 ).

If u have direct access to ur back-end metadata,

Then some times need not to write the code which is highlighted. Just having lo_property->set_type_edm_string( ). will work.

Because when u bind the structure the field would be referring directly to field which is in ur back-end since u have access to the domain directly.

lo_property->set_type_edm_string( ).

lo_property->set_maxlength( iv_max_length = 255 ).

But However i would suggest to maintain the length in GW model irrespective of u having access to metadata or not.

Please clear ur GW Model Cache also in /iwfnd/cache_cleanup when ever u change the model of ur GW and then check.

Regards,

Ashwin