In this document you learn how to add custom fields in the shopping cart. Then we will see how to add these fields in POWL.
This can also be applied to other business objects.
Adding the custom field in SC
Go to the following path in SPRO:
SAP Supplier Relationship Management -> SRM Server -> Cross-Application Basic Settings -> Extensions and Field Control (Personalization)
Define customer fields at Header Level.
Within Configure Customer Fields -> Define Customer Fields on Header Level we need to add the field in two places:
Append the field first in Append for Customer Cross-Document Database Fields on Header. Create a new Append Structure if you have not any:
Add the field you want (should start with ZZ) in my case I have created a data element that is a CHAR 4 with a domain with some values.
Don’t active the structure yet, we need to add the field in another structure and it takes a lot of time in the activation so we are going to active both structures at the same time.
Append the field also in Append for Customer Fields on Shopping Cart Header you need to create also another Append Structure if you have not any.
Now, active both structures don’t worry it takes a lot of time.
Configure field control.
For display the field we need to add it in Configure Field Control -> Configure Control for Fields on Header Level -> Metadata for Fields on Document Headers
Add a new entry for BUS2121 and mark it as Enabled and Visible:
At this point you can define a dynamic class and method for control de visualization of the field. For this example is not necessary but if you want only need to create a class with Super Class /SAPSRM/CL_PDO_DYN_META_FIELD and a method with the following parameters:
With the parameter CS_METADATA you can modify the visualization of the field dynamically.
Now the field is displayed:
Now the objective is add this field as selection criteria in POWL:
Adding the custom field in POWL
Add the field in DB Criteria
First we need to add this field in the structure /SAPSRM/S_SEARCHFIELDS. Create an Append Structure and add the field:
Now we need to add this field also in the view /SAPSRM/V_SRC_CR. So go to SM30 and add the field:
We need to know which the feeder is used for SC for continue.
|EDIT: I think this document is more accurate to find the correct POWL we need to use.
How to identify SRM POWL details and control the actions
Go to the following path in SPRO:
SAP Supplier Relationship Management à SRM Server à Cross-Application Basic Settings à POWL and Advanced Search.
Enter in Define Default POWL Application for Advanced Search and look up the Query Id for the object type BUS2121. We can see that is SAPSRM_AL_PURCHASING_02_01.
Now go to the transaction POWL_QUERY and find this Query Id.
Do double-click there and you can see what the feeder is.
Ok, return to SPRO and go to Adjust POWL Layout, Search Criteria, and Pushbuttons (transaction /SAPSRM/POWL_CUST).
Find the feeder type and select DB Criteria and add a new line with the field. At this point you can assign the search help used for this field in POWL.
Now, if you go to POWL you don’t see the field yet. Why?. You need to ‘refresh’ the Query. For do that go to se38 to the program POWL_D01 set your user and mark Display. Then choose the correct feeder and use the Delete query button.
Now the field is displayed.
Add the field in result list
If you also want to display the field in the result list is necessary to add it in the structure /SAPSRM/S_POWL_RESULT_SC_ITM. There is an include reserved for this purpose INCL_EEW_PD_SEARCH_HDR_CSF_SC “Cust.Enhancements in Shoppg Cart Header: Search Results”. Create an Append structure in this structure and add the field.
Return to SPRO Adjust POWL Layout, Search Criteria, and Pushbuttons or transaction /SAPSRM/POWL_CUST and add the field.
Refresh the query with the program POWL_D01 and now the field is also displayed in the result list.
Change POWL dinamically
Within the enhancement spot /SAPSRM/BD_CLL_POWL_FEEDER you have four Badi Definitions for change the behavior of POWL.
Let see a tiny example of use of one of these BADI definitions, goto SE18 and choose Display.
Expand the node /SAPSRM/BD_POWL_CHNG_SELCRIT and choose Create BADI implementation.
First, create the Enhancement implementation. Choose “New” and create a new one.
Then choose it and push Ok:
Now, create the BADI Implementation:
Now, if you want you can define a filter for specify with wich feeder the badi will be triggerd, is good to do it but in this case is not necessary we’re going to control it by code. So, go to the implementing class:
In the signature of the method you have the parameters you need to know the feeder and application ID.
Let’s see a sample code for hide the field or change the search help is used:
DATA: ls_selcriteria LIKE LINE OF ct_selcriteria. IF iv_flt_powl_type EQ 'SAPSRM_FEEDER_SC_PROF'. READ TABLE ct_selcriteria INTO ls_selcriteria WITH KEY selname = 'ZZ_CUSTOM_FLD'. IF sy-langu EQ 'ES'. "Put here the condition you want... ls_selcriteria-hidden = 'X'. ELSE. ls_selcriteria-ddic_shlp = 'ZZ_OTHER_DDIC_SHELP'. ls_selcriteria-mandatory = 'X'. ENDIF. MODIFY ct_selcriteria FROM ls_selcriteria INDEX sy-tabix. ENDIF.