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:
Step 2:
P_SRA008->Subpackages->P_SRA008_ODATA->Class Library->CL_SRA008_MGW_MED_TEA->Methods->BUILD_META_DATA
Step 3:
Step 4:
Enhancement Spot | SRA008_APPROVE_TRAVEL_EXPENSE |
Standard BADI | SRA008_BADI_APV_TRAVEL_EXP |
Enhancement Implementation | Z_EI_FIELD_EXT |
BADI Implementation | Z_BADI_FIELD_EXTENSIBILITY |
Interface | IF_SRA008_BADI_APV_TRAVEL_EXP |
Implementing Class | ZCL_BADI_ATE_FIELD_EXT |
Method Implemented | CHANGE_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
Your comments will be helpful to improve the doc steps.
We are done! Thanks and cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 |