SAP Set Types

Introduction – Set Types and Attributes

Set Types and Attributes: Set Types are the group of different attributes which are assigned to Product/Material and are available on Product Page in CRM System. These Set Types are stored in system as a table which contains records.

Set Types and Attributes are used together with Product Hierarchy and Categories created.

A correct combination of set types with its hierarchy & category allows it to get displayed on Product page ‘COMMPR01’.

Product Hierarchy: Product Hierarchy is mainly used to structure all the Product related data, this Hierarchy depends on individual Organization requirement and process.

This Product Hierarchy consists of Product Category which is useful for categorization of Product.

Categories are assigned to Hierarchy and one Hierarchy can contain multiple categories at different level e.g. Parent and Sub category.

These Sub Categories can contain multiple Set Types with different attributes assigned to them.

For above relationships refer Figure 0:

clip_image002

Figure 0 – Set Type Relationship

COMM_ATTRSET” is the Transaction Code for creating Attribute and Set Type in SAP CRM system.

Set Types can be created only for Material/Product objects in CRM system and not for any other Objects. Set Types are customized attributes of Object Material/Product in addition to the standard attributes.

Following Figure 1 shows Set Type name “ZWATCH_SET_TYP” and Attribute name as “ZWATCH_MODELS”.

Step 1: Create Attribute

Launch the T-Code “COMM_ATTRSET” to Create Attribute.

clip_image003

Figure 1 – Creating Attribute

Attributes basically contains of two tabs, one for Definition and other for Value Range. Definition defines the characteristics of the attribute and Value Range provides option for fixed range values. Definition and Value Range are shown in Figure 2 and 3 respectively.

clip_image004

Figure 2 – Defining Characteristics

Refer to Attribute “ZWATCH_MODELS” in Figure 3 for value range.

clip_image006

Figure 3 – Assigning Values

Step 2: Create Set Type

The Set types can be created as shown in Figure 4, the assignment of attributes to the created set type is discussed further. Refer Figure 4 for creation of Set Type.

clip_image007

Figure 4 – Creating Set Type

The Set Type creation requires defining the set type and assigning attributes to it. The definition part contains option for ‘Product type selection’ and other details related to characteristics, refer Figure 5.

clip_image009

Figure 5 – Defining Set Type Characteristics

Definition of single or multiple values can be done with check “Multiple Values Possible” option. With the above option checked each record of a set type is assigned indirectly to a product using an assignment table.

clip_image010

Figure 6 – Defining Set Type Characteristics

clip_image011

Figure 7 – Multiple value attribute

Now created Attribute needs to be assigned to Set Type, refer Figure 8.

clip_image013

Figure 8 – Assigning Attribute

The steps so far showed the process to create attribute and then create a set type with reference to the attribute. The next part of the document discusses about hierarchy and how set type can be attached to screens so that users can access it.

Step 3: Create Hierarchy

In its basic form hierarchy is used to maintain the products or the object within certain criteria for differentiation. This configuration depends on individual organizations process flow.

Hierarchy can have multiple levels depending upon the information flow for any product or Object.

COMM_HIERARCHY” is Transaction code to create Hierarchy, refer Figure 9.

clip_image014

Figure 9 – Creating Hierarchy

When New Hierarchy button is clicked, Hierarchy ID and its descriptions are entered, refer Figure 10.

clip_image016

Figure 10 – Defining Hierarchy ID

When Hierarchy is created (by pressing OK button), the following screen insists for category creation. Categories, similar to hierarchy groups products and individual objects based on different criteria.

These Categories are arranged in Hierarchy, and Set Types are arranged in Categories.

These Categories can also have multiple level for Example one Root Category is mandatory and inside that Root Category there are multiple child categories.

The information shown in below Figure 11, Figure 12 and Figure 13 contains a hierarchical structure,

The reason why this has been created is to allow for flexibility in defining products.

Step 4: Create New Category

clip_image017

Figure 11 – Creating Root Category

clip_image018

Figure 12 – Setting Product Type for Category

Creating Child Category “ZW02” under Root Category “WAT_R_CAT”, refer Figure 13

Step 5: Create New Sub Category

clip_image019

Figure 13 – Creating Sub Category

When creating sub-category we need to set the Product Type as Material, refer Figure 14

clip_image020

Figure 14 – Created Sub Category

Now we have got one hierarchy “ZWATCH_HY” within which we have got one Root Category “WAT_R_CAT” and again within this Category we have got another sub-category with name “ZW02”.

· ZWATCH_HY : HIERARCHY NAME

· WAT_R_CAT : ROOT CATEGORY NAME

· ZW02 : SUB-CATEGORY NAME

Step 6: Assign Set Types to Category

To assign Set Type to a particular Category refer Figure 15.

clip_image022

Figure 15 – Adding & Assigning Set Type to Sub-Category

After assigning Set Types to a Category, refer Figure 16, Along with this we need to set two attributes Position and View-ID of that Set Type.

Both of these parameters are used to configure the availability of this Set Type in Product Master. In Our Example we have set Position = 0 and View ID = Basic (Figure 16 and Figure 17), so according to this configuration, newly added Set Type will get displayed at Position 0 in General Tab, refer Figure 18.

clip_image024

Figure 16 – Setting Position and View-ID

clip_image026

Figure 17 – Position and View-ID

clip_image028

Figure 18

In Figure 17 we have assigned our created Set Type to Category “ZW02”. Now we are all set to use this Set Type in our Product/Material screen.

To use this Set Type in Product/Material Screen we need to move to another Transaction Code “COMMPR01” to open Product/Material Details, refer Figure 19.

clip_image030

Figure 19 – Adding Sub Category to Product Page

Here we need to add our Set Type (T-Code “COMMPR01”). Click on SAP Basic Data Tab and then click on Edit button so that changes to the screen data are made.

Now when the Screen is open to edit, enter the Category in SAP Basic Data tab and press Enter, rest of the information about that Category will automatically be populated, refer Figure 19. This information will contain the Hierarchy ID and Category Description.

When once all information is entered, the document can be saved. Now, when transaction code “COMMPR01” is executed the Set Types can be seen under general tab, refer Figure 20.

clip_image032

Figure 20 – Displayed Set Type on Product Page

Above Figure 20 shows the value range that we have defined while creating Set Type, this value range will be available as F4 Help along with Set Type. For table and field details refer Figure 21.

clip_image034

Figure 21 – Set Type Table and Field name

All information that will be saved through this Set Type will be stored in table “ZWATCH_SET_TYP” this table name is same as that of Set Type name, having one field “ZZ0010” which will actually store this value shown, refer Figure 22

clip_image036

Figure 22 – Set Type Table with Saved Information

While creating a Set Type one table gets generated automatically (“ZWATCH_SET_TYP”) which stores the Set Types value, refer Figure 23

clip_image038

Figure 23 – Set Type Table Structure (Fields)

Step 1: Code Demo

The steps/processes so far discussed (creation of Attributes, Set Types, Hierarchy, Category and finally Sub Category) were from functional aspect.

After that we have to assign this Category to Products using T-Code “COMMPR01” (Product master workbench).

The following section provides technical information on how to update set types trough ABAP.

Example

Function Module “Z_UPDATE_EXT_AB” which explains how to update information in Set Type programmatically.

Figure 24 shows the Set Type under Transaction “COMMPR01” (Product master workbench).

clip_image039

Figure 24 – Code Example Set Type

clip_image041

Figure 24 – Code Example Set Type Table & Fields

Above Figure 24 shows Set Type “ZKEYWORD_EX_AB” which is used to demonstrate the ABAP code example.

Report Program to update value of Set Type

FUNCTION Z_UPDATE_EXT_AB.
*"----------------------------------------------------------------------
*"
*"Local Interface:
*"
IMPORTING
*" REFERENCE(L_PRODUCT_ID) TYPE COMT_PRODUCT_GUID
*"
REFERENCE(L_PROD_DESC) TYPE CHAR_50
*"----------------------------------------------------------------------
CONSTANTS:
abap_true TYPE sap_bool VALUE 'X',
lc_ptype TYPE char2 VALUE '01'.

DATA: lt_bapireturn TYPE bapiret2_tab, "
For Error Messages
ls_bapireturn TYPE bapiret2, "For Error Messages
ls_product TYPE comt_product, "
Product Information
lv_logsys TYPE comt_logsys. "Logical system Name



DATA: lt_product TYPE comt_product_maintain_api_extt,
ls_prod_chg TYPE comt_product_maintain_api_ext,

lt_set TYPE comt_product_maintain_api_sett,
ls_set TYPE comt_product_maintain_api_set,

lt_key TYPE REF TO zkeyword_maintain_abt,
ls_key TYPE zkeyword_maintain_ab.

ls_product-product_type = lc_ptype. "
Passing Product Type
ls_product-product_guid = l_product_id. "Passing Product GUID
ls_prod_chg-header-com_product = ls_product.

ls_set-settype_id = 'ZKEYWORD_EX_AB'. "
This is SetType Name
ls_key-data-logsys = 'BC1CLNT100'. "This is Logical system
CREATE DATA lt_key.
ls_key-data_x-zz0010 = abap_true. "
Need to pass abap_true
ls_key-data-zz0010 = l_prod_desc.
APPEND ls_key TO lt_key->;*.

ls_set-data = lt_key.
APPEND ls_set TO ls_prod_chg-data.

CLEAR ls_set.
APPEND ls_prod_chg TO lt_product.


CALL FUNCTION 'COM_PRODUCT_MAINTAIN_MULT_API'
IMPORTING
et_bapireturn = lt_bapireturn
CHANGING
ct_product = lt_product
.
IF sy-subrc <;> 0.
ENDIF.

CALL FUNCTION 'COM_PRODUCT_SAVE_API'
EXCEPTIONS
OTHERS = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = ls_bapireturn.

ENDFUNCTION.

 

Join:

www.imhere4.com

Advertisements

6 responses to “SAP Set Types

  1. kamlendra October 29, 2013 at 11:56 am

    Hi Abhishekh, this is really very good post, it give all about product information in sap crm,
    well done, thank you

  2. kamlendra October 29, 2013 at 12:01 pm

    Hi,
    I just want to know i replicated hierarchy and product from ecc to sap crm, now i have required to create some additional fild for search for material in web ui, for that we need to create new category in ecc or sap crm, if i create category in ecc than how to replicate that.

    thanks in advance

  3. Dinesh June 20, 2014 at 8:47 pm

    Thank you very much . . . This blog helped me to assign set type programatically

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: