Supply Chain Management Blogs by SAP
Expand your SAP SCM knowledge and stay informed about supply chain management technology and solutions with blog posts by SAP. Follow and stay connected.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Hi,

as explained in this post, you can specify a number of days in the past in the user settings to restrict the number of documents, which is read from he back-end. This filter is of course also applied when calculating the key figures for the tiles on the home view.

Es explained in the enhancement guide for the SAP TM collaboration portal, it is also possible to add your own customer specific tiles on the home view. The respective key figures can then be calculated in a BAdI in the back-end. Until now, it was not possible to access the input parameter of function import GetKeyFigures of service /SCMTMS/GENERAL in this BAdI, hence it was not possible to use any existing date as a filter for calculating your own key figures. There is now a new SAP Note available with which the input parameters containing all dates are now passed to the respective BAdI method, so that you can optionally use the existing dates for your own key figure calculation. This is introduced with the following SAP Note:

2351350 - Collaboration Portal: Function import GetKeyFigures cannot be enhanced (Back-End)


In some cases, it may not be sufficient to use one of the existing dates which are calculated based on the number of days in the user settings, for instance when you  add your own navigation area with a completely different set of business documents. In that case, you may also introduce your own date for filtering the documents. If you do so, you may want to have that date also available as an input parameter for function import GetKeyFigures, so that you can calculate your key figure accordingly. This functionality is provided with another SAP Note:


2351348 - Collaboration Portal: Function import GetKeyFigures cannot be enhanced (Front-End)


With those two new SAP Notes, you can calculate key figures, which are consistent with the number of documents on your work lists, in case you are using a date filter to reduce the number of documents to be displayed to the carrier.



In order to make use of these new capabilities in your customer specific coding, the following changes are required:


In order to calculate a newly added key figure in BAdI method /SCMTMS/IF_GW_CUST_ENH~MAP_DATA_TO_PROPERTIES based on a specific date, there are two alternatives available.

If you want to use one of the existing dates, which are derived from the respective number of days in the past in the user settings, you can find them as an input parameter it_parameter in BAdI method /SCMTMS/IF_GW_CUST_ENH~MAP_DATA_TO_PROPERTIES and no further action has to be taken.

If you want to introduce a new date field on the UI, for instance by introducing new user settings for your own area and use this later on as an input parameter in BAdI method /SCMTMS/IF_GW_CUST_ENH~MAP_DATA_TO_PROPERTIES, you need to apply the following enhancements:

  • In the ABAP back-end, you need to add new function import parameters for function import GetKeyFigures in Gateway Service /SCMTMS/GENERAL. In order to do so, you need to add lines similar to the following example in BAdI method /SCMTMS/IF_GW_CUST_ENH~ADD_PROPERTIES:

DATA:

  lo_action      TYPE REF TO /iwbep/if_mgw_odata_action,

  lo_parameter   TYPE REF TO /iwbep/if_mgw_odata_parameter.

  1. TRY.

  CASE iv_service_name.

    WHEN '/SCMTMS/GENERAL'.

      lo_action = io_model->get_action( iv_action_name = 'GetKeyFigures' ).

      lo_parameter = lo_action->create_input_parameter(iv_parameter_name =       'ZZCustomerEnhancementDate1' iv_abap_fieldname = 'ZZCUSTOMERENHANCEMENTDATE1' ).

      lo_parameter->/iwbep/if_mgw_odata_property~set_type_edm_datetime( ).

      lo_parameter = lo_action->create_input_parameter(iv_parameter_name = 'YYCustomerEnhancementDate2' iv_abap_fieldname = 'YYCUSTOMERENHANCEMENTDATE2' ).

      lo_parameter->/iwbep/if_mgw_odata_property~set_type_edm_datetime( ).

    ENDCASE.

CATCH /iwbep/cx_mgw_med_exception.   

  1. ENDTRY.

It is important to use prefix “ZZ” or “YY” for the function import parameter field names and ABAP field names. For further details about enhancing Gateway services in general, please refer to chapter Provide customer-specific fields for existing functionality for how to enhance Gateway services.

  1. jQuery.sap.declare("zcoll_portal.Component");
  2. jQuery.sap.require("sap.tl_collaboration_portal.Component");

// new custom component

  1. sap.tl_collaboration_portal.Component.extend("zcoll_portal.Component", {

  metadata : {

customizing : {

      "sap.ui.controllerExtensions": {

"sap.tl_collaboration_portal.view.home": {

          controllerName: "zcoll_portal.CustomHome"

        }

      }

     }

    }

});


Then you need to create a CustomHome.controller.js file in your custom BSP application, similar to
the CustomShell.controller.js as described in chapter Provide a new navigation item. In this, you need to overwrite function getCustomerExtensionDate(sCustomerExtensionDateName). Within this function, you receive the names of your customer specific function import parameters, so that you can return a respective date in format "1970-01-01T00:00:00Z“.


  1. sap.ui.controller("zcoll_portal.CustomHome", {

  getCustomerExtensionDate: function(sCustomerExtensionDateName){

    if (sCustomerExtensionDateName === ‘ZZCustomerEnhancementDate1’){

      return "1970-01-01T00:00:00Z";

    } else if (sCustomerExtensionDateName === ‘YYCustomerEnhancementDate2’){

      return "2000-01-01T00:00:00Z";

    } 

  }

});


The existing enhancement guide for the SAP TM collaboration portal will be enhanced with this new information and re-published very soon!


Enjoy!

Best regards,
Sabine