2018 Jan 13 4:59 PM
Hello SAP Gurus,
I was facing in a issue. Check the below example -
Request uri - sap/odata/sap/yodata_test_srv/salesorders(vblen = '001')
Get entity method, I have store an internal table in instance variable t1(table type).
But when I heat a new uri. Uri- sap/odata/sap/yodata_test_srv?$filter=(vbeln ge '001' and vbeln le '002') It calls get entity set method , where I want to access internal table t1.
It's not working
2018 Jan 13 6:31 PM
1. URL - sap/odata/sap/yodata_test_srv/salesorders(vblen = '001')
-> Here you are passing key (VBELN='001') and hence you are requesting a single record - Hence GET_ENTITY method is invoked.
2. URL - sap/odata/sap/yodata_test_srv?$filter=(vbeln ge '001' and vbeln le '002')
-> Here you are explicity specifying a filter which means you want to refine the data retrieved based on condition. - There is a possibility of multiple records which can be returned. - Hence GET_ENTITYSET is invoked.
3. All OData calls are based on REST protocol and are stateless. This means every call is independent and data stored either in instance or in static attributes in one call cannot be utilized in another call.
Please read upon the fundamental priniciples and literature on this.
2018 Jan 13 6:31 PM
1. URL - sap/odata/sap/yodata_test_srv/salesorders(vblen = '001')
-> Here you are passing key (VBELN='001') and hence you are requesting a single record - Hence GET_ENTITY method is invoked.
2. URL - sap/odata/sap/yodata_test_srv?$filter=(vbeln ge '001' and vbeln le '002')
-> Here you are explicity specifying a filter which means you want to refine the data retrieved based on condition. - There is a possibility of multiple records which can be returned. - Hence GET_ENTITYSET is invoked.
3. All OData calls are based on REST protocol and are stateless. This means every call is independent and data stored either in instance or in static attributes in one call cannot be utilized in another call.
Please read upon the fundamental priniciples and literature on this.
2018 Jan 14 6:08 AM
Is there any way to get that internal table to my second method call? or, any way to store the internal table (not in db table).
2018 Jan 14 8:46 AM
Without DB table its not possible. Please elaborate your use case so that we can suggest some design.
2018 Jan 14 2:38 PM
Thanks Ankit Maskara for your response.
My requirement is, I have a itemconfiguration entity, where i have populated item configuration details in front end. User edit the configuration details in front end and submit. In itemconfiguration_create_method i get all the updated values. Now i had to create an internal table to pass the bapi sales order create,which in deep entity sa;es order create. So, i could not pass the internal table which i have populated. Using DB table i can solve the problem. Is there any solution rather than creating DB table?
2018 Jan 14 2:54 PM
What I understand is this - You have an item configuration entity and a sales order entity where in user inputs multiple item configuration records and you want to create the same using a BAPI. If so , on the submit of button, collect all item configuration entity records and fire a deep create on sales order entity method passing this item configuration data as well. For this to work you must have navigation from Sales Order to Item Configuration entity.
2018 Jan 14 4:27 PM
Thanks Ankit Maskara. 🙂
But, If there are 3 to 5 screen between those two entity method calls, Then what will be the solution. How do i get the internal table created in screen 2 in screen no 6? Hope you understood my problem.
2018 Jan 14 5:07 PM
I assume in that case your requirement would be once all the screens are populated(barring the optional ones - as there may be some optional ones as well) then on the submit click of the last screen you would like to create the business object with all its dependent data like internal tables from other screens. In such sceanrio you can try looking into wizard https://experience.sap.com/fiori-design-web/wizard/. Also if you cannot model your UI using this pattern then you need to locally store all the internal table data in UI5 models and pass the same to backend in single payload on the business object for which deep create will be implemented.