on 08-24-2017 11:02 PM
Hi Gurus
I am developing a UI5 interface which suppose to create a Head/Items deep entity.
I have a item list on the page, when Submitting, CREATE_DEEP_ENTITY get called and everything works fine.
However, I have a couple of item level fields will be updated after CREATING, and I want to show up these fields' data on the list.
Now the problem is, in the View I don't see the data in the Model.
In the Controller, I use below code to submit data to Gateway server:
oHead.ItemSet = items;
oModel.create('/ObjectSet', oHead, null,
function(oData, oResponse) {
alert("Success");
},
function() {
alert("Internal error");
}
);
But when I check oData, I don't see the new data .
In method CREATE_DEEP_ENTITY, I have below code to pass data to the OData layer, then I expect the new data in lw_deep_entity will be pass back to the Model above.
copy_data_to_ref(
EXPORTING
is_data = lw_deep_entity
CHANGING
cr_data = er_deep_entity ).
Do I miss something here? Or the way is total wrong to service my purpose?
Any input is highly appreciated.
Hi john,
Could you Please show me the whole code written in Deep Entity Method. So that it will help to trace the issue.
Apart from that you mentioned the below statement
But when I check oData, I don't see the new data .
This might be a problem in UI Side where u haven't Copied the object properly.First Ensure you are passing the Object with data in oModel.create.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mantri
Thanks for the reply. Let me try to describe my issue more clear.
My task is to create a Transfer Order.
From the page side I build the item list based on user input, then I called oModel.create method with no problem:
oHead.ItemSet = items;
oModel.create('/ObjectSet', oHead, null,
function(oData, oResponse) {
alert("Success");
},
function() {
alert("Internal error");
}
);
Here Head/Item data get passed to gateway server without issue. In method CREATE_DEEP_ENTITY I can get all of the data, I called a FM to create the Transfer Order, then TO number and item numbers are generated. I try to pass these numbers back to the page so users can see them.
But in the success function, I can not see those numbers in object oData.
In CREATE_DEEP_ENTITY I have code like below
CASE iv_entity_set_name.
WHEN 'TransferOrderSet'.
CALL METHOD me->create_to_deep
EXPORTING
iv_entity_name = iv_entity_name
iv_entity_set_name = iv_entity_set_name
iv_source_name = iv_source_name
it_key_tab = it_key_tab
it_navigation_path = it_navigation_path
io_expand = io_expand
io_tech_request_context = io_tech_request_context
io_data_provider = io_data_provider
IMPORTING
er_deep_entity = lw_to_deep.
copy_data_to_ref(
EXPORTING
is_data = lw_to_deep
CHANGING
cr_data = er_deep_entity ).
In method CREATE_TO_DEEP, I have code like below:
io_data_provider->read_entry_data(
IMPORTING
es_data = lr_to_deep ).
* prepare data here
CALL FUNCTION 'Z_XXXX'
TABLES
gritems = lt_item
return = lt_ret2
CHANGING
grhead = lw_head.
READ TABLE lt_ret2 TRANSPORTING NO FIELDS WITH KEY type = 'E'.
IF sy-subrc NE 0.
MOVE-CORRESPONDING lw_head TO er_deep_entity.
IF lt_item[] IS NOT INITIAL.
SELECT * FROM ltap
INTO TABLE lt_ltap
FOR ALL ENTRIES IN lt_item
WHERE mblnr = lt_item-mat_doc
AND mjahr = lt_item-doc_year.
LOOP AT lt_item INTO lw_item.
READ TABLE lt_ltap INTO lw_ltap WITH KEY mblnr = lw_item-mat_doc
mjahr = lw_item-doc_year
mbpos = lw_item-doc_item.
IF sy-subrc = 0.
lw_item-trnsf_order = lw_ltap-tanum.
lw_item-to_item = lw_ltap-tapos.
ENDIF.
APPEND lw_item TO er_deep_entity-items.
ENDLOOP.
ENDIF.
ENDIF.
Can I really expect those data get passed back to the page automatically?
I am new on Fiori/oData, so I am looking for good practise. If this is not the standard way, then how? Just call oModel.read()?
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.