on 08-22-2014 8:05 AM
Hello,
My requirement is to pass some item data to web service & then i use FM to create a Item id for each item passed. So, if i have passed 10 items in input, 10 item ids will be created.
in SEGW model, i have created a entity type ENT1 that has fields Item id & item name ( This is the info i want WS to return in response). Other entity type ENT2 has item data information or fields that i want to input to web service. Then i created a navigation from ENT1 to ENT2 with cardinality as M:N.
So, now if i pass 10 Items info in input, i should get back in response 10 item ids with their name. I hope my requirement is clear.
Then, i have used method CREATE_DEEP_ENTITY to create items & then i have all the items created & their name in an internal table. Then i use below method to send this table in response:
copy_data_to_ref(
EXPORTING
is_data = lt_created_items
CHANGING
cr_data = er_deep_entity
).
My issue is that i don't see any item in response if i pass here a table in IS_data but if i pass a work area, then thats returned in response.
What could be the reason & how can i solve this?
Regards
Gaurav K
Hello Gaurav,
U need to pass a structure to copy_data_to_ref method i mean i.e., a deep structure which is holding all your table details.
Sample :
copy_data_to_ref(
EXPORTING
is_data = ls_created_items
CHANGING
cr_data = er_deep_entity
).
Where ls_created_items is a deep structure.
Please have a look for detail info here.
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Gaurav,
That is because the navigation property defined in the model for a particular entity need to be a part of your payload.
Explanation : consider
Say u have an entity ITEM and entity set ITEMSet where u will be sending your item details.
Say u have a header entity PARENT and entity set PARENTSet where u send header info.
Say u have another entity ITEMDETAIL and entity set ITEMDETAILSet ( which will be got from your BE logic as a part of response )
Say u have association & navigation between entities as below :
PARENT to ITEM - 1 to N
PARENT to ITEMDETAIL - 1 to N
Navigation Properties :
PARENT to ITEM - ParentItem
PARENT to ITEMDETAIL - ParentItemDetail
Now in Payload u would send as below :
JSON payload -
{
"HeaderProperty1":"",
.
.
.
.
"HeaderPropertyN":"",
"ParentItem":[{
< Your item info >
}]
With this u will fire the Deep Entity, Creation of Items happens and u will send back the response as well. i.e., deep structure holding header,items sent initially in payload and item details which u got as part of successful creation )
But now in response u will not be able to see item details which u got as part of successful creation because the above payload will not have navigation property ParentItemDetail as part of payload so u wont see in response though u send those details as part of your deep structure
So now solution is :
Send the payload as below :
{
"HeaderProperty1":"",
.
.
.
.
"HeaderPropertyN":"",
"ParentItem":[{
< Your item info >
}],
"ParentItemDetail":[{
}]
With this u can see the item details which u got as part of successful creation along with your header and items sent initially in payload as well
Regards,
Ashwin
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.