Dynamically change the propeties of UI elements (Web Dynpro – SRM7.0)
Business Scenario:
Users are able to change the accounting fields (e.g. cost center) after invoicing or confirmation of a PO which is not a correct process. So we need to disable the accounting fields and related buttons of a purchase order when a Follow-on document (confirmation or invoice) exists.
Dynpro Component:
Go to the web application and right click->more field help to get the application component and view.
Application: |
/SAPSRM/WDA_L_FPM_OIF |
Web Dynpro Component: |
/SAPSRM/WDC_UI_DO_ACC |
Window Information: |
IV_L_FPC_CA_DETAILS |
View Information: |
V_DO_ACCOUNT_DETAIL |
Configuration ID: |
/SAPSRM/WDCC_UI_DO_ACC |
Enhancement using SPRO Configuration:
1. Configuration for Input Fields:
First we need to check the standard SAP SRM metadata for fields at substructure level. These entries are relevant as we are planning to define our own metadata for standard fields. We can only restrict metadata provided in standard tables. Go to the below Path:
SPRO->SAP SRM->SRM Server->Cross-Application Basic Settings->Extensions and Field Control (Personalization) ->configure field control->Display Standard Metadata Tables for Substructure Fields
Here we are having all the entries of maintenance view /SAPSRM/V_MDFSBY (Customer Configuration Table for Metadata of Set Fields). Set type 31 is related to Account assignment fields.
Now we need to customize the above standard field’s properties. Here we are changing the property of cost center field (COST_CTR). Open the below SPRO path:
SPRO->SAP SRM->SRM Server->Cross-Application Basic Settings->Extensions and Field Control (Personalization) ->configure field control->Configure Control for Fields of Substructures Or we can Use transaction SM30 and ‘/SAPSRM/V_MDFSBC’ as the maintenance view.
In this maintenance view add one new entry with the below inputs:
Object Set Type 31(Account assignment)
Structure Field Name ACC_CAT
Object Type BUS2201(Purchase Order)
Set Level ITEM
Field Visible X(checked)
Field Enable X(checked)
Dyn Customer Class Z-class (first create one class as shown in the next step)
Dyn Customer Method relevant method of Z-class
In the same way we can create an entry for other fields (e.g. G_L_ACCT, ASSET_NO etc.).
2. Configuration for Buttons:
As we did for account assignment fields, in the same way we can configure Button’s properties too. Go to the below path:
SPRO->SAP SRM->SRM Server->Cross-Application Basic Settings->Extensions and Field Control (Personalization) ->control actions-> Display Standard Metadata for Actions on Substructure Level
Standard buttons are listed there. Object type 31 is relevant to account assignment section
Open the below path or maintenance view ‘/SAPSRM/V_MDASBC’ to change the configuration of buttons:
SPRO->SAP SRM->SRM Server->Cross-Application Basic Settings->Extensions and Field Control (Personalization) ->control actions-> Configure Control of Actions on Substructure Level
Add an entry in the view with below properties:
Object Set Type 31(Account assignment)
PDO Action Type ADD_ACC_LINE
Object Type BUS2201 (Purchase Order)
Process Mode EDIT
Set Level ITEM
PDO Action Enabled X
Customer Class Z-class (first create one class as shown in the next step)
Customer Method relevant method of Z-class
Create an entry for other buttons too (e.g. COST_DISTRIBUTION, DELETE_ACC_LINE)
Creation of Dynamic Customer Class:
This class contains the logic to decide the properties dynamically of the account assignment fields/buttons. Go to SE80 or SE24 and create one Z class (e.g. ZCLG_META_FIELD_CUST). Add two Public Static methods (e.g. ACC_FIELD_DISPLAY and ACC_ACTION_DISPLAY) to this class.
Add the following parameters to the method ACC_FIELD_DISPLAY
Write the logic to change the property of fields based on different conditions:
Add the following parameters to the method ACC_ACTION_DISPLAY
Write the logic to change the property of buttons based on different conditions:
Based on your condition given in customer class, fields of account assignment will be displayed. In the same way you can set Visible and Enable propeties of different UI elements dynamically.