Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
vijaybhaskarraju_vegesana
Active Participant

Extending Approve Travel Expense (ATE) Fiori Gateway using SE80 approach:


I see most of the blogs explaining about the SEGW Gateway Extensibility as this is/will be used for all Fiori Gateway extensions. To redefine older approach (SE80) Fiori apps below will be helpful.


-> Earlier before Gateway Service Builder(SEGW) was introduced SAP has built Fiori apps with older methodology that is SE80( Repository browser) approach


-> Here, we will discuss the below

                         

                 1)  Add additional fields to structure

                 2)  Create BADI to extend MPC( Model Provider Class ) and DPC( Data Provider Class ) class

                 3)  Execute the standard OData service with additional fields


Requirement: Add additional custom fields in Approve Travel Expense Fiori app in Information tab as shown below



Step 1:


  • Go To Transaction SE80( Repository Browser )
  • Open Package P_SRA008

Step 2:


  • We need to check to which structure we need to add the additional fields so that it will be added to same OData service call which is getting called to fetch the information details in Fiori ATE app
  • You can check the structures which are mapped to Entity as below


P_SRA008->Subpackages->P_SRA008_ODATA->Class Library->CL_SRA008_MGW_MED_TEA->Methods->BUILD_META_DATA



Step 3:


  • Now we know which structure to be enhanced to add the additional fields in the information tab
  • For every standard structure “SRA008_S_TEA_WORKLIST” there will be an include structure “SRA008_S_TEA_WORKLIST_INCL”.
  • We need to add our additional fields in include structure “SRA008_S_TEA_WORKLIST_INCL” using Append structure. Create Append Structure and add your additional fields ( This am not explaining here as it is discussed in many other blogs )



Step 4:


  • We added custom additional fields to the structure and to consume these additional fields in the UI we need to expose these fields to OData Service
  • For that, we need to enhance the method “CHANGE_META_DATA” by implementing the BADI.
  • Create the Enhancement Implementation “Z_EI_FIELD_EXT”(any custom name) in the Enhancement Spot “SRA008_APPROVE_TRAVEL_EXPENSE”
  • All below names which starts with ‘Z’ can be any name.
Enhancement SpotSRA008_APPROVE_TRAVEL_EXPENSE
Standard BADISRA008_BADI_APV_TRAVEL_EXP
Enhancement ImplementationZ_EI_FIELD_EXT
BADI ImplementationZ_BADI_FIELD_EXTENSIBILITY
InterfaceIF_SRA008_BADI_APV_TRAVEL_EXP
Implementing ClassZCL_BADI_ATE_FIELD_EXT
Method ImplementedCHANGE_META_DATA

  • This redefined method “CHANGE_META_DATA” will get executed after the standard method “BUILD_META_DATA”.



Sample piece of code in the method CHANGE_META_DATA for adding additional field:


******************************************************************************************************************


DATA:

ls_entity                 
TYPE cl_sra008_mgw_med_tea=>ys_entity,
ls_property             
TYPE cl_sra008_mgw_med_tea=>ys_property,
lv_order                  
TYPE i,
io_property             
TYPE REF TO /iwbep/if_mgw_odata_property,
io_entity_type         
TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
*** Worklist CollectionCLEAR ls_property.CLEAR lv_order.ADD 240 TO lv_order.
ls_property
-entity_type           = 'Worklist'.
ls_property
-property_name     = 'zzpdm_pm'.
ls_property
-abap_name          = 'ZZPDM_PM'.
ls_property
-is_key                 = abap_false.
ls_property
-is_nullable           = abap_false.
ls_property
-is_title                 = abap_true.
ls_property
-keep_in_content   = abap_true.
ls_property
-is_creatable         = abap_false.
ls_property
-is_updatable        = abap_false.
ls_property
-is_filterable          = abap_false.
ls_property
-visible_in_list       = 'false'.
ls_property
-visible_in_detail    = 'false'.
ls_property
-display_order       = lv_order.
ls_property
-semantic             = ''.
ls_property
-currency_for_amount = 'zzpdm_pm_curr'. "Currency reference field


INSERT ls_property INTO TABLE it_property.



LOOP AT it_entity INTO ls_entity.

IF ls_entity-entity_type = 'Worklist'. “Name of the entity
          io_entity_type   
= it_model->get_entity_type( 'Worklist' ).

          io_property       
= io_entity_type->create_property                                                         
                                                                                                                                                                ( iv_property_name  = 'zzpdm_pm'
                                                                      iv_abap_fieldname
= 'ZZPDM_PM' ).
   


  io_property->set_nullable( abap_true ).


  ENDIF.

ENDLOOP.


****************************************************************************************************************

Find the attached document for sample piece of code for multiple fields.


Step 5:


Also redefine the method “CHANGE_LAST_MODIFIED”( always make sure that this is future date) to pick the last modified timestamp fields.


Step 6:


Clear your cache  


Transactions:   /IWBEP/CACHE_CLEANUP                     

                       /IWFND/CACHE_CLEANUP


Step 7:


Now, execute the OData service and see whether all your custom fields are added to the service, Please see whether you are executing the correct OData service 



/sap/opu/odata/sap/SRA008_SRV/WorklistCollection?$skip=0&$top=20&$inlinecount=allpages



Step 8:


Now we can add our custom logic in our respective BADI methods to populate data


Note: This approach will also be help full for Fiori Gateway Extension for apps like


  • Track Shopping Cart
  • Approve Shopping Cart etc...


Your comments will be helpful to improve the doc steps.


We are done! Thanks and cheers.


6 Comments
Labels in this area