SAP BP Transaction Hide/Show field e.g. Instruction Key

Intro- SAP BP Transaction Hide/Show field e.g. Instruction Key

This article is a follow-up article from the 1st one in SAP BP Transaction Hide/ Show field – Instruction Key. Hereafter Please refer to the last article if you haven’t already for SAP BP Transaction to Hide/ Show field – Instruction Key.

  1. Requirement: To disable one specific field in an Address section
  2. Then Find the UI component
  3. Find technical object to do code changes
  4. Get value using IF_BOL_BO_PROPERTY_ACCESS
    • Debug to find where the value is coming from
  5. Then Get value of UI field using me-> context type
    • Debug to find how this gets populated.

Requirement: Disable a specific UI element field using SAP BP Transaction to Hide/ Show field – Instruction Key

For customer overview screen when user clicks on edit to update the address information

Disable a specific field called “Delivery service type” and then do not allow to update Phone and email sections as highlighted below.

SAP BP Transaction Hide/ Show field e.g. Instruction Key

 

Find the UI component

UI component was BP_ADDR

And View value as BP_ADDR/AccountAddressEF

SAP BP Transaction Hide/ Show field e.g. Instruction Key

 

Find Technical object to do code changes and use SAP BP Transaction to Hide/ Show field – Instruction Key

Use transaction obsp_wd_cmpwb to be able to open the component in the backend CRM system

Specific fields can be found in

Context_Nodes > Implementation class > Attributes >STRUCT.FIELD NAME

SAP BP Transaction Hide/ Show field e.g. Instruction KeySAP BP Transaction Hide/ Show field e.g. Instruction Key

There are different methods that you can find in the context node attributes as was also answered in the post below

https://answers.sap.com/questions/9678392/use-of-getter-setter-methods-in-web-ui.html

  • GET_XYZ – This is used to get the data of attribute(XYZ) from the BOL Layer and then display it on the UI
  • SET_XYZ – This is used to set the data of the attribute from the UI to the BOL layer
  • GET_M_XYZ – This defines the metadata (type) of the attribute
  • GET_I_XYZ – This defines whether the attribute is editable or noneditable i.e., using the Get_I method, you can make your field as grade out based up on any condition.
  • GET_V_XYZ – This defines the content of drop-down values, F4 Help etc i.e,you can retrieve the dropdown values based up on your condition.
  • GET_P_XYZ – This defines the property of attribute whether it’s drop down, text box, F4 help, check box etc. Also, if any followup event should trigger the same is mentioned here i.e,you can call specific even handler using P method .
  • There are two more methods which have recently got added from the above two as mentioned below
  • GET_A_XYZ – Hereafter this is used to hide or display the attribute based on the Switch ID.
  • GET_AC_XYZ – This is used for Field Action Menu Getter
  • Since I need to make the field disabled, I need to make use of the field value GET_M_DELI_SERV_TYPE
  • You can find this method in context node Buildaddress> Attributes> STRUCT.DELI_SERV_TYPE which has a set of predefined methods as seen below

The code which was used to set the value as disabled would be GET_I_XYZ

If the icon does not look green as in the above screenshot choose to redefine or one of then options below to activate the method

SAP BP Transaction Hide/ Show field e.g. Instruction Key

Find the source code as below:

  METHOD get_i_deli_serv_type.
    CALL METHOD super->get_i_deli_serv_type
      EXPORTING
        iterator    = iterator
      RECEIVING
        rv_disabled = rv_disabled.

    IF zl_bp_addr_accountaddress_impl=>gv_addr_disabled IS NOT INITIAL.
      rv_disabled = zl_bp_addr_accountaddress_impl=>gv_addr_disabled.
    ENDIF.

  ENDMETHOD.

Get the value of the UI field using IF_BOL_BO_PROPERTY_ACCESS

To access a specific value coming from the previous or current screen use the BOL property access type as mentioned below where you want to read the value from

In my case I am using ZGO_BOL_PROPERTY defined in class ZL_BP_ADDR_ACCOUNTCOMMNUM_IMPL where I want to read the attribute address number and address GUID which are attributes in that class.

SAP BP Transaction Hide/ Show field e.g. Instruction Key

If you check the interface IF_BOL_BO_PROPERTY_ACCESS, then  it has properties as below:

SAP BP Transaction Hide/ Show field e.g. Instruction Key

To be able to use the value stored in the property below code needs to be run

In ZL_BP_ADDR_ACCOUNTEMAILSE_IMPL DO_PREPARE_OUTPUT

    DATA: lo_bo        TYPE REF TO  cl_crm_bol_entity,
          lv_addr      TYPE ad_addrnum,
          lv_addr_guid TYPE bu_address_guid.

   IF zl_bp_addr_accountcommnum_impl=>zgo_bol_property IS NOT INITIAL .
      lo_bo ?=  zl_bp_addr_accountcommnum_impl=>zgo_bol_property.
    ENDIF.

    IF lo_bo IS BOUND .
      lo_bo->get_property_as_value(
        EXPORTING
          iv_attr_name =     ‘ADDRESS_NUMBER’
        IMPORTING
          ev_result    =       lv_addr
      ).

      lo_bo->get_property_as_value(
  EXPORTING
    iv_attr_name =     ‘ADDRESS_GUID’
  IMPORTING
    ev_result    =       lv_addr_guid
).

    ENDIF .

Check-in debug mode where the value is coming from

For the implementation class you can use ZL_BP_ADDR_ACCOUNTCOMMNUM_IMPL=>ZGO_BOL_PROPERTY

  1. Go to container_proxy
  2. Then Go to Data_Ref
  3. And then Click on data type which opens up
  4. Hereafter, Open the attribute_ref
  5. Then Find the address number and address value in there

Find the container proxy

SAP BP Transaction Hide/ Show field e.g. Instruction Key

1:Click on Data_ref

SAP BP Transaction Hide/ Show field e.g. Instruction Key

2:Then Click on the type below

SAP BP Transaction Hide/ Show field e.g. Instruction Key

3:Click on Attribute ref

SAP BP Transaction Hide/ Show field e.g. Instruction Key

4:Then find the values

SAP BP Transaction Hide/ Show field e.g. Instruction Key

Get the value of the UI field using me-> context type

The code using me-> would be calling the context field

ZTYPED_CONTEXT needs to be defined of type ZL_BP_ADDR_ACCOUNTCOMMNUM_CTXT

 In the implementation method ZL_BP_ADDR_ACCOUNTCOMMNUM_IMPL

SAP BP Transaction Hide/ Show field e.g. Instruction Key

In this case since we have defined a parameter using the context interface as below

    DATA: lo_bo        TYPE REF TO  cl_crm_bol_entity,
          lv_addr      TYPE ad_addrnum,
          lv_addr_guid TYPE bu_address_guid.
    lo_bo ?= me->ztyped_context->builaddress->collection_wrapper->find(
                     iv_index  = cl_bp_addr_corpaccountad1_impl=>gv_index

Check in debug mode what value is being sent using SAP BP Transaction to Hide/ Show field – Instruction Key

ztyped_context->builaddress->collection_wrapper->

SAP BP Transaction Hide/ Show field e.g. Instruction Key

Insider collection wrapper, you would find collection reference

SAP BP Transaction Hide/ Show field e.g. Instruction Key

Insider collection reference look for

SAP BP Transaction Hide/ Show field e.g. Instruction Key

SAP BP Transaction Hide/ Show field e.g. Instruction Key

Moreover, Look for entity list as above which shows 3 entries as there are 3 BP addresses on the UI

SAP BP Transaction Hide/ Show field e.g. Instruction Key

Go to one of the entities and then it would have container proxy

SAP BP Transaction Hide/ Show field e.g. Instruction Key

Follow the same steps as in 4.1

  1. Go to container_proxy
  2. Then Go to Data_Ref
  3. And then Click on data type which opens up                          
  4. Open the attribute_ref                                                                            
  5. Then Find the address number and address value in there                                                                                 For more information and services : https://peritossolutions.com/services/sap-consulting-services/

Get In Touch If You Have A Business Query

Related Posts