cancel
Showing results for 
Search instead for 
Did you mean: 

Can I pass an internal table to get_expanded_entityset as input?

former_member227510
Participant
0 Kudos

Hi,

I want to pass the list of work orders on click of a button.

For example :

435435

545456

654454

656565

545454

656454

434354

435454

324343

As input, I want these values in the gateway service.

Is it possible?

Or the way to do it is use create_deep_entity?

Thanks and Regards,

Gopa

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Kumar,

Pass all those inputs as filter parameters as shown below in the URL.

You will receive all these as part of select options internal table.

Sample ->

/sap/opu/odata/sap/Z_SRV/WorkOrders?$filter=( OrderNumber eq '0001' or OrderNumber eq '0002' or OrderNumber eq '0003' or OrderNumber eq '0004' )&$expand=WorkOrderDetails

Regards,

Ashwin

former_member227510
Participant
0 Kudos

Hi Ashwin,

Thanks for the reply.

Actually,

I may have more than 100's of work orders.

To the filter, passing these many records, is it a good idea?.

Regards,

Gopa.

former_member227510
Participant
0 Kudos

Hey Ashwin,

I am trying the same url you have mentioned.

I am getting the data required ( work order details).

However, the service is getting called second time.

Do you know what could be the issue? URL seems fine.

Regards,

Gopa

AshwinDutt
Active Contributor
0 Kudos

Inside /iwbep/if_mgw_appl_srv_runtime~get_expanded_entityset , Navigation Property to be send back in Upper Case as below.

Example -> where WorkOrderDetails is your Navigation Property.

/sap/opu/odata/sap/Z_SRV/WorkOrders?$filter=( OrderNumber eq '0001' or OrderNumber eq '0002' or OrderNumber eq '0003' or OrderNumber eq '0004' )&$expand=WorkOrderDetails

INSERT 'WORKORDERDETAILS' INTO TABLE et_expanded_tech_clauses.


Check this please.

former_member227510
Participant
0 Kudos

Hi Ashwin,

It's already in upper case.

Regards,

Gopa

AshwinDutt
Active Contributor
0 Kudos

Can you share the model and URL details ? Cardinality , Referential Constraints etc...

Answers (3)

Answers (3)

former_member227510
Participant
0 Kudos

Hi,

The requirements for me changed though. I had to get it on the basis of organizational unit. So organizational unit is passed to the filter and the got the values instead of getting the work orders.

However, passing huge URI strings is not a good idea. We can implement it through POST and sending the work orders in a batch...

The service would look like.... sap/..../ServiceName/$batch....

For more information refer the link below...

Regards,

Gopa

former_member227510
Participant
0 Kudos

Hi Ashwin,

Issue resolved.

The abap field name was incorrect in the navigation property as I earlier changed the relationship name and entity and entity set names.

So passing the values into the filter is an only option currently.

I wish we could pass an array or an object.

I will close the thread day after tomorrow.

Thank you for the suggestions.

Regards,

Gopa

former_member227510
Participant
0 Kudos

Model

Entity

1) WorkOrderHeader - WorkOrder

2) WorkOrderItem - WorkOrder, Operation1 , Operation2

EntitySets

1) WorkOrderHeaderSet

2) WorkOrderItemSet


Referential Constraints

Principal Entity = WorkOrderHeader

Principal Key = WorkOrder

Dependent Entity = WorkOrderItem

Dependent Property = WorkOrder

Association Name = WorkOrderHeaderToItem

Cardinality is 1:M


URL =

/sap/opu/odata/sap/ZWORK_ORDER_SRV/WorkOrderHeaderSet?$filter=(WorkOrder eq '820579' or WorkOrder eq '820578')&$expand=WorkOrderHeaderToItem&$format=json


Regards,

Gopa