Implementation guide for Genil Model attributes set as Read-Only

151 阅读1分钟

Created by Wang, Jerry, last modified on Jan 08, 2017

As this implementation is necessary for both approach 1 and 2, so a separate wiki page is created for introduction.

Prerequisite knowledge

CRMC_PRIL_OBJ

All Product Genil model node have a corresponding entry in E table CRMC_PRIL_OBJ with a object kind.
Each kind is handled with different logic in Genil implementation class CL_CRM_PRODIL:

CRMS_PRIL_OBKIND

This system is only maintained by SAP.

Accessed by CL_CRM_PRODIL_BO_MANAGER~GET_INSTANCE which internally call get_classname.

HANDLER_CLASS

Handler class is responsible:
set data retrieved from API layer into Genil container.
call attribute property handling class ( mentioned below in ATTR_PROP_CLASS ) to set attribute property ( read-only, hidden, editable etc )
The reason why Settype ( object kind: C ) does not have a handler class maintained here is simply because there are multiple kinds of settype modeled by SAP, each kind of them has dedicated handlers, which are maintained in another table CRMS_PRIL_OKSET

ATTR_PROP_CLASS

Responsible to set node attribute according to given rules.
This configuration could be deprecated, as in Sales & Service Addon, all properties must be set as read only.
The solution is to remove all property evaluations, instead pass a hard code value abap_false to the following method:

Once done, in WebUI all properties are disabled:

In BOL browser, all attributes are set as Read only ( R ) now:

CRMS_PRIL_OKSET

Handler class for different kinds of settype.

The corresponding handler for each settype is returned by method CL_CRM_PRODIL_BO_MANAGER~GET_CLASSNAME_FROM_SETTYPE.

COMC_SETTYPE use

For all handler classes for settypes, in CONSTRUCTOR, the table COMC_SETTYPE is read to load all settype metadata for later use:

ORG_UNIT

PROD_COMP_TYPE

  • single line settype example, a vehicle licence, could not be reused by other car
  • multiple line settype without multiple use: example

Almost all product settypes have PROD_COMP_TYPE as value 00,01,10 and 11 except these three below:

  • COMM_PR_LGTEXT2 ( Sales: Texts ) 01 - Distribution chain dependent , 20 - Long texts
  • SALES_CATEG 30, 00
  • PURCHASE_CATEG 30,00

Why we should have different handler class for 00 and 10?

Settypes in our scope

00 ( single line without multiple use ) : COMM_PR_MAT, CRMM_PR_REFOBJ
01: none ( PRREF )
10 ( multiple line without multiple use ) : CRMM_PR_TAX, COMM_PR_UNIT, COMM_PR_SHTEXT, COMM_PR_GTIN
11: none ( ISAM_O_VEH_IDS, COM_TA_R3_ID )
Nevertheless all the existing possible value for PROD_COMP_TYPE should remain in order to ensure the industry solution can still work in the future.
The two fields above are coming from COMC_SETTYPE.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":