cancel
Showing results for 
Search instead for 
Did you mean: 

OData Edm.String to ABAP String conversion truncates the text

babu_kilari4
Active Contributor
0 Kudos
3,758

Hello Netweaver Gateway Experts,

We have a simple application wherein when clicked on a button on Fiori screen, it opens "To, Cc, Subject and Body" fields and we mapped the above four fields as Edm.String while backend fields mapping to String format. In the properties we entered the max length as 0. Upon clicking on "Send" button a function import gets called and the above four fields are passed to a Class-method that triggers the e-mail.

Now, sometimes users may type lot of data in the "Body" field and somehow for some reason the OData component truncates the data into 255 characters and sends the truncated e-mail to the user.

(1) Is there a workaround to solve this problem ? I tried to XSTRING, RAWSTRING as well but it didn't help.
(2) Is there a way to respect the formatting of the Body field. (Example:- Color, Carriage returns, Underline etc., )


Looking forward to your feedback on the above two. Cheers !

gregorw
Active Contributor

Perhaps you could share a sample OData service created on the ABAP developer edition using abapGit so it would be easier to replicate. But maybe also andre.fischer can bring some light into this issue. I hope you're using POST for this function import.

babu_kilari4
Active Contributor
0 Kudos

gregorw I will try to see how to post this to Abapgit. But, yes, I am using POST method for the function import. I am also looking forward to the response from andre.fischer

Cheers !

Accepted Solutions (0)

Answers (3)

Answers (3)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Babu,

I posted my working example as a blog post.

https://blogs.sap.com/2019/06/06/using-long-string-in-function-imports/

Publishing it via GITHUB takes a while due to SAP internal processes ;-).

Regards,

Andre

babu_kilari4
Active Contributor
0 Kudos

Hello andre.fischer Thank you so much for taking time to look into it and also to write a blog about it. I saw the screenshots and maybe the SP level that I am using is the real culprit wherein when I enter a Data element (or) not - it still truncates it to 255 characters.

I also noticed, in your tests there is random ABAP field name that you had chosen. But, I don't see that option as well. I only see an option to enter "Data Element". Irrespective of whether I enter the data element or not, it still truncates it to 255 characters. I will try to test it on higher SP level of NW GW system to confirm this.

Thank you so much for your patience.

Best Regards

Babu Kilari

babu_kilari4
Active Contributor
0 Kudos

andre.fischer Hello Andre, Today I tested this again in higher version

SAP_GWFND7520000-SAP Gateway Foundation 7.40

However, I still see that there is this truncation of characters happening ( to 255 ) although I passed 790. Screenshot below.

Truncated data:-

012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234

May I ask, what was the GW version you tested this successfully. You mentioned you could see it working on higher version of 740. May I ask what the release and SP level so that we can try to upgrade it accordingly. Thank you.

Babu Kilari

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Babu,

I can't reproduce your problem.

I defined the following function import.

And run the following URI

/sap/opu/odata/SAP/Z_FUNCTION_IMPORT_STRING2_SRV/SetDescription?SalesOrder='0500000000'&Description='012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'

And was able to pass a string with a length of 300 characters.

Regards,

Andre

babu_kilari4
Active Contributor
0 Kudos

andre.fischer Thank you so much for the response. Now, I got curious. May I ask, how exactly did you define the ABAP Field name "ZDESCRIPTION". What was the data element used there ?

My function import looks like the below

Data Element ZBODY is mapped to "STRING".

And. following is what I passed as input from GW Client. So, a total of 410 characters below...

/sap/opu/odata/SAP/ZTEST_ALIAS_SRV/EMAIL_TRIGGER/?TO='xyz@abc.com'&SUBJECT='Test'&BODY='01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'

Following is what I see in the parameters of the Function Import

But, if you look at the data in the field, it is truncated to 255 characters. Following is the final text received.

012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234

So, I am wondering if you got a chance to see the complete data at the backend ? Just for your info, we are using the following version

SAP_GWFND7400007SAPK-74007INSAPGWFNDSAP Gateway Foundation 7.40
babu_kilari4
Active Contributor
0 Kudos

gregorw Any thoughts on the above issue ?