Skip to Content
0

How to expand a second table

Feb 08 at 07:13 PM

212

avatar image

Hi i'm doing an exercise from opensap course and the bind a table call ProductSet and the expad to ToSupplier, so i want to expand another table call with the navigation ToSalesOrderLineItems, my question is: it is right the way i did it? be cause it does not show nothing i cheked if the navigation does exist and it's already created

so in my code i have:

my list

									<List
										id="productsList"
										items="{
											path: '/ProductSet',
											sorter: {
												path: 'Category',
												group: true
											},
											parameters: {
												expand: 'ToSupplier','ToSalesOrderLineItems'
											}
											}"
											growing="true"
											growingThreshold = "5"
											growingScrollToLoad="false"
											mode="SingleSelectMaster"
											selectionChange="onItemSelected">

adding my field with an object attribute (ToSalesOrdersLineItems)

										<items>
											<ObjectListItem
												title="{Name}"
												number="{
													parts: [
														{path: 'Price'},
														{path: 'CurrencyCode'}
													],
													type: 'sap.ui.model.type.Currency',
													formatOptions: {
														showMeasure: false
													}
												}"
												numberUnit="{CurrencyCode}"
												numberState="{= ${Price} > 500 ? 'Error' : 'Success'}"
												intro="{ProductID}">
												<firstStatus>
													<ObjectStatus text="{
														parts: [
															{path: 'WeightUnit'},
															{path: 'WeightMeasure'}
														],
														formatter : '.formatter.delivery'
													}"/>
												</firstStatus>
												<secondStatus>
													<ObjectStatus
														title="Delivered From"
														text="{ToSupplier/Address/City} {ToSupplier/Address/Country}"
													/>
												</secondStatus>
												<attributes>
													<ObjectAttribute text="{ToSalesOrderLineItems}" />
												</attributes>
											</ObjectListItem>
										</items>
									</List>

metadata.png (86.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Vaibhav Maheshwari Feb 09 at 04:40 AM
0

Hi Naoto,

IN the code attached by you, you have directly added a Navigation Property (refering to an Entity) to the attribute.

<attributes>

<ObjectAttribute text="{ToSalesOrderLineItems}" />

</attributes>

To Bind a value as text, you would need to specify the Property from the Entity which is being referred by ToSalesOrderLineItems.

Try with something like

<ObjectAttribute text="{ToSalesOrderLineItems/Name}" />

where Name should be a property in your Entity "SalesOrderLine Item

Show 6 Share
10 |10000 characters needed characters left characters exceeded

i think the error is where i'm adding the expand

parameters : {
expand : 'ToSupplier','ToSalesOrderLineItems'
}

the way i'm doing it it's right ?

0

i tried this: expand : 'ToSupplier,ToSalesOrderLineItems' and there's no error and i wrote this:

<attributes>
														<ObjectAttribute text="Posición: {ToSalesOrderLineItems/ItemPosition}" />


</attributes>

but it's not displayying nothing, i checked SalesOrderLineItemSet and it have information

0

Hi Naoto ,

Please use expand like "ToSupplier/ToSalesOrderLineItems" .

share the final result.

Regards,

Meghal Shah

0

like this?

<List
										id="productsList"
										items="{
											path : '/ProductSet',
											sorter : {
												path : 'Category',
												group : true
											},
											parameters : {
												expand : 'ToSupplier/ToSalesOrderLineItems'
											}
										}"

i get this error on the inspector:

jquery.sap.global-dbg.js:1035 2018-02-12 15:00:31.395070 The following problem occurred: HTTP request failed404,Not Found,{"error":{"code":"005056A509B11EE1B9A8FEC11C21D78E","message":{"lang":"en","value":"Resource not found for the segment 'ToSalesOrderLineItems'."},"innererror":{"transactionid":"B9E0A2A100BE0050E005A4B4E33E3E95","timestamp":"20180212180027.3360800","Error_Resolution":{"SAP_Transaction":"Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details","SAP_Note":"See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"}}}} -
0

do you have any example of extending with two navigation in the same entityset ??? or using two odata so i could see how use two models in the same example

0
0