cancel
Showing results for 
Search instead for 
Did you mean: 

Problem faced Implementing GET_EXPANDED_ENTITYSET

Former Member
0 Kudos

Hi All,

I was trying to implement GET_EXPANDED_ENTITYSET. Below is the structure in SEGW i am using :

From Entity Type ET_ForecastForm i am connecting to ET_ForecastFormDet and ET_ForecastFormTot. I have redefined the method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET and below is my code.

*Constants Declaration--------------------------------------------------

   CONSTANTS: l_c_get_expanded_entityset

                TYPE string VALUE 'GET_EXPANDED_ENTITYSET',

              l_c_details TYPE sychar30 VALUE 'FORMDETSET',

              l_c_total type sychar30 value 'FORMTOTSET'.

*Types Declaration-------------------------------------------------------

   TYPES:

      l_ty_et_forecastformdet

      TYPE STANDARD TABLE OF /GLB/CL_9GT_GW_PR_MSP__MPC=>ts_et_forecastformdet WITH KEY forecastnumber.

   TYPES:

     l_ty_et_forecastformtot TYPE STANDARD TABLE OF /GLB/CL_9GT_GW_PR_MSP__MPC=>ts_et_forecastformtot WITH KEY forecastnumber.

   TYPES: BEGIN OF l_ty_deep.

           INCLUDE TYPE /GLB/CL_9GT_GW_PR_MSP__MPC=>ts_et_forecastform.

   TYPES: et_forecastformdet TYPE l_ty_et_forecastformdet,

          et_forecastformtot TYPE l_ty_et_forecastformtot,

   END OF l_ty_deep.

* Data Declaration------------------------------------------------

   DATA: l_i_deep TYPE STANDARD TABLE OF l_ty_deep,

         l_i_et_forecastform TYPE /GLB/CL_9GT_GW_PR_MSP__MPC=>tt_et_forecastform,

         l_i_et_forecastformdet TYPE /GLB/CL_9GT_GW_PR_MSP__MPC=>tt_et_forecastformdet,

         l_i_et_forecastformtot TYPE /GLB/CL_9GT_GW_PR_MSP__MPC=>tt_et_forecastformtot,

         l_wa_deep TYPE l_ty_deep,

         l_v_fornum type char10.

   FIELD-SYMBOLS: <l_fs_mgw_select_option> TYPE /iwbep/s_mgw_select_option,

                  <l_fs_cod_select_option> TYPE /iwbep/s_cod_select_option,

                  <l_fs_et_forecastformdet>

                    TYPE /GLB/CL_9GT_GW_PR_MSP__MPC=>ts_et_forecastformdet,

                  <l_fs_et_forecastformtot> TYPE /GLB/CL_9GT_GW_PR_MSP__MPC=>ts_et_forecastformtot,

                  <l_fs_et_forecastform> TYPE /GLB/CL_9GT_GW_PR_MSP__MPC=>ts_et_forecastform.

   READ TABLE it_filter_select_options WITH KEY property = 'Forecastnumber'

     ASSIGNING <l_fs_mgw_select_option> .

   IF sy-subrc IS INITIAL.

     READ TABLE <l_fs_mgw_select_option>-select_options INDEX 1

       ASSIGNING <l_fs_cod_select_option>.

     IF sy-subrc IS INITIAL.

       l_v_fornum = <l_fs_cod_select_option>-low.

     ENDIF.

     ENDIF.

           CALL FUNCTION '/GLB/9GT_MFORF' DESTINATION lv_dest

             EXPORTING

               IM_FORECASTNUM               = l_v_fornum

             IMPORTING

               EX_FORECAST    = l_i_et_forecastform

               EX_FORECASTT   = l_i_et_forecastformtot

               EX_FORECASTD     = l_i_et_forecastformdet.

If sy-subrc = 0.

          LOOP AT l_i_et_forecastform ASSIGNING <l_fs_et_forecastform>.

*            Get all the header fields first

               l_wa_deep-FORECASTNUMBER = <l_fs_et_forecastform>-FORECASTNUMBER.

               l_wa_deep-CURRSTATUS  = <l_fs_et_forecastform>-CURRSTATUS.

               l_wa_deep-CURRSTATUSDESC  = <l_fs_et_forecastform>-CURRSTATUSDESC.

               l_wa_deep-CHNGSTATUSTO  = <l_fs_et_forecastform>-CHNGSTATUSTO.

               l_wa_deep-CHNGSTATUSDESC  = <l_fs_et_forecastform>-CHNGSTATUSDESC.

               l_wa_deep-CREATOR = <l_fs_et_forecastform>-CREATOR.

               l_wa_deep-SERV_RECE_TOWER  = <l_fs_et_forecastform>-SERV_RECE_TOWER.

               l_wa_deep-SERV_RECE_TOWER_DESC  = <l_fs_et_forecastform>-SERV_RECE_TOWER_DESC.

               l_wa_deep-SERV_RECE_SUB_TOWER  = <l_fs_et_forecastform>-SERV_RECE_SUB_TOWER.

               l_wa_deep-SERV_RECE_SUB_TOWER_DESC  = <l_fs_et_forecastform>-SERV_RECE_SUB_TOWER_DESC.

               l_wa_deep-SERV_RECE_TEAM  = <l_fs_et_forecastform>-SERV_RECE_TEAM.

               l_wa_deep-SERV_RECE_TEAM_DESC = <l_fs_et_forecastform>-SERV_RECE_TEAM_DESC.

               l_wa_deep-REGION  = <l_fs_et_forecastform>-REGION.

               l_wa_deep-REGIONTXT  = <l_fs_et_forecastform>-REGIONTXT.

               l_wa_deep-COSTCENTER  = <l_fs_et_forecastform>-COSTCENTER.

               l_wa_deep-APPROVER = <l_fs_et_forecastform>-APPROVER.

               l_wa_deep-FORECASTMNTH  = <l_fs_et_forecastform>-FORECASTMNTH.

               l_wa_deep-FORECASTYR  = <l_fs_et_forecastform>-FORECASTYR.

               l_wa_deep-COMMENTS  = <l_fs_et_forecastform>-COMMENTS.

               l_wa_deep-REASONCODE  = <l_fs_et_forecastform>-REASONCODE.

               l_wa_deep-REASONTXT  = <l_fs_et_forecastform>-REASONTXT.

               l_wa_deep-SUPPLIER  = <l_fs_et_forecastform>-SUPPLIER.

               l_wa_deep-SUPPLIERSDESC  = <l_fs_et_forecastform>-SUPPLIERSDESC.

               l_wa_deep-URLEV  = <l_fs_et_forecastform>-URLEV.

               l_wa_deep-FRCST  = <l_fs_et_forecastform>-FRCST.

* Get all the forecast details copied

               LOOP AT l_i_et_forecastformdet ASSIGNING <l_fs_et_forecastformdet>

                 WHERE forecastnumber EQ <l_fs_et_forecastform>-forecastnumber.

                 APPEND <l_fs_et_forecastformdet> TO l_wa_deep-et_forecastformdet.

               ENDLOOP.

* Get all the details copied

               LOOP AT l_i_et_forecastformtot ASSIGNING <l_fs_et_forecastformtot>

                 WHERE forecastnumber EQ <l_fs_et_forecastform>-forecastnumber.

                 APPEND <l_fs_et_forecastformtot> TO l_wa_deep-et_forecastformtot.

               ENDLOOP.

               APPEND l_wa_deep TO l_i_deep.

               CLEAR l_wa_deep.

             ENDLOOP.

  endif.

   APPEND 'FORMDETSET' TO ET_EXPANDED_TECH_CLAUSES.

   APPEND 'FORMDETTOT' TO ET_EXPANDED_TECH_CLAUSES.

* Send specific entity data to the caller interface in the deep

* entity format.

   copy_data_to_ref(

     EXPORTING

       is_data = l_i_deep

     CHANGING

       cr_data = er_entityset

   ).

*endif.


I am able to see the deep structure into er_entityset also. But in the output the mother entity is populated only. Please check the below query I am using to retrieve the data


/sap/opu/odata/XXXXX_XXXX_SRV/ET_ForecastFormSet?$expand=FormDetSet,FormTotSet

Kindly request you if anyone could help.

Please let me know if you need anymore inputs.

Regards,

Koushik

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Koushik,

The names used while creating deep structure should be same as the names defined in the navigation property in the SEGW Model.

I see that navigation properties FORMDETSET  and FORMDETTOT which are defined in the SEGW model is not used while creating the deep structure in /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET method.


Example ->


In Model the below are the Navigation Properties names :

In Deep Structure names needs to be as below only :

Names needs to be same.

Please correct this.

Refer the below ->

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin,


I have successfully implemented the expand. But problem I am facing is when I implement Create Deep Entity then the expand is not working.

I assume this is because for the redefinition of the "Define" method in the create deep entity. Any suggestion how to overcome this.

Regards,

Koushik

Answers (1)

Answers (1)

Former Member
0 Kudos

Just forgot to mention one more point apart from /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET I have not implemented any code elsewhere. Do I need to implement code in someplace else too?

AshwinDutt
Active Contributor
0 Kudos

Hello Koushik,

Not required. Its fine.

Correcting the deep structure created inside the method should resolve your problem.

Regards,

Ashwin

Former Member
0 Kudos

Thank you so Much....It helped a lot