on 02-10-2015 6:38 AM
Hi,
I am trying to fetch line items in the detail view of a UI5 application.
The record has 4 to 5 line items but instead of that i am only getting a single line item.
what should i do to get the multiple line items.
below i am attaching the code for the above along with the screenshot of the output.
Please help me to find the solution.
Thanks in advance.
Detail.View.Xml
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" controllerName="sap.ui.demo.myFiori.View.Detail"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:f="sap.ui.layout.form">
<Page title="Physical Inventory Document Details">
<content>
<ObjectHeader id="title" title="{Vbeln}">
</ObjectHeader>
<IconTabBar expanded="{device>/isNoPhone}">
<items>
<IconTabFilter icon="sap-icon://supplier">
<f:SimpleForm editable="false" layout="ResponsiveGridLayout"
id="FormId">
<core:Title text="Physical Inventory Count" />
<Text text="Physical Inventory Document Number" />
<Input enabled="true" editable="false" id="ip_phyno" />
<Text text="PLant" />
<Input enabled="true" editable="false" id="ip_plant" />
<Text text="Storage Location" />
<Input enabled="true" editable="false" id="ip_strloc" />
</f:SimpleForm>
</IconTabFilter>
</items>
</IconTabBar>
</content>
<Table id="dtable">
<headerToolbar>
<Toolbar>
</Toolbar>
</headerToolbar>
<columns>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="Center">
<Text text="Items" />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="Center">
<Text text="Material Desc." />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="Center">
<Text text="Batch" />
</Column>
<Column hAlign="Right">
<Text text="Stock Type" />
</Column>
<Column hAlign="Center" minScreenWidth="Tablet" demandPopin="true">
<Text text="Quantity" />
</Column>
<Column hAlign="Center" minScreenWidth="Tablet" demandPopin="true">
<Text text="Unit of Entry" />
</Column>
<Column demandPopin="true" minScreenWidth="Tablet">
<Text text="zero count" />
</Column>
</columns>
<items>
<ColumnListItem vAlign="Middle">
<cells>
<ObjectIdentifier title="{Item}" />
<Text text="{Material}" />
<Text text="{Batch}" />
<Text text="{STy}" />
<Input value="{Quantity}" type="{Text}" unit="{number}"
editable="true" />
<Input value="{Une}" type="{Text}" description="{UoE}"
editable="true" />
<!-- <Text text="{Quantity}" /> <Text text="{Une}" /> -->
<CheckBox text="" />
</cells>
</ColumnListItem>
</items>
</Table>
</Page>
</core:View>
Detail.Contoller.js
sap.ui.controller("sap.ui.demo.myFiori.View.Detail", {
onInit: function() {
sap.ui.getCore().getEventBus().subscribe("app","RefreshDetail", this._refresh,this);
},
_refresh : function (chnId,evtId,info){
this.getView().byId("ip_phyno").setValue(info.phys_inv_doc);
this.getView().byId("ip_plant").setValue(info.plant);
this.getView().byId("ip_strloc").setValue(info.str_loc);
var path = "/z_DetailSet(Physinventory='" + info.phys_inv_doc + "',Fiscalyear='" + info.fis_year + "')";
this.byId("dtable").bindElement(path);
},
});
by doing
var path = "/z_DetailSet(Physinventory='" + info.phys_inv_doc + "',Fiscalyear='" + info.fis_year + "')"
you reference an entity by key, so it is not technically filtering. Are Physinventory and Fiscalyear part of the key for z_DetailSet?
I would recommned to implement master-detail as MasterSet('MASTER_KEY')/DetailSet
and in detail getenitityset you ca ndo something like
LOOP AT it_key_tab ASSIGNING <fs_key>.
CASE <fs_key>-name.
WHEN 'MASTER_KEY'.
lv_masterKey = <fs_key>-value.
ENDCASE.
ENDLOOP.
"use masterKey to load all related details
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Maksim,
Thanks for providing suggestion.
The Physinventory and the Fiscal year are the 2 keys that i need to pass on for getting the items in the detail view.
I am using a standard bapi for fetching the detail. And that bapi need two things as an input and those are physinventory and Fiscal year..
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.