cancel
Showing results for 
Search instead for 
Did you mean: 

Approve Travel Expense issue

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi Team,

I enhanced the BAdi "SRA008_BADI_APV_TRAVEL_EXP" for Approve Travel Expense Fiori App.

Steps Followed:

1) Added Fields in the Structure.

2) Populated values for the new fields

3) I am able to see the newly added  fields and the values for these fields in the back end debugger.All the newly added fields and data is finally retrieving to "er_entityset" .

4) cleared the cache in both front end and back end.

Issue:

1) I could not able to see the newly added fields in the metadata.

2) we don't have any other BAdi to enhance the model.

Please provide some inputs?

Thanks

Vijay

Accepted Solutions (1)

Accepted Solutions (1)

former_member182874
Active Contributor
0 Kudos

What is the URL you are trying in GW client ?

I hope you know in which entityset you have to check. Check the entityset.

Regards,

Tejas

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi tejas,

1) the fields and values are getting populated in the entityset.

2) fields are not getting populated to the metadata

3) I don't see any badi where I can enhance model class

Regards,

Vijay

former_member182874
Active Contributor
0 Kudos

Hi Vijay,

For this you have to extend the Gateway project as well.

  1. Go to SEGW
  2. Create a new extended project.
  3. Now Right-click Data Model and select Redefine -> OData Service (GW).
  4. On the first page of the wizard, select the F4 help as indicated.
  5. Select the standard service for Travel expense : starts with SRA and select the green tick mark icon.
  6. Select Next.
  7. Click the Select All icon, and select Finish.( Entity types)
  8. Select the new Gateway service, and click the Generate icon.
  9. Select the green tick mark in the Model and Service Definition window.
  10. Make sure you assign a package.
  11. Create all the associations manually in the new Gateway service (highlighted in yellow) by using the Add Association icon in the Associations screen. Create the same associations as in the standard Gateway service (highlighted in red).
  12. Create all the association sets manually in the new Gateway service (highlighted in yellow) by using the Add Association Set icon in the Association Sets screen. Create the same association sets as in the standard Gateway service (highlighted in red).
  13. Generate the project.
  14. Right click the highlighted DPC_EXT class and goto abap repository and write the logic for it in Get entity and entity set.

Regards.

Tejas

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

HI Tejas,

Thanks for your detail explanation.

1) Why we need to redefine the Odata Service, when we already have Badi for this.

2) I redefined Approve Travel Expense Odata Service, and am getting below errors.

Property 'AttachmentID' is a key and must set nullable to false

Property 'IMAGE_LINK' is a key and must set nullable to false

Property 'PrintPreviewId' is a key and must set nullable to false

3) Is there any specific note which needs to be implemented for this?

Regards,

Vijay

former_member182874
Active Contributor
0 Kudos

I hope I am not wrong. But the old application like approve PO for which we have standard document available were extended using BADI implementation, because those were not developed using SEGW. Structures were built in the backend and you can append the fields you need and call the same using BADI.

But new apps were done using SEGW project. So you need to import the same fields in the Entity type in the gateway project as well.

For the errors you are facing, you need to check the model of service builder and compare it with standard project, on which fields are set as key.


Are these property already existing in Approve travel expense ?

Regards,

Tejas

former_member182874
Active Contributor
0 Kudos

Refer this help.sap document for the same.

Extending an OData Service Using Service Builder - SAP NetWeaver Gateway - SAP Library

Also this blog from SCN should be helpful :

Regards,

Tejas

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

yes tejas, they already exists, we cannot change the standard fields.

Regards,

Vijay

former_member182874
Active Contributor
0 Kudos

Refer the standard project and see which are the key fields and which are set nullable=false.

You don't need to modify the standard project. Like I said earlier, new project and redefine.

For getting custom fields in the metadata. The property should exist in the model .

Regards,

Tejas

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

let me try tejas, thanks for your inputs.

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi Teja,

We raised an OSS message with SAP.

SAP released Note which is in Pilot stage with new BADI's. It resolved our issue.

Thanks.

former_member182874
Active Contributor
0 Kudos

Great ! May be you can share Note details so that people across community facing similiar issue can solve.

Regards,

Tejas

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Sure Tejas..Still the note is in Pilot stage, Lets finish of our development and if there are no issues, will post the SAP note over here..

Thanks

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi Tejas,

As said, below is the SAP Note which we implemented. As approve Travel Expense is SE80 approach, with this note sap is providing additional BADI's where we can enhance model classes.

As this note is still in Pilot stage not sure if it exists for all Enhancement Packs.

SAP Note - 2113149

SAP Note - 2117739( Bug fix ) , Please be aware that Note 2110428 has to be applied before Note 2117739.

Regards,

Vijay

Former Member
0 Kudos

Hello Vijay,

I am having the same problem as you, and following this post and SAP notes, I have instaled this package:


Support Package SAPK-60008INSRA008

Could you tell me which are these additional BADI´s where we can enhance model classes?

I can´t find them

Thank you very much

Regards

And

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi And,

We are at below support pack:( we upgraded recently )

SRA0086000008SAPK-60008INSRA008Approve Travel Expenses OData Integratio

If at all you did not find the below mentioned methods with the above SP level, implement the mentioned Notes.

After implementing above mentioned notes, you will be able to see the below new methods in the BADI "SRA008_BADI_APV_TRAVEL_EXP" where you can enhance your model class

  - CHANGE_META_DATA

  - CHANGE_LAST_MODIFIED

Regards,

Vijay

Former Member
0 Kudos

Hi Vijay,

Thank you, I can see the new 2 methods, but I am having a problem.

When I execute my APPROVE TRAVEL EXPENSES fiori application, the process goes trought CHANGE_LAST_MODIFIED method and I can put a breakpoint, but the process doesn´t go through CHANGE_META_DATA method so I can´t extend the model.

I have added below code to CHANGE_META_DATA method, but can´t show my new field information (ZZSTATUS) in the app.

Thank you very much,

Regards

method IF_SRA008_BADI_APV_TRAVEL_EXP~CHANGE_META_DATA.

types:


     BEGIN OF ys_property,

         entity_type         TYPE /iwbep/if_mgw_med_odata_types=>ty_e_med_entity_name,

         property_name       TYPE /iwbep/if_mgw_med_odata_types=>ty_e_med_entity_name,

         abap_name           TYPE fieldname,

         is_key              TYPE boole_d,

         is_nullable         TYPE boole_d,

         is_creatable        TYPE boole_d,

         is_updatable        TYPE boole_d,

         is_filterable       TYPE boole_d,

         is_title            TYPE boole_d,

         keep_in_content     TYPE boole_d,

         label_text_key      TYPE textpoolky,

         visible_in_list     TYPE /iwbep/med_annotation_value,

         visible_in_detail   TYPE /iwbep/med_annotation_value,

         display_order       TYPE /iwbep/med_annotation_value,

         semantic            TYPE /iwbep/if_mgw_med_odata_types=>ty_e_med_semantic,

         edm_type            TYPE /iwbep/if_mgw_med_odata_types=>ty_e_med_edm_type,

         currency_for_amount TYPE string,

       END OF ys_property .



DATA: ls_property TYPE ys_property,

             lv_order    TYPE i.

   CLEAR ls_property.

   ADD 10 TO lv_order.

   ls_property-entity_type       = 'Worklist'.

   ls_property-property_name     = 'zzstatus'.

   ls_property-abap_name         = 'ZZSTATUS'.

   ls_property-is_key            = abap_false.

   ls_property-is_nullable       = abap_false.

   ls_property-is_creatable      = abap_false.

   ls_property-is_updatable      = abap_false.

   ls_property-is_filterable     = abap_false.

*  ls_property-visible_in_list   = cs_annotation_values-false.

*  ls_property-visible_in_detail = cs_annotation_values-false.

   ls_property-display_order     = lv_order.

   ls_property-semantic          = ''.

   INSERT ls_property INTO TABLE it_property.

   endmethod.

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi And,

It should definitely hit the break point. Please put a static break-point.

Write this statement "BREAK-POINT" in the above method, It will stop there.

Refer below code and also change the date in the method " CHANGE_LAST_MODIFIED" to future date. Clear all your


- browser cache,

- /IWFND/CACHE_CLEANUP

- /IWBEP/CLEAR_CACHE

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

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,

        lo_annotation            TYPE REF TO /iwbep/if_mgw_odata_annotation.

  FIELD-SYMBOLS:

         <fs_association> TYPE cl_sra008_mgw_med_tea=>ys_assoc.

* Worklist Collection

  CLEAR 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'.

  INSERT ls_property INTO TABLE it_property.

  CLEAR ls_property.

  CLEAR lv_order.

  ADD 250 TO lv_order.

  ls_property-entity_type       = 'Worklist'.

  ls_property-property_name     = 'zzpdm_pm_curr'.

  ls_property-abap_name         = 'ZZPDM_PM_CURR'.

  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          = ''.

  INSERT ls_property INTO TABLE it_property.

LOOP AT it_entity INTO ls_entity.

    IF ls_entity-entity_type = 'Worklist'.

      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 ).

    

      io_entity_type = it_model->get_entity_type( 'Worklist' ).

      io_property    = io_entity_type->create_property( iv_property_name   = 'zzpdm_pm_curr'

                                                        iv_abap_fieldname  = 'ZZPDM_PM_CURR' ).

      io_property->set_nullable( abap_true ).

endif.

endloop.

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

Thanks,

VIjay

Former Member
0 Kudos

Hi Vijay,

Thank you very much.

I have added the below code i the CHANGE_METADATA, and now my custom field is shown perfectly.

I had yet the static BREAK-POINT. But it is happening something with the break-point. When I change the code of CHANGE_LAST_MODIFIED, the break-point stops in CHANGE_METADATA, but just the first time. After that the break-point doesn´t stop until I change the code in CHANGE_LAST_MODIFIED.

I have tried deleting cookies and caché in the browser but doesn´t work.

Thank you

regards

And

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

DATA:

           ls_property TYPE ys_property,

           ls_entity   TYPE  ys_entity,

           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.



LOOP AT it_entity INTO ls_entity.

       IF ls_entity-entity_type = 'Worklist'.

         io_entity_type = it_model->get_entity_type( 'Worklist' ).

         io_property    = io_entity_type->create_property( iv_property_name  = 'zzstatus'

                                                           iv_abap_fieldname = 'ZZSTATUS' ).

         io_property->set_nullable( abap_true ).

       io_entity_type = it_model->get_entity_type( 'Worklist' ).

       io_property    = io_entity_type->create_property( iv_property_name   = 'zzcomments'

                                                         iv_abap_fieldname  = 'ZZCOMMENTS' ).

       io_property->set_nullable( abap_true ).

       ENDIF.

     ENDLOOP.

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

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Thanks, good to hear that.

Regards,

Vijay

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi And,

For reference in future, please see below blog:

Regards,

Vijay

Former Member
0 Kudos

Hi Vijay

Very helpful, nice tutorial.

Thank you very much

Regards,

And

Answers (0)