cancel
Showing results for 
Search instead for 
Did you mean: 

Problem updating entity after sync

Angelo_Ab
Participant
0 Kudos
88

Hi,

I'm trying to understand how sync really works with Offline App.

I have an Order List downloaded in the Offline Store. Entity HeadSet.

The creation of Orders works correctly with a CreateEntity Action of HeadSet Entity inside a ChangeSet.

If I try to Edit an Order without change anything in the Header and send an Update request, the HeadSet, after Sync, seems not properly synced.

Steps:

  • Create Order 12345
  • Edit the Order 12345
  • Save the Order 12345 without change attributes
  • The Backend received the mapped header data.
  • The Backend sends back a success http status.
  • The App Download all the Entity included HeadSet
  • The Order in the Order List seems not properly synced because the binding contains @SAP.isLocal = true

If I try again a Sync, the order seems stuck and Backend do not receive any request.

To solve the problem I need to enter the Order, change something in the Header Data and Sync again.

After Sync:

  • The Backend received the mapped header data.
  • The Backend sends back a success http status.
  • The Order seems properly synced because the binding contains @SAP.isLocal = false

This is the Update HeadSet Action Code:

{
    "_Type": "Action.Type.ODataService.UpdateEntity",
    "ActionResult": {
        "_Name": "UpdateSalesOrderHeader"
    },
    "Target": {
        "Service": "/app/Services/ServiceV2.service",
        "EntitySet": "HeadSet",
        "ReadLink": "/app/Rules/EditSalesOrder/GetHeaderReadLinkUpdate.js"
    },
    "Properties": {
        "Bozza": "#Page:CreateSalesOrderHeaderData/#Control:FCOrderDraft/#Value",
        "Datachanged": "#Page:CreateSalesOrderHeaderData/#Control:FCDataChanged/#Value",
        "UM": "#Page:CreateSalesOrderHeaderData/#Control:FCUnitOfMeasure/#Value",
        "UMSt": "#Page:CreateSalesOrderHeaderData/#Control:FCUnitOfMeasureSt/#Value",
        "Ordertype": "#Page:CreateSalesOrderHeaderData/#Control:FCOrderType/#SelectedValue",
        "ShipTo": "#Page:CreateSalesOrderHeaderData/#Control:FCOrderShipTo/#Value",
        "OrderReason": "#Page:CreateSalesOrderHeaderData/#Control:FCOrderReason/#SelectedValue",
        "SoldTo": "#Page:CreateSalesOrderHeaderData/#Control:FCOrderSoldTo/#Value",
        "RifOrd": "#Page:CreateSalesOrderHeaderData/#Control:FCRefCustomer/#Value",
        "DataTassativa": "#Page:CreateSalesOrderHeaderData/#Control:FCOrderDeliveryDate/#Value",
        "SalesOrg": "IT01",
        "Sector": "00",
        "DistrChan": "MM",
        "DataCust": "#Page:CreateSalesOrderHeaderData/#Control:FCCustomerDate/#Value",
        "DelDate": "#Page:CreateSalesOrderHeaderData/#Control:FCDeliveryDate/#Value"
    },
    "RequestOptions": {
        "SendEmptyUpdate": true,
        "UpdateMode": "Replace"
    }
}  

I think that there is a match with Uploaded Data and Downloaded Data but I'm not really sure.

Seems like Backend have different Header Order Data compared to Updated Entity Data.

What happens after sync ? How the framework recognize a not Synced Order ?

If this problem occurs how can be managed ?

Thanks.

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

Angelo_Ab
Participant
0 Kudos

I found a workaround and now I'm able to save correctly the Order to backend.

The workaround implies a programmatically simulation of change attribute in the Header Entity.

If I send a request without change attributes in Header Entity, the entire Order is stored in Offline Store and appears not synced (@SAP.isLocal = true).

I do not understand why this happens, but I would really like to understand it.