Skip to Content
Author's profile photo Mark Saksornyuth

How to get attributes from set type of product master in SAP CRM

In this blog, I will walk you through on how to get attributes from set type of product master.
From my experience, additional fields are created in product master to meet the customer’s requirement.

The concept of product master can be found in the below link.
http://help.sap.com/saphelp_crmscen70/helpdata/en/47/b85853da7c2d64e10000000a42189c/content.htm
As a SAP developer, I will focus on the technical side.

Let me explain the tables related to our example.

  1. COMM_PRODUCT stores general data of products
  2. COMC_SETTYPE stores set type guid and read/update functions
  3. COMM_PR_FRG_REL is a relationship table which can be used to get the data from assigned set type.
  4. ZPRODINFO is a set type table which contains additional product information

T-code: COMM_ATTRSET can be used to create set types and attributes.
Set types are groups of attributes that are used to describe products.

Table relationship and coding example are shown below.

Figure 1: Table relationship

Figure 2 : Product Master


Figure 3 : Set type and Attributes


Coding Example

FUNCTION zget_prodexcl_flag.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(IM_PRODUCT_GUID) TYPE  COMT_PRODUCT_GUID
*"  EXPORTING
*"     REFERENCE(EX_PRODEXCL_FLAG) TYPE  FLAG
*"----------------------------------------------------------------------
* Note:
*  IMPORTING parameter - product_guid.

  DATA: lv_prodinfo_guid TYPE comc_settype-frgtype_guid,
        lv_prodexcl TYPE flag.
* Set Type
  DATA: lc_prod_info TYPE comc_settype-frgtype_id VALUE 'ZPRODINFO'.

  CLEAR: ex_prodexcl_flag.

  SELECT SINGLE frgtype_guid INTO lv_prodinfo_guid FROM comc_settype
  WHERE frgtype_id EQ lc_prod_info.
  IF sy-subrc EQ 0.
* Get attribute of product info set type
    SELECT SINGLE b~zz0012
      INTO ex_prodexcl_flag
      FROM comm_pr_frg_rel AS a
      INNER JOIN zprodinfo AS b
      ON a~fragment_guid = b~frg_guid
      WHERE a~product_guid EQ im_product_guid
      AND a~fragment_type EQ lv_prodinfo_guid.
  ENDIF.

ENDFUNCTION.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.