cancel
Showing results for 
Search instead for 
Did you mean: 

Filter Products to be shown in Create Sales Order

Former Member
0 Kudos

Hi! I'm trying to enhance our standard Create Sales Order Fiori Application. On the products tab, I need to show the products available to the chosen customer. Right now, it shows all products.

When I studied the code for SO creation, the list is binded through /Products

When accessing the OData service call

/sap/opu/odata/sap/SRA017_SALESORDER_CREATE_SRV/Products

it didn't show anything.

Is there a way to access the data on Products entity?

My initial solution was to edit the filter. Adding another filter for customerNo

  updateProductsList : function(){

  var filters = [];

  filters.push(new sap.ui.model.Filter("SalesOrganization", sap.ui.model.FilterOperator.EQ, this.oSalesOrganization));

  filters.push(new sap.ui.model.Filter("DistributionChannel", sap.ui.model.FilterOperator.EQ, this.DistributionChannel));

  filters.push(new sap.ui.model.Filter("ProductID", sap.ui.model.FilterOperator.Contains, this.sFilterPattern));

  filters.push(new sap.ui.model.Filter("CustomerNo", sap.ui.model.FilterOperator.Contains, this.sCustomerNo));

  this.setDefaultSelection = true;

  this.getList().bindItems("/Products", new sap.ui.xmlfragment("cus.sd.salesorder.create.view.ProductListItemTemplate",this), null,filters);

  var sTitle = this.getView().byId("SOC_MasterListHeaderTitle");

  sTitle.setText(this.oApplicationFacade.getResourceBundle().getText("PRODUCTS_CUST", [this.CustName]));

  this.registerMasterListBind(this.getList());

  },

but this didn't work.

So I'm assuming I need to edit the OData service for this. I'm guessing I need to create a navigation path to Products and create an OData filter.

Can someone point me to the right direction. Thank you in advance

Accepted Solutions (1)

Accepted Solutions (1)

former_member182874
Active Contributor
0 Kudos

Hi

Filter criteria must be handled from gateway service.

Shortcut for getting the Product list is , refresh the browser and record the gateway service call (Starts with sap/opu)

Once you get entity set(for eg : ProductListSet)


Go to the DPC_EXT class and redefine the method and apply filter criteria.

URI formation should be something like : sap/opu/odata/Zservicename/ZentitySet?$filter=Product eq 'xyz'

Regards,

Tejas

Answers (1)

Answers (1)

agentry_src
Active Contributor
0 Kudos

Discussion successfully moved from SAP for Mobile to SAP Fiori where this topic should be.

Regards, Mike (Moderator)

SAP Technology RIG