07-05-2021 10:31 AM
Can anyone tell my why is everything in my ABAP Type Editor actually uneditable?
I'm trying to create odata service and as you can see in messages below I came across some warnings. I tried to change Type Kind to PACKED, length to 8 and Decimals to 0, but I was unable to do that cuz I cant edit anything in ABAP Type Editor.
If anyone have an answer to how I can change this to be editable or some other way to fix my problem I would be very pleased 🙂
Here is a prtsc of my issue.
07-05-2021 10:50 AM
Hi Bojan,
Please try changing the mode to 'Explicit Assignment'.
Check out Mappings and ABAP Type Editor on the SAP Help Portal for more info.
Regards,
Laurens
07-05-2021 11:13 AM
Thank you for you answer Lauren,
The thing is that I can't change anything in ABAP Type editor. Like I said its uneditable whatever I do. I tried clicking on the highlighted button but it doesn't make it editable. Do you have any other proposal?
07-05-2021 11:32 AM
That is strange indeed.
Can you debug the event handler for the button and check the logical that is executed?
You can put a breakpoint in method HANDLE_COMMAND_SB_EDIT of class /IWBEP/CL_SBUI_CONTROLLER.
07-05-2021 1:24 PM
I am fairly new to SAP, but I managed to place the brakepoint there and debugger caught it when I clicked on the button but I couldn't see where the problem is. I don't get it, when I click on the highlighted button from the picture in my last comment, everything else gets changed from "display" to "change" mode except that ABAP Type Editor window.
07-05-2021 1:36 PM
dep
Is there any other way to resolve these 2 problems I have?
Thanks for the answers in advance.
07-05-2021 2:52 PM
Your primary goal should be to understand why the framework is warning you.
From Mappings and ABAP Type Editor:
"Exact correlations between ABAP types and EDM types are not always possible due to their individual facets and the automatic determination of a corresponding ABAP or EDM type might not be a perfect match."
It's up to you as the developer to determine whether or not specific warnings need to be addressed.
In your example, you should be able to ignore the warnings without complications. Alternatively, you can opt to work around them.
For example, the first warning indicates that an ABAP field of type 'Date' is mapped to an Edm.DateTime property.
The ABAP field only stores the date itself and no time information (in contrast to the suggested TIMESTAMPL data type). The framework did the mapping this way is because there is no date-only data type in OData 2.0.
That said, there is a primitive data type for dates, Edm.Date, in OData v4. If your system supports it you could opt to create an OData V4 service in SEGW.
07-06-2021 7:45 AM
I understood the mapping problem of it, but as far as I could see for now the solution to that problem is changing things in ABAP type editor (which I can't for some strange reason). I tried just ignoring this warning, but when I try to fetch the data in gateway client it gives me status_code 500.
Thanks anyway for the explanation, it helped. I'll continue looking for the solution. If something comes to mind, feel free to comment again. 🙂
07-06-2021 8:16 AM
Without an error message or abnormal behavior in the debugger I don't have any further ideas concerning the type editor. Have you tried manually correcting the data type for the currency amounts (Hsl, Ksl, etc.)?
Try adjusting from precision 24, scale 3 to precision 23, scale 2.
07-06-2021 8:23 AM
Great suggestion! That did help remove the warnings for Hsl and Ksl. I will try to look further into debugger, maybe that I am overlooking something. Only data type for dates is left to be resolved.
07-06-2021 9:32 AM
07-07-2021 9:12 AM
dep
Hi Laurens, I tried using Odata v4 as you suggested. I managed to register it, its just that now Im not sure how and where do I write my query to get all the data I need from the database so I can consume it afterwards. In Odata v2 I just wrote select statement in GetEntitySet, but here I don't have that option. This is a basic question, I know, I would appreciate an answer to it.
Thanks for your time.
p.s. I followed these steps https://blogs.sap.com/2020/02/13/implementation-of-sap-odata-v4/ but still couldn't achieve my goal.
07-07-2021 9:29 AM
Hi Bojan,
One of the biggest drawbacks of OData V4 is indeed that it is new (relatively speaking) and the bulk of the online documentation today will be about OData V2 implementations. Definitely something to keep in mind when making a decision.
To get the data for your entity or entity set you can redefine the method /iwbep/if_v4_dp_basic~read_entity or /iwbep/if_v4_dp_basic~read_entity_list respectively. Check out the documentation on interface /IWBEP/IF_V4_DP_BASIC.
Good luck!