Skip to Content

Summary

It is currently not possible to search on Employee Tax Number in SAP CRM 7.0 WebUI. Hence in order to be able to search and confirm an employee based on Tax Number, we have to make some changes, that are shown below.

Steps to Add Tax Number to Employee Search in WebUI

Start transaction BSP_WD_CMPWB and open BP_EMPL_SEARCH component. In view Search, open context node SEARCH and verify the BOL Entity bound to this node: BuilEmpAdvancedSearch.

Tela.1.jpg

Start transaction GENIL_MODEL_BROWSER and display Component BP. Open node Dynamic Query Objects and double click on BuilEmpAdvancedSearch (found in previous step). There you find the structure that you should enhance with the new field so that this field shows up within the search page.

Tela.2.jpg

Create an append structure to CRMST_EMP_SEARCH_BUIL, add TAXNUMBER field and activate the structure.

Tela.3.jpg

Open View SEARCH of Component BP_EMPL_SEARCH in transaction BSP_WD_CMPWB, and add the new field to the view configuration.

Go to transaction SE18 and open Badi BADI_CRM_BUPA_IL_SEARCH_EXT. Create a new implementation (if it doesn’t exist) and add the filter value BuilEmpAdvancedSearch for employee search.

Maintain method SEARCH_CRITERIA_INITIAL with the code below:

METHOD if_ex_crm_bupa_il_search_ext~search_criteria_initial.
  DATA:
    ls_bupa_header_search
TYPE crmt_bupa_il_header_search.

  MOVE-CORRESPONDING is_parameters TO ls_bupa_header_search.
 
IF ls_bupa_header_searchyytaxnum IS NOT INITIAL.
    cv_is_not_initial
= abap_true.
 
ENDIF.
ENDMETHOD.

Maintain method SEARCH_PARTNERS to meet your requirements.

Tip: the information about Tax Number is in tables DFKKBPTAXNUM, TFKTAXNUMTYPE, TFKTAXNUMTYPE_C and TFKTAXNUMTYPE_T. Create a database view joining these tables and table BUT000 and select this view from within method SEARCH_PARTNERS.

Steps to Add Tax Number to Employee Search Result in WebUI


Enhance view SearchResult of component BP_EMPL_SEARCH using transaction BSP_WD_CMPWB.

Tela.4.jpg

Open context node RESULT and right-click on “Attributes” to create a new Model attribute for Tax Number on Search Result screen. Follow the screenshot below to fill the wizard fields.

Tela.5.jpg

Maintain GET_TAXNUMBER method with the code below:

METHOD get_taxnumber.
 
DATA:

    lr_dref       TYPE REF TO data,

    lr_builemp    TYPE REF TO cl_crm_bol_entity,
    lr_builheader
TYPE REF TO cl_crm_bol_entity,
    lr_taxnumber 
TYPE REF TO cl_crm_bol_entity.

  IF iterator IS BOUND.
    lr_builemp
?= iterator->get_current( ).
  ELSE.
    lr_builemp
?= collection_wrapper->get_current( ).
  ENDIF.

  TRY.

    TRY.

       lr_builheader = lr_builemp->get_related_entity( ‘BuilEmpToHeaderRel’ ). “#EC NOTEXT
      lr_taxnumber
= lr_builheader->get_related_entity( ‘BuilTaxNumberRel’ ). “#EC NOTEXT
      lr_dref
= lr_taxnumber->get_property( ‘TAXNUMBER’ ). “#EC NOTEXT
    CATCH cx_crm_cic_parameter_error
          cx_crm_genil_model_error
” Error when Accessing Object Model
    ENDTRY.
 
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
        cx_crm_genil_model_error
.
    RETURN.
  ENDTRY.
  IF lr_dref IS NOT BOUND.
    value = ‘BuilTaxNumber/TAXNUMBER not bound’.            “#EC NOTEXT
    RETURN.
  ENDIF.
 
TRY.
   
value = if_bsp_model_util~convert_to_string( data_ref = lr_dref
            attribute_path
= attribute_path ).
  CATCH cx_bsp_conv_illegal_ref.
    F
IELD-SYMBOLS: <l_data> TYPE data.
   
ASSIGN lr_dref->* TO <l_data>.
   
value = ‘-CURR/QUANT REF DATA MISSING-‘.
 
CATCH cx_root.
   
value = ‘-CONVERSION FAILED-‘.                        “#EC NOTEXT
 
ENDTRY.
ENDMETHOD.


That’s it! Now you have a Tax Number field in Employee search and also in search result, with the Badi working to fetch the values!
To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply