Quantcast
Channel: SCN : All Content - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 4552

Searching and Implementing BADI in CRM Web UI

$
0
0

The purpose of the enhancement is to provide default language as FR for the CRM UI while creating a corporate account.

 

Login to the CRM system and open the Web UI using the transaction CRM_UI. It will open the default screen which will have options to create a Corporate Account.

 

image002.jpg

 

The first thing is to check the view and look for a BADI. To find the view we press F2 key in the Language field

 

image004.jpg

 

We can go to the transaction “bsp_wd_cmpwb” and open the UI component BP_ADDR.

 

image006.jpg

 

Browse to Request Processing and double click DO_PREPARE_OUTPUT

 

image008.jpg

 

We will find the code below.

 

image010.jpg

 

Double click the method do_prepare_output and it will brose to the exact line of code.

The code shows that there is a BADI which we can implement.

 

image012.jpg

 

Copy the badi name “badi_crm_bp_uiu_defaults” and open the same in SE18.

 

image014.jpg

 

We find that the BADI belongs to an enhancement spot.

 

image016.jpg

 

We thus create a BADI implementation in SE19.

 

image018.jpg

The method “get_default_values” is implemented here.

 

image020.jpg

We double click the method and write the code for the same.

 

image022.jpg

 

Given below is the same code:

 

METHOD if_uiu_bp_defaults~get_default_values.


  DATA:
      lr_current         TYPE REF TO cl_bsp_wd_value_node,
      lr_typed_contextTYPE REF TO cl_bsp_wd_context,
      lr_node            TYPE REF TO cl_bsp_wd_context_node,
      lr_coll_wrapperTYPE REF TO cl_bsp_wd_collection_wrapper.

  FIELD-SYMBOLS:
    <typed_context> TYPE any,
    <context_node> TYPE any.

  ASSIGN cr_me->('TYPED_CONTEXT') TO <typed_context>.
  IF sy-subrc= 0.
    lr_typed_context ?= <typed_context>.
    IF lr_typed_contextIS BOUND.

      ASSIGN lr_typed_context->('STANDARDADDRESS') TO <context_node>.
      IF sy-subrc= 0.
        TRY.
            lr_node            ?= <context_node>.
          CATCH cx_sy_move_cast_error. "EC_NOHANDLER
        ENDTRY.

        IF lr_nodeIS BOUND.
          lr_coll_wrapper ?= lr_node->collection_wrapper.
          IF lr_coll_wrapperIS BOUND.
            TRY.
                lr_current ?= lr_coll_wrapper->get_current( ).
                CHECK lr_currentIS BOUND.
                lr_current->set_property(iv_attr_name= 'LANGU'
                       iv_value= 'FR' ).
              CATCH cx_sy_move_cast_error.
            ENDTRY.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.


ENDMETHOD.


Viewing all articles
Browse latest Browse all 4552

Trending Articles