on 12-24-2014 11:58 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vijay,
For this you have to extend the Gateway project as well.
Regards.
Tejas
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
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
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
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
Hi And,
We are at below support pack:( we upgraded recently )
SRA008 | 600 | 0008 | SAPK-60008INSRA008 | Approve 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
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.
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
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.
*************************************************************************
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.