cancel
Showing results for 
Search instead for 
Did you mean: 

How to expand a second table

naotoxxx
Participant
0 Kudos

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>

Accepted Solutions (0)

Answers (1)

Answers (1)

mvaibhav
Contributor
0 Kudos

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

naotoxxx
Participant
0 Kudos

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

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

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

naotoxxx
Participant
0 Kudos

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

former_member186852
Contributor
0 Kudos

Hi Naoto ,

Please use expand like "ToSupplier/ToSalesOrderLineItems" .

share the final result.

Regards,

Meghal Shah

naotoxxx
Participant
0 Kudos

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)"}}}} -
naotoxxx
Participant
0 Kudos

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

former_member186852
Contributor