Skip to Content
0

$expand to multiple targets

Oct 12, 2016 at 08:49 AM

109

avatar image

Hello people

I have a scenario where I have one primary entity say SalesOrder and 2 secondary entities(Items and Products). I want to expand from SalesOrder to Items and also from SalesOrder to Products. How do I implement multiple expand in the GET_EXPANDED_ENTITY AND GET_EXPANDED_ENTITYSET

Thank you

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member Oct 20, 2016 at 12:39 PM
0

Hello Timothy,

Please have a look at the below : This will give you idea on how to model the serivce as per your requireents.

https://blogs.sap.com/2014/07/18/implementing-expand-entityentity-set/

Regards,

Ashwin

Share
10 |10000 characters needed characters left characters exceeded
Jakob Marius Kjær Oct 13, 2016 at 12:28 AM
0

Hi Timothy,

When you have your entity in the method, you can add the expanded other entities to it. Just declare your entityset with the "child" entities and return this.

In my example below i have done it for purchase order, which is used to recieve GR items and also purchase order items.

    DATA:  BEGIN OF ls_expanded_order.

   INCLUDE       TYPE ZCL_ZGW_PO_GR_MPC=>TS_ET_PURCHASEORDERHEADER.

   DATA: ET_GRITEM     TYPE ZCL_ZGW_PO_GR_MPC=>TT_ET_PURCHASEORDERITEM,

         ET_PurchaseOrderItemSet    TYPE ZCL_ZGW_PO_GR_MPC=>TT_ET_PURCHASEORDERITEM,

        END OF ls_expanded_order.

...


   copy_data_to_ref(

         EXPORTING

           is_data = lt_order_item

         CHANGING

           cr_data = er_entityset ).
Share
10 |10000 characters needed characters left characters exceeded
Ankit Maskara
Oct 12, 2017 at 03:51 AM
0

Hi All,

Though late but I implemented something similar here - https://blogs.sap.com/2017/09/18/generic-expanded-entity-implementation/

Share
10 |10000 characters needed characters left characters exceeded