sap crm functionalities features

23
Testing some of the new features in SAP CRM EhP1, EhP2 and EhP3 As described in my blog post SAP CRM EhP3 Upgrade I recently performed a upgrade of a customer system from SAP CRM 7.0 EhP0 to SAP CRM 7.0 EhP3. In this blog I want to collect the configuration step necessary to enable some of the interesting features available in the SAP CRM EhP0 to EhP3. As my customers mainly are in the utilities sector I'll focus features that are relevant in the utilities sector. However, some of the features should also be relevant across different industries. Overview An overview of the enhancement available in the different enhancement packages is available here: SAP CRM EhP1: Business Functions for SAP Customer Relationship Management - SAP Library SAP CRM EhP2: Business Functions for SAP Customer Relationship Management - SAP Library SAP CRM EhP3: Business Functions for SAP Customer Relationship Management - SAP Library WebUI Framework Enhancements With EhP1 and EhP2 quite a number of notable enhancements to the WebUI framework as well as usability features where delivered. These enhancements are bundled in the business functions UI_FRW_1_DOCU and UI_FRW_2_DOCU respectively. The list of the enhancements contained in the different business functions are available in the help portal: 1. UI_FRW_1_DOCU contents: UI Framework Documentation - Business Functions for SAP Customer Relationship Management - SAP Library 2. UI_FRW_2_DOCU contents: WebClient UI Framework Documentation - Business Functions for SAP Customer Relationship Management - SAP Library To enable these business functions use transaction SFW5. Tab Order Definition One of the smaller features that improves usability of the web client a lot is the possibility to define tab orders. This functionality is enabled in the personalization settings of the user Personalization - > Personalize Settings -> Tab Order Definition Mode (see screen shot below).

Upload: ranjith

Post on 15-Dec-2015

48 views

Category:

Documents


9 download

DESCRIPTION

crm1234

TRANSCRIPT

Page 1: SAP CRM Functionalities Features

Testing some of the new features in SAP CRM EhP1 EhP2 and EhP3 As described in my blog post SAP CRM EhP3 Upgrade I recently performed a upgrade of a customer system from SAP CRM 70 EhP0 to SAP CRM 70 EhP3 In this blog I want to collect the configuration step necessary to enable some of the interesting features available in the SAP CRM EhP0 to EhP3 As my customers mainly are in the utilities sector Ill focus features that are relevant in the utilities sector However some of the features should also be relevant across different industries

Overview An overview of the enhancement available in the different enhancement packages is available here

SAP CRM EhP1 Business Functions for SAP Customer Relationship Management - SAP Library SAP CRM EhP2 Business Functions for SAP Customer Relationship Management - SAP Library SAP CRM EhP3 Business Functions for SAP Customer Relationship Management - SAP Library

WebUI Framework Enhancements With EhP1 and EhP2 quite a number of notable enhancements to the WebUI framework as well as usability features where delivered These enhancements are bundled in the business functions UI_FRW_1_DOCU and UI_FRW_2_DOCU respectively The list of the enhancements contained in the different business functions are available in the help portal

1 UI_FRW_1_DOCU contents UI Framework Documentation - Business Functions for SAP Customer Relationship Management - SAP Library

2 UI_FRW_2_DOCU contents WebClient UI Framework Documentation - Business Functions for SAP Customer Relationship Management - SAP Library To enable these business functions use transaction SFW5

Tab Order Definition One of the smaller features that improves usability of the web client a lot is the possibility to define tab orders This functionality is enabled in the personalization settings of the user Personalization -gt Personalize Settings -gt Tab Order Definition Mode (see screen shot below)

When the tab order definition mode is enabled an additional icon is visible in all overview pages Clicking on this icon start the tool that enables the definition of the tab orders for each overview page

As the tab orders are personalization they need to be individually defined per user However once a tab order is defined it is stored in table CRMC_PERS_VIEW and can easily be copied to other users The main issue with tab orders is IMHO that they are only available on overview pages Consequently it is not possible to define tab orders in IC scenarios (eg for the user role UTIL_IC) The second personalization possible regarding tabs is the exclusion of value helps from tab sequences This is especially useful in IC scenarios where it is now possible to jump between input field using just tab Again this setting is a user dependent personalization stored in table SPERS_OBJ In contrast to the tab orders it is easily possible to create a global configuration for all users by simply adding the following values to table SPERS_OBJ

MANDT 100

PERS_TYPE

OBJECT_ID

PERS_KEY WCF_TAB_CHAIN_NO_VALUE_HELP

FIELDNAME

ADD_KEY

LDATE 02042014

LTIME 173830

INTLEN 1

FIELDLEN 1

FIELDVALUE X

Navigation for Mandatory Fields The navigation to mandatory field is a really nice usability improvement especially combined with an expended message area With SAP CRM EhP1 clicking on the error message that is raised when a mandatory field is not filled automatically positions the cursor in that field This simplifies the data entry for complex input forms and reduced the need to manually select missing input fields

Custom Filter for Tables With the business function UI_FRW_1_DOCU and UI_FRW_2_DOCU quite a few usability features relate to tables in the WebUI are deliverer One of them is the possibility to define custom filters for the columns of tables in the WebUI This enables you to filter result tables similar to the filter functionality available in MS Excel

Context Menus With SAP CRM EhP1 it is possible to display context menus in BOL trees While the functionality to define different actions depending on the UI objects in the BOL tree was available in earlier releases these actions could not be displayed as a context menu but rather as a pop up window With EhP1 it is now possible to display a context menu inside the BOL tree

To enable the context menu in the BOL tree two steps are necessary

1 Enable context menu actions for the BOL tree profile

2 Define context menu action for the UI object types

In order to enable the context menu actions for a tree profile go to SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Settings for User Interfaces -gt General Functions -gt Define Object Hierarchy and Object Attributes Here you simply enable the context menu for the relevant tree profile

Next you need to define the context menu action in SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Settings for User Interfaces -gt General Functions -gt Define Context Menu The following screen shot shows the context menu customizing for the context menu shoaw above

BOL Browser amp Editor

Prior to EhP1 extending the BOL model was a quite cumbersome task It required the creation of entries in several costuming tables With EhP1 the BOL browser (transaction GENIL_MODEL_BROWSER) has been extended into a BOL model editor simplifying the creation of custom BOL models as well as the enhancement of the exiting BOL models Sumeet Gehlot has written an nice blog demonstrating how to use the BOL editor to create a custom BOL model Creating a Custom GenilBol object Model While playing around with the new BOL model browser I noticed another cool feature The new BOL browser allows to automatically generate UML diagrams for a component or a BOL object The following screen shot for example show the UML diagram for the BOL object IsuDevice in the component ISUMD

Utilities Data Import Tool The Utilities Data Import Tool is a tool for importing either account or POD data into the system This is a scenario quiet common for energy retailers in the B2B domain In the B2B domain new customers usually request a quotation based on a list of possibly hundreds of PODs not available in the system Creating these PODs manually in order to enable the creation of a quote is quite cumbersome The Data Import Tool focuses on exactly this use case by enabling end users to create PODs based on a CSV file containing the PODs An example input file for the Data Import Tool could look something like this Metering CodeGrid LevelCountryPost CodeCityStreetHouse Number DE00014545768S00XXY12304561100001NSDE52159RoetgenHauptstr1100 To import this data into the system navigate to Technical Data -gt Utilities Data Import Logs In the next screen click on New to create a new data import

In the first step of the guided procedure you specify the upload file and the upload file format

Next you create the mapping from the input file format to the target format Note that these mappings can also contain mapping rules like eg constant values Furthermore mappings can be stored for later reuse

Finally the data import is trigged in step 4 The data import runs in a batch process in the background In order to enable this functionality the two business functions CRM_UT_ER_1 and CRM_UT_ER_2 need to be activated using SFW5 The list of the enhancements contained in the different business functions are available in the help portal

CRM_UT_ER_1 content Energy Retailer - Business Functions for SAP Customer Relationship Management - SAP Library

CRM_UT_ER_2 content Energy Retailer 2 - Business Functions for SAP Customer Relationship Management - SAP Library Next temporary technical objects need to be activate in the customizing SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Technical Objects -gt Maintain Settings for Management of Temp Technical Objects Here you simply need to activate the check box qTO Management active In addition to the necessary customizing I also had to implement the following SAP Notes in order to enable the Data Import Tool

1951299 - Adding points of delivery to a premise using the DIT 1957672 - ICWC DIT - Field PD_GRID_ID is not saved in database

SEPA

Starting with SAP CRM EhP1 functionality for the handling of SEPA mandates is available in SAP CRM Sarah Ann Minge wrote a nice guide on how to configure the SEPA functionality in SAP CRM SEPA ConfigurationSet-Up Guide

CRM FIORI According to note1931218 - General Information Fiori for CRM you need EHP3 for CRM 70 (SP-stack 04 to use latest SP (SP02) for Fiori) You can also find some release information in the following note 1959305 - Release Information Note SAP Fiori transactional apps for SAP CRM 10 If you go to httpservicesapcomswdc choose Browse our Download Catalog you can choose SAP Fiori and then SAP Fiori for Suite in the main area of the browser the backend part is the one called FIORI CRM APPLICATIONS X2 the frontend part is called UI FOR SAP CRM ENHANCE PACKAGE

You can find the detailed information at the link below including minimum requirements for the CRM backend SAP Fiori Apps for SAP CRM - SAP Fiori Apps for Lower Back-End Releases - SAP Library

GUID means Global Unique Identifier You use a GUID when you need to identify an

objectcomponent with a unique id GUID is a unique key for any object in CRM In CRM

they are either 16 bit 22 bit or 32 bit of char and hexadecimal in nature 2 types of

GUIDs Header amp item For header there will be a unique GUID and for each item-line

there will be another unique GUID

GUIDs are created using the Function Module ldquoGUID_CREATErdquo in SAP CRM From the

lsquoExportrsquo parameters you will know that there are only three types of GUIDs

A small gift function modules to data exchange in 16 bit 32 bit and 22 bit exchange ndash ldquoGUID_CONVERTrdquo

One more use of GUID is persistence services and hiding the database accesses

Different business objects of different types may share the same key format and hence

may have the same business key although they are of different types and are stored in

different tables as the above reply shows But when we deal with them as ABAP Objects we need to uniquely identify one business object we can do that using GUID

When any object is to be transferred to other system itrsquos the GUID that is used as there are no replicas and easy to distinguish

Eg Consider a Company lsquoArsquo has 2 departments-Sales1 and Sales2 and in that there are

sub departments-products and finance Now each product and finance of both sales1 and

sales2 will have employees with same object_id So to avoid the dilemma crm creates a

GUID for each employee which differentiates each of them

CRM BOL

SAP CRM Webclient UI - Framework

Previous postNext post

Creating a Custom GenilBol object Model Posted by Sumeet Gehlot in SAP CRM Webclient UI - Framework on Aug 6 2012 111032 AM inShare

Defining and Creating a Genil Model

You could define and implement dynamic models

using IF_GENIL_APPL_MODEL Interface

use GENIL_MODEL_EDITOR OR GENIL_MODEL_BROWSER to create static models

As Genil component class extends default implementation

ofIF_GENIL_APPLMODEL_PERSISTENCY namely CL_WCF_GENIL_ABSTR_COMPONENT

Step 1 Go to Transaction SE24 or SE80 Create a new abap Custom Genil Class

ZCL_CUSTOMER_MODEL

As this class use statically defined model we inherit fromCL_WCF_GENIL_ABSTR_COMPONENT

Save and activate the class

Step 2 Registering of Genil component is done using Transaction SM34

Enter View Cluster name as CRMVC_GIL_APPDEF or we can use maintaince

viewCRMV_GIL_COMP

Click maintain button

Maintain the entries for Component Definition Component Set Definition and

Component Assignment

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 2: SAP CRM Functionalities Features

When the tab order definition mode is enabled an additional icon is visible in all overview pages Clicking on this icon start the tool that enables the definition of the tab orders for each overview page

As the tab orders are personalization they need to be individually defined per user However once a tab order is defined it is stored in table CRMC_PERS_VIEW and can easily be copied to other users The main issue with tab orders is IMHO that they are only available on overview pages Consequently it is not possible to define tab orders in IC scenarios (eg for the user role UTIL_IC) The second personalization possible regarding tabs is the exclusion of value helps from tab sequences This is especially useful in IC scenarios where it is now possible to jump between input field using just tab Again this setting is a user dependent personalization stored in table SPERS_OBJ In contrast to the tab orders it is easily possible to create a global configuration for all users by simply adding the following values to table SPERS_OBJ

MANDT 100

PERS_TYPE

OBJECT_ID

PERS_KEY WCF_TAB_CHAIN_NO_VALUE_HELP

FIELDNAME

ADD_KEY

LDATE 02042014

LTIME 173830

INTLEN 1

FIELDLEN 1

FIELDVALUE X

Navigation for Mandatory Fields The navigation to mandatory field is a really nice usability improvement especially combined with an expended message area With SAP CRM EhP1 clicking on the error message that is raised when a mandatory field is not filled automatically positions the cursor in that field This simplifies the data entry for complex input forms and reduced the need to manually select missing input fields

Custom Filter for Tables With the business function UI_FRW_1_DOCU and UI_FRW_2_DOCU quite a few usability features relate to tables in the WebUI are deliverer One of them is the possibility to define custom filters for the columns of tables in the WebUI This enables you to filter result tables similar to the filter functionality available in MS Excel

Context Menus With SAP CRM EhP1 it is possible to display context menus in BOL trees While the functionality to define different actions depending on the UI objects in the BOL tree was available in earlier releases these actions could not be displayed as a context menu but rather as a pop up window With EhP1 it is now possible to display a context menu inside the BOL tree

To enable the context menu in the BOL tree two steps are necessary

1 Enable context menu actions for the BOL tree profile

2 Define context menu action for the UI object types

In order to enable the context menu actions for a tree profile go to SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Settings for User Interfaces -gt General Functions -gt Define Object Hierarchy and Object Attributes Here you simply enable the context menu for the relevant tree profile

Next you need to define the context menu action in SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Settings for User Interfaces -gt General Functions -gt Define Context Menu The following screen shot shows the context menu customizing for the context menu shoaw above

BOL Browser amp Editor

Prior to EhP1 extending the BOL model was a quite cumbersome task It required the creation of entries in several costuming tables With EhP1 the BOL browser (transaction GENIL_MODEL_BROWSER) has been extended into a BOL model editor simplifying the creation of custom BOL models as well as the enhancement of the exiting BOL models Sumeet Gehlot has written an nice blog demonstrating how to use the BOL editor to create a custom BOL model Creating a Custom GenilBol object Model While playing around with the new BOL model browser I noticed another cool feature The new BOL browser allows to automatically generate UML diagrams for a component or a BOL object The following screen shot for example show the UML diagram for the BOL object IsuDevice in the component ISUMD

Utilities Data Import Tool The Utilities Data Import Tool is a tool for importing either account or POD data into the system This is a scenario quiet common for energy retailers in the B2B domain In the B2B domain new customers usually request a quotation based on a list of possibly hundreds of PODs not available in the system Creating these PODs manually in order to enable the creation of a quote is quite cumbersome The Data Import Tool focuses on exactly this use case by enabling end users to create PODs based on a CSV file containing the PODs An example input file for the Data Import Tool could look something like this Metering CodeGrid LevelCountryPost CodeCityStreetHouse Number DE00014545768S00XXY12304561100001NSDE52159RoetgenHauptstr1100 To import this data into the system navigate to Technical Data -gt Utilities Data Import Logs In the next screen click on New to create a new data import

In the first step of the guided procedure you specify the upload file and the upload file format

Next you create the mapping from the input file format to the target format Note that these mappings can also contain mapping rules like eg constant values Furthermore mappings can be stored for later reuse

Finally the data import is trigged in step 4 The data import runs in a batch process in the background In order to enable this functionality the two business functions CRM_UT_ER_1 and CRM_UT_ER_2 need to be activated using SFW5 The list of the enhancements contained in the different business functions are available in the help portal

CRM_UT_ER_1 content Energy Retailer - Business Functions for SAP Customer Relationship Management - SAP Library

CRM_UT_ER_2 content Energy Retailer 2 - Business Functions for SAP Customer Relationship Management - SAP Library Next temporary technical objects need to be activate in the customizing SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Technical Objects -gt Maintain Settings for Management of Temp Technical Objects Here you simply need to activate the check box qTO Management active In addition to the necessary customizing I also had to implement the following SAP Notes in order to enable the Data Import Tool

1951299 - Adding points of delivery to a premise using the DIT 1957672 - ICWC DIT - Field PD_GRID_ID is not saved in database

SEPA

Starting with SAP CRM EhP1 functionality for the handling of SEPA mandates is available in SAP CRM Sarah Ann Minge wrote a nice guide on how to configure the SEPA functionality in SAP CRM SEPA ConfigurationSet-Up Guide

CRM FIORI According to note1931218 - General Information Fiori for CRM you need EHP3 for CRM 70 (SP-stack 04 to use latest SP (SP02) for Fiori) You can also find some release information in the following note 1959305 - Release Information Note SAP Fiori transactional apps for SAP CRM 10 If you go to httpservicesapcomswdc choose Browse our Download Catalog you can choose SAP Fiori and then SAP Fiori for Suite in the main area of the browser the backend part is the one called FIORI CRM APPLICATIONS X2 the frontend part is called UI FOR SAP CRM ENHANCE PACKAGE

You can find the detailed information at the link below including minimum requirements for the CRM backend SAP Fiori Apps for SAP CRM - SAP Fiori Apps for Lower Back-End Releases - SAP Library

GUID means Global Unique Identifier You use a GUID when you need to identify an

objectcomponent with a unique id GUID is a unique key for any object in CRM In CRM

they are either 16 bit 22 bit or 32 bit of char and hexadecimal in nature 2 types of

GUIDs Header amp item For header there will be a unique GUID and for each item-line

there will be another unique GUID

GUIDs are created using the Function Module ldquoGUID_CREATErdquo in SAP CRM From the

lsquoExportrsquo parameters you will know that there are only three types of GUIDs

A small gift function modules to data exchange in 16 bit 32 bit and 22 bit exchange ndash ldquoGUID_CONVERTrdquo

One more use of GUID is persistence services and hiding the database accesses

Different business objects of different types may share the same key format and hence

may have the same business key although they are of different types and are stored in

different tables as the above reply shows But when we deal with them as ABAP Objects we need to uniquely identify one business object we can do that using GUID

When any object is to be transferred to other system itrsquos the GUID that is used as there are no replicas and easy to distinguish

Eg Consider a Company lsquoArsquo has 2 departments-Sales1 and Sales2 and in that there are

sub departments-products and finance Now each product and finance of both sales1 and

sales2 will have employees with same object_id So to avoid the dilemma crm creates a

GUID for each employee which differentiates each of them

CRM BOL

SAP CRM Webclient UI - Framework

Previous postNext post

Creating a Custom GenilBol object Model Posted by Sumeet Gehlot in SAP CRM Webclient UI - Framework on Aug 6 2012 111032 AM inShare

Defining and Creating a Genil Model

You could define and implement dynamic models

using IF_GENIL_APPL_MODEL Interface

use GENIL_MODEL_EDITOR OR GENIL_MODEL_BROWSER to create static models

As Genil component class extends default implementation

ofIF_GENIL_APPLMODEL_PERSISTENCY namely CL_WCF_GENIL_ABSTR_COMPONENT

Step 1 Go to Transaction SE24 or SE80 Create a new abap Custom Genil Class

ZCL_CUSTOMER_MODEL

As this class use statically defined model we inherit fromCL_WCF_GENIL_ABSTR_COMPONENT

Save and activate the class

Step 2 Registering of Genil component is done using Transaction SM34

Enter View Cluster name as CRMVC_GIL_APPDEF or we can use maintaince

viewCRMV_GIL_COMP

Click maintain button

Maintain the entries for Component Definition Component Set Definition and

Component Assignment

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 3: SAP CRM Functionalities Features

INTLEN 1

FIELDLEN 1

FIELDVALUE X

Navigation for Mandatory Fields The navigation to mandatory field is a really nice usability improvement especially combined with an expended message area With SAP CRM EhP1 clicking on the error message that is raised when a mandatory field is not filled automatically positions the cursor in that field This simplifies the data entry for complex input forms and reduced the need to manually select missing input fields

Custom Filter for Tables With the business function UI_FRW_1_DOCU and UI_FRW_2_DOCU quite a few usability features relate to tables in the WebUI are deliverer One of them is the possibility to define custom filters for the columns of tables in the WebUI This enables you to filter result tables similar to the filter functionality available in MS Excel

Context Menus With SAP CRM EhP1 it is possible to display context menus in BOL trees While the functionality to define different actions depending on the UI objects in the BOL tree was available in earlier releases these actions could not be displayed as a context menu but rather as a pop up window With EhP1 it is now possible to display a context menu inside the BOL tree

To enable the context menu in the BOL tree two steps are necessary

1 Enable context menu actions for the BOL tree profile

2 Define context menu action for the UI object types

In order to enable the context menu actions for a tree profile go to SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Settings for User Interfaces -gt General Functions -gt Define Object Hierarchy and Object Attributes Here you simply enable the context menu for the relevant tree profile

Next you need to define the context menu action in SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Settings for User Interfaces -gt General Functions -gt Define Context Menu The following screen shot shows the context menu customizing for the context menu shoaw above

BOL Browser amp Editor

Prior to EhP1 extending the BOL model was a quite cumbersome task It required the creation of entries in several costuming tables With EhP1 the BOL browser (transaction GENIL_MODEL_BROWSER) has been extended into a BOL model editor simplifying the creation of custom BOL models as well as the enhancement of the exiting BOL models Sumeet Gehlot has written an nice blog demonstrating how to use the BOL editor to create a custom BOL model Creating a Custom GenilBol object Model While playing around with the new BOL model browser I noticed another cool feature The new BOL browser allows to automatically generate UML diagrams for a component or a BOL object The following screen shot for example show the UML diagram for the BOL object IsuDevice in the component ISUMD

Utilities Data Import Tool The Utilities Data Import Tool is a tool for importing either account or POD data into the system This is a scenario quiet common for energy retailers in the B2B domain In the B2B domain new customers usually request a quotation based on a list of possibly hundreds of PODs not available in the system Creating these PODs manually in order to enable the creation of a quote is quite cumbersome The Data Import Tool focuses on exactly this use case by enabling end users to create PODs based on a CSV file containing the PODs An example input file for the Data Import Tool could look something like this Metering CodeGrid LevelCountryPost CodeCityStreetHouse Number DE00014545768S00XXY12304561100001NSDE52159RoetgenHauptstr1100 To import this data into the system navigate to Technical Data -gt Utilities Data Import Logs In the next screen click on New to create a new data import

In the first step of the guided procedure you specify the upload file and the upload file format

Next you create the mapping from the input file format to the target format Note that these mappings can also contain mapping rules like eg constant values Furthermore mappings can be stored for later reuse

Finally the data import is trigged in step 4 The data import runs in a batch process in the background In order to enable this functionality the two business functions CRM_UT_ER_1 and CRM_UT_ER_2 need to be activated using SFW5 The list of the enhancements contained in the different business functions are available in the help portal

CRM_UT_ER_1 content Energy Retailer - Business Functions for SAP Customer Relationship Management - SAP Library

CRM_UT_ER_2 content Energy Retailer 2 - Business Functions for SAP Customer Relationship Management - SAP Library Next temporary technical objects need to be activate in the customizing SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Technical Objects -gt Maintain Settings for Management of Temp Technical Objects Here you simply need to activate the check box qTO Management active In addition to the necessary customizing I also had to implement the following SAP Notes in order to enable the Data Import Tool

1951299 - Adding points of delivery to a premise using the DIT 1957672 - ICWC DIT - Field PD_GRID_ID is not saved in database

SEPA

Starting with SAP CRM EhP1 functionality for the handling of SEPA mandates is available in SAP CRM Sarah Ann Minge wrote a nice guide on how to configure the SEPA functionality in SAP CRM SEPA ConfigurationSet-Up Guide

CRM FIORI According to note1931218 - General Information Fiori for CRM you need EHP3 for CRM 70 (SP-stack 04 to use latest SP (SP02) for Fiori) You can also find some release information in the following note 1959305 - Release Information Note SAP Fiori transactional apps for SAP CRM 10 If you go to httpservicesapcomswdc choose Browse our Download Catalog you can choose SAP Fiori and then SAP Fiori for Suite in the main area of the browser the backend part is the one called FIORI CRM APPLICATIONS X2 the frontend part is called UI FOR SAP CRM ENHANCE PACKAGE

You can find the detailed information at the link below including minimum requirements for the CRM backend SAP Fiori Apps for SAP CRM - SAP Fiori Apps for Lower Back-End Releases - SAP Library

GUID means Global Unique Identifier You use a GUID when you need to identify an

objectcomponent with a unique id GUID is a unique key for any object in CRM In CRM

they are either 16 bit 22 bit or 32 bit of char and hexadecimal in nature 2 types of

GUIDs Header amp item For header there will be a unique GUID and for each item-line

there will be another unique GUID

GUIDs are created using the Function Module ldquoGUID_CREATErdquo in SAP CRM From the

lsquoExportrsquo parameters you will know that there are only three types of GUIDs

A small gift function modules to data exchange in 16 bit 32 bit and 22 bit exchange ndash ldquoGUID_CONVERTrdquo

One more use of GUID is persistence services and hiding the database accesses

Different business objects of different types may share the same key format and hence

may have the same business key although they are of different types and are stored in

different tables as the above reply shows But when we deal with them as ABAP Objects we need to uniquely identify one business object we can do that using GUID

When any object is to be transferred to other system itrsquos the GUID that is used as there are no replicas and easy to distinguish

Eg Consider a Company lsquoArsquo has 2 departments-Sales1 and Sales2 and in that there are

sub departments-products and finance Now each product and finance of both sales1 and

sales2 will have employees with same object_id So to avoid the dilemma crm creates a

GUID for each employee which differentiates each of them

CRM BOL

SAP CRM Webclient UI - Framework

Previous postNext post

Creating a Custom GenilBol object Model Posted by Sumeet Gehlot in SAP CRM Webclient UI - Framework on Aug 6 2012 111032 AM inShare

Defining and Creating a Genil Model

You could define and implement dynamic models

using IF_GENIL_APPL_MODEL Interface

use GENIL_MODEL_EDITOR OR GENIL_MODEL_BROWSER to create static models

As Genil component class extends default implementation

ofIF_GENIL_APPLMODEL_PERSISTENCY namely CL_WCF_GENIL_ABSTR_COMPONENT

Step 1 Go to Transaction SE24 or SE80 Create a new abap Custom Genil Class

ZCL_CUSTOMER_MODEL

As this class use statically defined model we inherit fromCL_WCF_GENIL_ABSTR_COMPONENT

Save and activate the class

Step 2 Registering of Genil component is done using Transaction SM34

Enter View Cluster name as CRMVC_GIL_APPDEF or we can use maintaince

viewCRMV_GIL_COMP

Click maintain button

Maintain the entries for Component Definition Component Set Definition and

Component Assignment

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 4: SAP CRM Functionalities Features

To enable the context menu in the BOL tree two steps are necessary

1 Enable context menu actions for the BOL tree profile

2 Define context menu action for the UI object types

In order to enable the context menu actions for a tree profile go to SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Settings for User Interfaces -gt General Functions -gt Define Object Hierarchy and Object Attributes Here you simply enable the context menu for the relevant tree profile

Next you need to define the context menu action in SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Settings for User Interfaces -gt General Functions -gt Define Context Menu The following screen shot shows the context menu customizing for the context menu shoaw above

BOL Browser amp Editor

Prior to EhP1 extending the BOL model was a quite cumbersome task It required the creation of entries in several costuming tables With EhP1 the BOL browser (transaction GENIL_MODEL_BROWSER) has been extended into a BOL model editor simplifying the creation of custom BOL models as well as the enhancement of the exiting BOL models Sumeet Gehlot has written an nice blog demonstrating how to use the BOL editor to create a custom BOL model Creating a Custom GenilBol object Model While playing around with the new BOL model browser I noticed another cool feature The new BOL browser allows to automatically generate UML diagrams for a component or a BOL object The following screen shot for example show the UML diagram for the BOL object IsuDevice in the component ISUMD

Utilities Data Import Tool The Utilities Data Import Tool is a tool for importing either account or POD data into the system This is a scenario quiet common for energy retailers in the B2B domain In the B2B domain new customers usually request a quotation based on a list of possibly hundreds of PODs not available in the system Creating these PODs manually in order to enable the creation of a quote is quite cumbersome The Data Import Tool focuses on exactly this use case by enabling end users to create PODs based on a CSV file containing the PODs An example input file for the Data Import Tool could look something like this Metering CodeGrid LevelCountryPost CodeCityStreetHouse Number DE00014545768S00XXY12304561100001NSDE52159RoetgenHauptstr1100 To import this data into the system navigate to Technical Data -gt Utilities Data Import Logs In the next screen click on New to create a new data import

In the first step of the guided procedure you specify the upload file and the upload file format

Next you create the mapping from the input file format to the target format Note that these mappings can also contain mapping rules like eg constant values Furthermore mappings can be stored for later reuse

Finally the data import is trigged in step 4 The data import runs in a batch process in the background In order to enable this functionality the two business functions CRM_UT_ER_1 and CRM_UT_ER_2 need to be activated using SFW5 The list of the enhancements contained in the different business functions are available in the help portal

CRM_UT_ER_1 content Energy Retailer - Business Functions for SAP Customer Relationship Management - SAP Library

CRM_UT_ER_2 content Energy Retailer 2 - Business Functions for SAP Customer Relationship Management - SAP Library Next temporary technical objects need to be activate in the customizing SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Technical Objects -gt Maintain Settings for Management of Temp Technical Objects Here you simply need to activate the check box qTO Management active In addition to the necessary customizing I also had to implement the following SAP Notes in order to enable the Data Import Tool

1951299 - Adding points of delivery to a premise using the DIT 1957672 - ICWC DIT - Field PD_GRID_ID is not saved in database

SEPA

Starting with SAP CRM EhP1 functionality for the handling of SEPA mandates is available in SAP CRM Sarah Ann Minge wrote a nice guide on how to configure the SEPA functionality in SAP CRM SEPA ConfigurationSet-Up Guide

CRM FIORI According to note1931218 - General Information Fiori for CRM you need EHP3 for CRM 70 (SP-stack 04 to use latest SP (SP02) for Fiori) You can also find some release information in the following note 1959305 - Release Information Note SAP Fiori transactional apps for SAP CRM 10 If you go to httpservicesapcomswdc choose Browse our Download Catalog you can choose SAP Fiori and then SAP Fiori for Suite in the main area of the browser the backend part is the one called FIORI CRM APPLICATIONS X2 the frontend part is called UI FOR SAP CRM ENHANCE PACKAGE

You can find the detailed information at the link below including minimum requirements for the CRM backend SAP Fiori Apps for SAP CRM - SAP Fiori Apps for Lower Back-End Releases - SAP Library

GUID means Global Unique Identifier You use a GUID when you need to identify an

objectcomponent with a unique id GUID is a unique key for any object in CRM In CRM

they are either 16 bit 22 bit or 32 bit of char and hexadecimal in nature 2 types of

GUIDs Header amp item For header there will be a unique GUID and for each item-line

there will be another unique GUID

GUIDs are created using the Function Module ldquoGUID_CREATErdquo in SAP CRM From the

lsquoExportrsquo parameters you will know that there are only three types of GUIDs

A small gift function modules to data exchange in 16 bit 32 bit and 22 bit exchange ndash ldquoGUID_CONVERTrdquo

One more use of GUID is persistence services and hiding the database accesses

Different business objects of different types may share the same key format and hence

may have the same business key although they are of different types and are stored in

different tables as the above reply shows But when we deal with them as ABAP Objects we need to uniquely identify one business object we can do that using GUID

When any object is to be transferred to other system itrsquos the GUID that is used as there are no replicas and easy to distinguish

Eg Consider a Company lsquoArsquo has 2 departments-Sales1 and Sales2 and in that there are

sub departments-products and finance Now each product and finance of both sales1 and

sales2 will have employees with same object_id So to avoid the dilemma crm creates a

GUID for each employee which differentiates each of them

CRM BOL

SAP CRM Webclient UI - Framework

Previous postNext post

Creating a Custom GenilBol object Model Posted by Sumeet Gehlot in SAP CRM Webclient UI - Framework on Aug 6 2012 111032 AM inShare

Defining and Creating a Genil Model

You could define and implement dynamic models

using IF_GENIL_APPL_MODEL Interface

use GENIL_MODEL_EDITOR OR GENIL_MODEL_BROWSER to create static models

As Genil component class extends default implementation

ofIF_GENIL_APPLMODEL_PERSISTENCY namely CL_WCF_GENIL_ABSTR_COMPONENT

Step 1 Go to Transaction SE24 or SE80 Create a new abap Custom Genil Class

ZCL_CUSTOMER_MODEL

As this class use statically defined model we inherit fromCL_WCF_GENIL_ABSTR_COMPONENT

Save and activate the class

Step 2 Registering of Genil component is done using Transaction SM34

Enter View Cluster name as CRMVC_GIL_APPDEF or we can use maintaince

viewCRMV_GIL_COMP

Click maintain button

Maintain the entries for Component Definition Component Set Definition and

Component Assignment

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 5: SAP CRM Functionalities Features

BOL Browser amp Editor

Prior to EhP1 extending the BOL model was a quite cumbersome task It required the creation of entries in several costuming tables With EhP1 the BOL browser (transaction GENIL_MODEL_BROWSER) has been extended into a BOL model editor simplifying the creation of custom BOL models as well as the enhancement of the exiting BOL models Sumeet Gehlot has written an nice blog demonstrating how to use the BOL editor to create a custom BOL model Creating a Custom GenilBol object Model While playing around with the new BOL model browser I noticed another cool feature The new BOL browser allows to automatically generate UML diagrams for a component or a BOL object The following screen shot for example show the UML diagram for the BOL object IsuDevice in the component ISUMD

Utilities Data Import Tool The Utilities Data Import Tool is a tool for importing either account or POD data into the system This is a scenario quiet common for energy retailers in the B2B domain In the B2B domain new customers usually request a quotation based on a list of possibly hundreds of PODs not available in the system Creating these PODs manually in order to enable the creation of a quote is quite cumbersome The Data Import Tool focuses on exactly this use case by enabling end users to create PODs based on a CSV file containing the PODs An example input file for the Data Import Tool could look something like this Metering CodeGrid LevelCountryPost CodeCityStreetHouse Number DE00014545768S00XXY12304561100001NSDE52159RoetgenHauptstr1100 To import this data into the system navigate to Technical Data -gt Utilities Data Import Logs In the next screen click on New to create a new data import

In the first step of the guided procedure you specify the upload file and the upload file format

Next you create the mapping from the input file format to the target format Note that these mappings can also contain mapping rules like eg constant values Furthermore mappings can be stored for later reuse

Finally the data import is trigged in step 4 The data import runs in a batch process in the background In order to enable this functionality the two business functions CRM_UT_ER_1 and CRM_UT_ER_2 need to be activated using SFW5 The list of the enhancements contained in the different business functions are available in the help portal

CRM_UT_ER_1 content Energy Retailer - Business Functions for SAP Customer Relationship Management - SAP Library

CRM_UT_ER_2 content Energy Retailer 2 - Business Functions for SAP Customer Relationship Management - SAP Library Next temporary technical objects need to be activate in the customizing SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Technical Objects -gt Maintain Settings for Management of Temp Technical Objects Here you simply need to activate the check box qTO Management active In addition to the necessary customizing I also had to implement the following SAP Notes in order to enable the Data Import Tool

1951299 - Adding points of delivery to a premise using the DIT 1957672 - ICWC DIT - Field PD_GRID_ID is not saved in database

SEPA

Starting with SAP CRM EhP1 functionality for the handling of SEPA mandates is available in SAP CRM Sarah Ann Minge wrote a nice guide on how to configure the SEPA functionality in SAP CRM SEPA ConfigurationSet-Up Guide

CRM FIORI According to note1931218 - General Information Fiori for CRM you need EHP3 for CRM 70 (SP-stack 04 to use latest SP (SP02) for Fiori) You can also find some release information in the following note 1959305 - Release Information Note SAP Fiori transactional apps for SAP CRM 10 If you go to httpservicesapcomswdc choose Browse our Download Catalog you can choose SAP Fiori and then SAP Fiori for Suite in the main area of the browser the backend part is the one called FIORI CRM APPLICATIONS X2 the frontend part is called UI FOR SAP CRM ENHANCE PACKAGE

You can find the detailed information at the link below including minimum requirements for the CRM backend SAP Fiori Apps for SAP CRM - SAP Fiori Apps for Lower Back-End Releases - SAP Library

GUID means Global Unique Identifier You use a GUID when you need to identify an

objectcomponent with a unique id GUID is a unique key for any object in CRM In CRM

they are either 16 bit 22 bit or 32 bit of char and hexadecimal in nature 2 types of

GUIDs Header amp item For header there will be a unique GUID and for each item-line

there will be another unique GUID

GUIDs are created using the Function Module ldquoGUID_CREATErdquo in SAP CRM From the

lsquoExportrsquo parameters you will know that there are only three types of GUIDs

A small gift function modules to data exchange in 16 bit 32 bit and 22 bit exchange ndash ldquoGUID_CONVERTrdquo

One more use of GUID is persistence services and hiding the database accesses

Different business objects of different types may share the same key format and hence

may have the same business key although they are of different types and are stored in

different tables as the above reply shows But when we deal with them as ABAP Objects we need to uniquely identify one business object we can do that using GUID

When any object is to be transferred to other system itrsquos the GUID that is used as there are no replicas and easy to distinguish

Eg Consider a Company lsquoArsquo has 2 departments-Sales1 and Sales2 and in that there are

sub departments-products and finance Now each product and finance of both sales1 and

sales2 will have employees with same object_id So to avoid the dilemma crm creates a

GUID for each employee which differentiates each of them

CRM BOL

SAP CRM Webclient UI - Framework

Previous postNext post

Creating a Custom GenilBol object Model Posted by Sumeet Gehlot in SAP CRM Webclient UI - Framework on Aug 6 2012 111032 AM inShare

Defining and Creating a Genil Model

You could define and implement dynamic models

using IF_GENIL_APPL_MODEL Interface

use GENIL_MODEL_EDITOR OR GENIL_MODEL_BROWSER to create static models

As Genil component class extends default implementation

ofIF_GENIL_APPLMODEL_PERSISTENCY namely CL_WCF_GENIL_ABSTR_COMPONENT

Step 1 Go to Transaction SE24 or SE80 Create a new abap Custom Genil Class

ZCL_CUSTOMER_MODEL

As this class use statically defined model we inherit fromCL_WCF_GENIL_ABSTR_COMPONENT

Save and activate the class

Step 2 Registering of Genil component is done using Transaction SM34

Enter View Cluster name as CRMVC_GIL_APPDEF or we can use maintaince

viewCRMV_GIL_COMP

Click maintain button

Maintain the entries for Component Definition Component Set Definition and

Component Assignment

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 6: SAP CRM Functionalities Features

In the first step of the guided procedure you specify the upload file and the upload file format

Next you create the mapping from the input file format to the target format Note that these mappings can also contain mapping rules like eg constant values Furthermore mappings can be stored for later reuse

Finally the data import is trigged in step 4 The data import runs in a batch process in the background In order to enable this functionality the two business functions CRM_UT_ER_1 and CRM_UT_ER_2 need to be activated using SFW5 The list of the enhancements contained in the different business functions are available in the help portal

CRM_UT_ER_1 content Energy Retailer - Business Functions for SAP Customer Relationship Management - SAP Library

CRM_UT_ER_2 content Energy Retailer 2 - Business Functions for SAP Customer Relationship Management - SAP Library Next temporary technical objects need to be activate in the customizing SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Technical Objects -gt Maintain Settings for Management of Temp Technical Objects Here you simply need to activate the check box qTO Management active In addition to the necessary customizing I also had to implement the following SAP Notes in order to enable the Data Import Tool

1951299 - Adding points of delivery to a premise using the DIT 1957672 - ICWC DIT - Field PD_GRID_ID is not saved in database

SEPA

Starting with SAP CRM EhP1 functionality for the handling of SEPA mandates is available in SAP CRM Sarah Ann Minge wrote a nice guide on how to configure the SEPA functionality in SAP CRM SEPA ConfigurationSet-Up Guide

CRM FIORI According to note1931218 - General Information Fiori for CRM you need EHP3 for CRM 70 (SP-stack 04 to use latest SP (SP02) for Fiori) You can also find some release information in the following note 1959305 - Release Information Note SAP Fiori transactional apps for SAP CRM 10 If you go to httpservicesapcomswdc choose Browse our Download Catalog you can choose SAP Fiori and then SAP Fiori for Suite in the main area of the browser the backend part is the one called FIORI CRM APPLICATIONS X2 the frontend part is called UI FOR SAP CRM ENHANCE PACKAGE

You can find the detailed information at the link below including minimum requirements for the CRM backend SAP Fiori Apps for SAP CRM - SAP Fiori Apps for Lower Back-End Releases - SAP Library

GUID means Global Unique Identifier You use a GUID when you need to identify an

objectcomponent with a unique id GUID is a unique key for any object in CRM In CRM

they are either 16 bit 22 bit or 32 bit of char and hexadecimal in nature 2 types of

GUIDs Header amp item For header there will be a unique GUID and for each item-line

there will be another unique GUID

GUIDs are created using the Function Module ldquoGUID_CREATErdquo in SAP CRM From the

lsquoExportrsquo parameters you will know that there are only three types of GUIDs

A small gift function modules to data exchange in 16 bit 32 bit and 22 bit exchange ndash ldquoGUID_CONVERTrdquo

One more use of GUID is persistence services and hiding the database accesses

Different business objects of different types may share the same key format and hence

may have the same business key although they are of different types and are stored in

different tables as the above reply shows But when we deal with them as ABAP Objects we need to uniquely identify one business object we can do that using GUID

When any object is to be transferred to other system itrsquos the GUID that is used as there are no replicas and easy to distinguish

Eg Consider a Company lsquoArsquo has 2 departments-Sales1 and Sales2 and in that there are

sub departments-products and finance Now each product and finance of both sales1 and

sales2 will have employees with same object_id So to avoid the dilemma crm creates a

GUID for each employee which differentiates each of them

CRM BOL

SAP CRM Webclient UI - Framework

Previous postNext post

Creating a Custom GenilBol object Model Posted by Sumeet Gehlot in SAP CRM Webclient UI - Framework on Aug 6 2012 111032 AM inShare

Defining and Creating a Genil Model

You could define and implement dynamic models

using IF_GENIL_APPL_MODEL Interface

use GENIL_MODEL_EDITOR OR GENIL_MODEL_BROWSER to create static models

As Genil component class extends default implementation

ofIF_GENIL_APPLMODEL_PERSISTENCY namely CL_WCF_GENIL_ABSTR_COMPONENT

Step 1 Go to Transaction SE24 or SE80 Create a new abap Custom Genil Class

ZCL_CUSTOMER_MODEL

As this class use statically defined model we inherit fromCL_WCF_GENIL_ABSTR_COMPONENT

Save and activate the class

Step 2 Registering of Genil component is done using Transaction SM34

Enter View Cluster name as CRMVC_GIL_APPDEF or we can use maintaince

viewCRMV_GIL_COMP

Click maintain button

Maintain the entries for Component Definition Component Set Definition and

Component Assignment

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 7: SAP CRM Functionalities Features

CRM_UT_ER_2 content Energy Retailer 2 - Business Functions for SAP Customer Relationship Management - SAP Library Next temporary technical objects need to be activate in the customizing SPRO -gt Customer Relationship Management -gt Industry-Specific Solutions -gt Utilities Industry -gt Technical Objects -gt Maintain Settings for Management of Temp Technical Objects Here you simply need to activate the check box qTO Management active In addition to the necessary customizing I also had to implement the following SAP Notes in order to enable the Data Import Tool

1951299 - Adding points of delivery to a premise using the DIT 1957672 - ICWC DIT - Field PD_GRID_ID is not saved in database

SEPA

Starting with SAP CRM EhP1 functionality for the handling of SEPA mandates is available in SAP CRM Sarah Ann Minge wrote a nice guide on how to configure the SEPA functionality in SAP CRM SEPA ConfigurationSet-Up Guide

CRM FIORI According to note1931218 - General Information Fiori for CRM you need EHP3 for CRM 70 (SP-stack 04 to use latest SP (SP02) for Fiori) You can also find some release information in the following note 1959305 - Release Information Note SAP Fiori transactional apps for SAP CRM 10 If you go to httpservicesapcomswdc choose Browse our Download Catalog you can choose SAP Fiori and then SAP Fiori for Suite in the main area of the browser the backend part is the one called FIORI CRM APPLICATIONS X2 the frontend part is called UI FOR SAP CRM ENHANCE PACKAGE

You can find the detailed information at the link below including minimum requirements for the CRM backend SAP Fiori Apps for SAP CRM - SAP Fiori Apps for Lower Back-End Releases - SAP Library

GUID means Global Unique Identifier You use a GUID when you need to identify an

objectcomponent with a unique id GUID is a unique key for any object in CRM In CRM

they are either 16 bit 22 bit or 32 bit of char and hexadecimal in nature 2 types of

GUIDs Header amp item For header there will be a unique GUID and for each item-line

there will be another unique GUID

GUIDs are created using the Function Module ldquoGUID_CREATErdquo in SAP CRM From the

lsquoExportrsquo parameters you will know that there are only three types of GUIDs

A small gift function modules to data exchange in 16 bit 32 bit and 22 bit exchange ndash ldquoGUID_CONVERTrdquo

One more use of GUID is persistence services and hiding the database accesses

Different business objects of different types may share the same key format and hence

may have the same business key although they are of different types and are stored in

different tables as the above reply shows But when we deal with them as ABAP Objects we need to uniquely identify one business object we can do that using GUID

When any object is to be transferred to other system itrsquos the GUID that is used as there are no replicas and easy to distinguish

Eg Consider a Company lsquoArsquo has 2 departments-Sales1 and Sales2 and in that there are

sub departments-products and finance Now each product and finance of both sales1 and

sales2 will have employees with same object_id So to avoid the dilemma crm creates a

GUID for each employee which differentiates each of them

CRM BOL

SAP CRM Webclient UI - Framework

Previous postNext post

Creating a Custom GenilBol object Model Posted by Sumeet Gehlot in SAP CRM Webclient UI - Framework on Aug 6 2012 111032 AM inShare

Defining and Creating a Genil Model

You could define and implement dynamic models

using IF_GENIL_APPL_MODEL Interface

use GENIL_MODEL_EDITOR OR GENIL_MODEL_BROWSER to create static models

As Genil component class extends default implementation

ofIF_GENIL_APPLMODEL_PERSISTENCY namely CL_WCF_GENIL_ABSTR_COMPONENT

Step 1 Go to Transaction SE24 or SE80 Create a new abap Custom Genil Class

ZCL_CUSTOMER_MODEL

As this class use statically defined model we inherit fromCL_WCF_GENIL_ABSTR_COMPONENT

Save and activate the class

Step 2 Registering of Genil component is done using Transaction SM34

Enter View Cluster name as CRMVC_GIL_APPDEF or we can use maintaince

viewCRMV_GIL_COMP

Click maintain button

Maintain the entries for Component Definition Component Set Definition and

Component Assignment

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 8: SAP CRM Functionalities Features

GUID means Global Unique Identifier You use a GUID when you need to identify an

objectcomponent with a unique id GUID is a unique key for any object in CRM In CRM

they are either 16 bit 22 bit or 32 bit of char and hexadecimal in nature 2 types of

GUIDs Header amp item For header there will be a unique GUID and for each item-line

there will be another unique GUID

GUIDs are created using the Function Module ldquoGUID_CREATErdquo in SAP CRM From the

lsquoExportrsquo parameters you will know that there are only three types of GUIDs

A small gift function modules to data exchange in 16 bit 32 bit and 22 bit exchange ndash ldquoGUID_CONVERTrdquo

One more use of GUID is persistence services and hiding the database accesses

Different business objects of different types may share the same key format and hence

may have the same business key although they are of different types and are stored in

different tables as the above reply shows But when we deal with them as ABAP Objects we need to uniquely identify one business object we can do that using GUID

When any object is to be transferred to other system itrsquos the GUID that is used as there are no replicas and easy to distinguish

Eg Consider a Company lsquoArsquo has 2 departments-Sales1 and Sales2 and in that there are

sub departments-products and finance Now each product and finance of both sales1 and

sales2 will have employees with same object_id So to avoid the dilemma crm creates a

GUID for each employee which differentiates each of them

CRM BOL

SAP CRM Webclient UI - Framework

Previous postNext post

Creating a Custom GenilBol object Model Posted by Sumeet Gehlot in SAP CRM Webclient UI - Framework on Aug 6 2012 111032 AM inShare

Defining and Creating a Genil Model

You could define and implement dynamic models

using IF_GENIL_APPL_MODEL Interface

use GENIL_MODEL_EDITOR OR GENIL_MODEL_BROWSER to create static models

As Genil component class extends default implementation

ofIF_GENIL_APPLMODEL_PERSISTENCY namely CL_WCF_GENIL_ABSTR_COMPONENT

Step 1 Go to Transaction SE24 or SE80 Create a new abap Custom Genil Class

ZCL_CUSTOMER_MODEL

As this class use statically defined model we inherit fromCL_WCF_GENIL_ABSTR_COMPONENT

Save and activate the class

Step 2 Registering of Genil component is done using Transaction SM34

Enter View Cluster name as CRMVC_GIL_APPDEF or we can use maintaince

viewCRMV_GIL_COMP

Click maintain button

Maintain the entries for Component Definition Component Set Definition and

Component Assignment

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 9: SAP CRM Functionalities Features

Save and activate the class

Step 2 Registering of Genil component is done using Transaction SM34

Enter View Cluster name as CRMVC_GIL_APPDEF or we can use maintaince

viewCRMV_GIL_COMP

Click maintain button

Maintain the entries for Component Definition Component Set Definition and

Component Assignment

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 10: SAP CRM Functionalities Features

Step 3 Create a new Master Table name as ZMAST_CUST using transaction SE11

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 11: SAP CRM Functionalities Features

Creating a Genil Business Objects

Key Structure of Customer Data

Attribute structure of a Customer Data

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 12: SAP CRM Functionalities Features

Table Type of Attribute Structure

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 13: SAP CRM Functionalities Features

Create a Lock object of master table ZMAST_CUST

Step 4 Go to Transaction GENIL_MODEL_BROWSER

Give component name as ZCUST

a a) Click on Change button and Right Click on Root Objects -gt Give Object Name asCustomer

Add Key Structure Name Attribute structure name and Create structure name

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 14: SAP CRM Functionalities Features

And check web service enabled

Keep Attribute Structure Property -in Changeable mode So that while creating a object

you can see a list of fields in Change mode in Object Browser

Step 5 Open a custom genil class ZCL_CUSTOMER_MODEL and redefine all this

metohods as shown below

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 15: SAP CRM Functionalities Features

Create a new custom class name as ZCL_CUSTOMER_API which will to hold the API

methods to retrieve data from database

Declare GT_CUSTOMER as a global attributes ZATTR_CUST_TAB ( Attribute Structure of Customer ) of ZCL_CUSTOMER_API

Heres the coding Starts to create a new root object

IF_GENIL_APPL_INTLAY~CREATE_OBJECTS

METHOD if_genil_appl_intlay~create_objects

TYPES BEGIN OF ty_cust

custno TYPE zcustno END OF ty_cust

DATA lv_guid TYPE crmt_object_guid

DATA lv_key TYPE zattr_cust_key

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 16: SAP CRM Functionalities Features

DATA lv_success TYPE char1

DATA lit_cust TYPE TABLE OF ty_cust

DATA wa TYPE ty_cust

DATA lv_count TYPE i VALUE 0

Fill structure based on Name Value Pairs Table

fill_struct_from_nvp_tab( EXPORTING it_parameters = it_parameters

CHANGING cs_parameter = lv_key )

Creating a Guid

CALL FUNCTION GUID_CREATE IMPORTING

ev_guid_16 = lv_guid

Custom Logic to create a New Customer Number

SELECT custno FROM zmast_cust INTO TABLE lit_cust

SORT lit_cust DESCENDING

IF lit_cust IS NOT INITIAL LOOP AT lit_cust INTO wa

lv_count = wa-custno + 1

EXIT ENDLOOP

ELSE lv_count = 1

ENDIF

lv_key-guid = lv_guid lv_key-custno = lv_count

API Class fills the the global attribute

CALL METHOD zcl_customer_api=gtcreate_customer

EXPORTING

is_cust_key = lv_key IMPORTING

rv_success = lv_success

Add the object to Data Container - Root Object List Interface

IF lv_success IS NOT INITIAL

iv_root_list-gtadd_object( iv_object_name = iv_object_name

is_object_key = lv_key ) ENDIF

ENDMETHOD

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 17: SAP CRM Functionalities Features

METHOD CREATE_CUSTOMER

DATA lv_data like line OF gt_customer

First step is to Lock a Customer

CALL FUNCTION ENQUEUE_EZMAST_CUST

EXPORTING mode_zmast_cust = E

EXCEPTIONS foreign_lock = 1

system_failure = 2

OTHERS = 3 IF sy-subrc ltgt 0 Implement suitable error handling here ENDIF

Writing to Buffer values passed by parameters and setting Flag C

lv_data-guid = is_cust_key-guid

lv_data-custno = is_cust_key-custno

lv_data-new = C

append lv_data to gt_customer

rv_success = X

ENDMETHOD

IF_GENIL_APPL_INTLAY~GET_OBJECTS

METHOD if_genil_appl_intlay~get_objects

DATA lv_root TYPE REF TO if_genil_cont_root_object

DATA lv_key TYPE zattr_cust_key

DATA lv_cust_att TYPE zattr_cust

Get the first object of data container

lv_root = iv_root_list-gtget_first( )

lv_root-gtget_key( IMPORTING es_key = lv_key )

Check if attributes are read after Create

IF lv_root-gtcheck_attr_requested( ) = abap_true

Custom API class to get the customer attributes

zcl_customer_api=gtget_customer( EXPORTING is_cust_key = lv_key IMPORTING es_cust_attr = lv_cust_att )

Return the objects only if it exists

IF lv_cust_att IS NOT INITIAL

Set the attributes in container

lv_root-gtset_attributes( lv_cust_att )

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 18: SAP CRM Functionalities Features

Get the next object of data container

lv_root = iv_root_list-gtget_next( )

ENDIF

ENDIF

ENDMETHOD

METHOD get_customer

FIELD-SYMBOLS ltdatagt LIKE LINE OF gt_customer

IF is_cust_key IS NOT INITIAL

Try to read from Buffer

READ TABLE gt_customer WITH KEY guid = is_cust_key-guid

custno = is_cust_key-custno

ASSIGNING ltdatagt ELSE

READ TABLE gt_customer WITH KEY new = C ASSIGNING ltdatagt

IF sy-subrc ltgt 0 RETURN

ENDIF

ENDIF

IF sy-subrc = 0

IF ltdatagt-new EQ C OR ltdatagt-new EQ M

MOVE-CORRESPONDING ltdatagt TO es_cust_attr RETURN

ENDIF ENDIF

ENDMETHOD

IF_GENIL_APPL_INTLAY~MODIFY_OBJECTS

METHOD if_genil_appl_intlay~modify_objects

DATA lv_cust_attr TYPE zattr_cust

lv_root TYPE REF TO if_genil_container_object lv_changed_objects TYPE crmt_genil_obj_instance

lv_props TYPE REF TO if_genil_obj_attr_properties

lt_changed_attr TYPE crmt_attr_name_tab lv_cust_key TYPE zattr_cust_key

lv_success TYPE abap_bool

DATA lv_change TYPE crmt_genil_attr_property

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 19: SAP CRM Functionalities Features

CHECK iv_root_list IS BOUND

Get the first object from Container

lv_root = iv_root_list-gtget_first( )

IF lv_root-gtget_delta_flag( ) IS NOT INITIAL

Get name of the object

CASE lv_root-gtget_name( )

WHEN Customer

Returns an Property Object for Object Attributes

lv_props = lv_root-gtget_attr_props_obj( )

Returns a Table of All Names with Specified Property

CALL METHOD lv_props-gtget_name_tab_4_property

EXPORTING iv_property = if_genil_obj_attr_properties=gtmodified

IMPORTING

et_names = lt_changed_attr

lv_root-gtget_key( IMPORTING es_key = lv_cust_key ) lv_root-gtget_attributes( IMPORTING es_attributes = lv_cust_attr )

MOVE-CORRESPONDING lv_cust_key TO lv_cust_attr

CALL METHOD zcl_customer_api=gtchange_customer

EXPORTING is_cust_attr = lv_cust_attr

it_names = lt_changed_attr IMPORTING

rv_success = lv_success

IF lv_success IS NOT INITIAL

lv_changed_objects-object_name = Customer lv_changed_objects-

object_id = cl_crm_genil_container_tools=gtbuild_object_id( lv_cust_key )

Add into Object Table with Object Type and ID

APPEND lv_changed_objects TO et_changed_objects

ENDIF

WHEN OTHERS ENDCASE

ENDIF

ENDMETHOD

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 20: SAP CRM Functionalities Features

METHOD change_customer

FIELD-SYMBOLS ltlinegt TYPE zattr_cust

ltoldgt TYPE simple ltnewgt TYPE simple

ltnamegt TYPE name_komp

READ TABLE gt_customer WITH KEY

guid = is_cust_attr-guid

custno = is_cust_attr-custno ASSIGNING ltlinegt

CHECK sy-subrc IS INITIAL

LOOP AT it_names ASSIGNING ltnamegt

ASSIGN COMPONENT ltnamegt OF STRUCTURE ltlinegt TO ltoldgt

CHECK sy-subrc = 0 ASSIGN COMPONENT ltnamegt OF STRUCTURE is_cust_attr TO ltnewgt

CHECK sy-subrc = 0

ltoldgt = ltnewgt ENDLOOP

ltlinegt-new = M

rv_success =X

ENDMETHOD

IF_GENIL_APPL_ALTERNATIVE_DSIL~SAVE_OBJECTS

METHOD if_genil_appl_alternative_dsil~save_objects

DATA lv_cust_key TYPE zattr_cust_key

FIELD-SYMBOLS ltobjectgt TYPE crmt_genil_obj_inst_line

LOOP AT ct_object_list ASSIGNING ltobjectgt

Check for Object Instance

CASE ltobjectgt-object_name WHEN Customer

TRY CALL METHOD cl_crm_genil_container_tools=gtget_key_from_object_id(

EXPORTING

iv_object_name = ltobjectgt-object_name iv_object_id = ltobjectgt-object_id

IMPORTING

es_key = lv_cust_key )

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 21: SAP CRM Functionalities Features

CATCH cx_crm_genil_general_error

ENDTRY

Custom API to Save the customer data

CALL METHOD zcl_customer_api=gtsave_customer

CHANGING

cs_key = lv_cust_key IF lv_cust_key IS INITIAL

ltobjectgt-success = abap_true

ENDIF ENDCASE

ENDLOOP

ENDMETHOD

Define CS_KEY TYPE ZATTR_CUST_KEY as parameter of Save Customer

METHOD SAVE_CUSTOMER

DATA wa_cust TYPE zmast_cust

DATA lv_success TYPE abap_bool

FIELD-SYMBOLS ltcustomer_attr_ngt LIKE LINE OF gt_customer

lv_success = X

READ TABLE gt_customer ASSIGNING ltcustomer_attr_ngt WITH

KEY guid = cs_key-guid

custno = cs_key-custno

CHECK sy-subrc = 0

CASE ltcustomer_attr_ngt-new

WHEN C OR M MOVE-CORRESPONDING ltcustomer_attr_ngt TO wa_cust

MODIFY zmast_cust FROM wa_cust

WHEN OTHERS

ENDCASE

CALL FUNCTION DEQUEUE_EZMAST_CUST

EXPORTING

mode_zmast_cust = E guid = cs_key-guid

custno = cs_key-custno

CLEAR cs_key

ENDMETHOD SAVECUSTOMER

Coding Part is Done to create genil implementation class

STEP 6 go to transaction genil_bol_browser -gt Click on Create a New Root Object

Select the root object as Customer double click it

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 22: SAP CRM Functionalities Features

Enter the parameters value Custno -

you can add you own custom logic to default set the value of the attributes

Click on Create Object

Here Guid and Custno is in display mode while remaining attributes are in changeable

mode - Enter the values of the Attributes

Click on Save Button

and Check the database table ZMAST_CUST

Page 23: SAP CRM Functionalities Features

and Check the database table ZMAST_CUST