Showing posts with label SAP CRM. Show all posts
Showing posts with label SAP CRM. Show all posts

Thursday, 2 November 2017

Free Goods Determination in SAP CRM

This document will cover steps for creating free goods determination procedure and conditions in SAP ERP and downloading the same in SAP CRM. The Sales order would be created in SAP CRM and the free goods would be determined for the same.

SAP ERP:


1. Maintain Free Goods Condition Table:

SPRO – SD – Basic Functions – Free Goods – Condition Technique for Free Goods – Maintain Condition Tables

Select the fields combining which you want the free goods conditions to be created. For eg. you can check the standard condition table, 010, wherein  the fields Sales Org, Distribution Channel, Customer and Material is used for creating free goods conditions.

2. Maintain the Access Sequence:

SPRO – SD – Basic Functions – Free Goods – Condition Technique for Free Goods – Maintain Access Sequence

Select the condition tables created above and maintain them in the desired sequence in the access sequence.

SAP CRM, SAP All Modules, SAP Guides, SAP Module, SAP Live, SAP Learning

3. Maintain the Condition Type

SPRO – SD – Basic Functions – Free Goods – Condition Technique for Free Goods – Maintain Condition Types

Create a Condition Type and assign the Access Sequence created above to it.

4. Maintain Free Goods Procedure

SPRO – SD – Basic Functions – Free Goods – Condition Technique for Free Goods – Maintain Pricing Procedure

Create a Procedure and maintain the Condition Types created above in desired sequence.

SAP CRM, SAP All Modules, SAP Guides, SAP Module, SAP Live, SAP Learning

5. Activate Free Goods Determination:

SPRO – SD – Basic Functions – Free Goods – Condition Technique for Free Goods – Activate Free Goods Determination

Maintain the Free Goods Determination Procedure created above against the combination of Sales Area/Doc. PP and Cust. PP.

6. Create Free Goods Record

Go to Transaction VBN1. Create a free goods record. The below screenshot shows a record which would give inclusive free goods. Suppose a customer purchases 2 quantities, then 1 quantity would be considered as free. The Customer would be charged for only one quantity.

SAP CRM, SAP All Modules, SAP Guides, SAP Module, SAP Live, SAP Learning

This will be stored in table, KOTN<condition table>. In our case, condition table was 010, hence the table will be KOTN010.

SAP CRM:


1. Download the condition record by using adaptor object: DNL_COND_N010. If you are using custom condition tables then create a new adaptor object same as this and maintain the custom table in it.

2. Download access sequence, condition tables and condition types by using: DNL_CUST_CND_FG.

The condition records when downloaded from ERP will appear in CRM in table, /1CN/CCF<condition table>. In our case the table is SAP010 as it is standard table which was used, hence the table will be /1CN/CCFSAP010. The records once downloaded can be seen in it.

Create Sales Order in CRM WebUI for the same combination of Customer/Sales Area and Material:

A Sub-item gets created automatically as soon as it meets the criteria of free goods determination. In the below case, actually 2 quantities were entered, the system detects the free goods determination and creates a sub-item of quantity 1 as free item. The customer is charged for only one quantity. This is inclusive free goods scenario. In Exclusive, the customer would have got an additional quantity as set by the conditions. 

SAP CRM, SAP All Modules, SAP Guides, SAP Module, SAP Live, SAP Learning

Monday, 30 October 2017

Funds Plan and Funds in SAP CRM Funds Management

In this document we will touch upon Funds Management objects like Funds Plan, Funds, Budget Posting etc. We will get into the configuration behind these objects and also focus on transaction level details and utility for each one of them.

Funds Management is an application in SAP CRM which assists manufacturers or owners of brands to administer and distribute the funds amongst its distributors or channel partners in order to engage in co-marketing activities. The channel partners consume these funds (money) in order to deliver on agreed goal for improving the presence of manufacturers products in the market and via Funds Management we can monitor the disbursement and usage of these funds.

SAP CRM Funds Management can be integrated to with the below applications within SAP CRM in order of the owner of a brand or manufacturer to achieve co-marketing or co-branding objectives:

1. Market Development Funds (MDF)
2. Trade Promotion Management (TPM)
3. Marketing Funds Management (MFM)
4. Claims Management

Funds Plan


Funds Plan is an high-level object in Funds Management which will act as an umbrella for associated funds under it. Funds Plan do not carry any money, however it is possible to assign Funds under it which eventually will be loaded with budget (money). It is to be noted that currency is always maintained as a default with the Funds plan, this is done to ensure that underlying Funds within a Funds Plan always  reflect common currency.

‘Funds Plan Type’ is associated with Funds Plan which defines the nature of the Funds Plan i.e. whether the Funds Plan is meant for MDF, TPM etc. and also there is a timeframe of budget expiry which is maintained at funds plan level. These expiry periods can be fixed, relative or none.

To configure Funds Plan please use the path ” IMG >> Customer Relationship Management >> Funds Management >> Funds Plan and Funds >> Define Funds Plan Types “

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial, Material and Certification

Funds


Funds are objects which contain the monies. The money i.e. Budget in the fund is provided to the channel partner by brand owner to execute the co-marketing or channel marketing activities in order to achieve an agreed outcome.

‘Fund Type’ outlines the specific objective behind creating a Fund. It captures the category which the Fund belongs to i.e. Fixed or Variable Fund. It also assists in setting up an association of the Fund with the way it is going to be spent i.e. promotional activities in paper, electronic media, social media, events, trade fairs etc. The nature of the spent is captured as an ‘Expense Type’ in the system.

‘Fund Attributes’ are very critical in ensure the downstream marketing objects like Marketing Program, Initiatives, Claims etc. can determine which Fund to be used at the execution layer of a co-marketing activity. Fund Determination is a procedure via which criteria’s are defined in order to identify one specific Fund which will be assigned to execute activities like Trade Promotions, Claims, Budget Postings etc. are performed.

Fund Checkbooks provide latest view of the money at different levels of a co-marketing spend process which includes budgeted, reserved, approved claims, settled etc.

To configure Funds please use the path ” IMG >> Customer Relationship Management >> Funds Management >> Funds Plan and Funds >> Define Funds Type“

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial, Material and Certification

As discussed we will need to assigned Expense Types to the Fund Type for the Fund to be utilized for a specific spend. Before that we will need to define expense types first.

Go to transaction path ” IMG >> Customer Relationship Management >> Funds Management >> Funds Plan and Funds >> Define Expense Type “

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial, Material and Certification

Once expense types are define we will assign Expense Type to Fund type in order to create the link. Go to transaction path ” IMG >> Customer Relationship Management >> Funds Management >> Funds Plan and Funds >> Assign Expense Types to Funds Types “

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial, Material and Certification

Once these configurations are done in the background, log in to CRM WebUI and make use of Business Role ‘CHM-CM – Channel Manager‘. Once the screen loads make use of left-hand side navigation pane and choose ‘Market Dev. Funds’ to create objects like Funds and Funds Plan.

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial, Material and Certification

Once we proceed from here, we create Funds Plan and after creating it we mark it as ‘Released’.

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial, Material and Certification

We proceed further to create a Fund, then add budget to the same. The budget to the fund is added via Budget Posting. Once the Fund is created and released we create a Budget Posting. Budget Posting is an object which is used to upload the money to a Fund. Below you will see a Fund with Budget loaded to it for usage.

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial, Material and Certification
SAP CRM, SAP Guides, SAP Learning, SAP Tutorial, Material and Certification

With this we come to an end to this document. Once these Funds Plan and Funds are created and required Budget is allocated via Budget Posting, the scenario can be extended by Integrating Funds Management in CRM with MDF or TPM or MFM. One such integration between CRM FM and MDF will be discussed in the next document.

Tuesday, 17 October 2017

Creating New Date Rules in SAP CRM

This blog explains the process for creating new date rules in SAP CRM.

To create a new date rule, you need to perform a series of configuration and development steps:

1. Open the Date Rule customizing screen by going into the IMG and following the menu path: Customer Relationship Management > Basic Functions > Date Management > Define Date Types, Duration Types and Date Rules.

2. In the dialog structure that appears, select Date Rules, and then click the New Entries button. The screen shown below appears.

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial and Material, SAP CRM Guides, SAP All Modules List

3. Enter a technical name for the rule such as “ZBOOKEX1”, and then enter a description such as “Book Example”.

4. Click Save, and you are prompted for a customizing request. If you don’t have an existing customizing request, you’ll create a new one; otherwise, you’ll select one for your work.

5. Go back to the overview screen of all existing date rules as shown below, select the date rule that you created, and then click the Details icon.

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial and Material, SAP CRM Guides, SAP All Modules List

6. An overview screen appears showing all of the versions of the underlying XML that makes up the date rule as shown in the figure below. Double-click on the only row, and then you’re ready to start editing the XML of the date rule. There isn’t much documentation on this format, but to invoke an ABAP function module for date rules, you can enter a certain pattern as shown in the second figure and code below.

7. When you first open the editor, it will be in display mode. Click the Change button to insert the necessary XML code.

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial and Material, SAP CRM Guides, SAP All Modules List

The Editor for Date Rules screen expects a certain pattern of XML to be entered that specifies the date rule as shown in the following code. The pattern has been derived by examining the delivered date rule in the system called “Planned Date (Activities)” with a technical key of “000000000002”.

<?xml version="1.0"?>

<SAPTimeRule>

  <ABAPTimeRule function="Z_CRM_DATE_CALC"/>

</SAPTimeRule>

SAP CRM, SAP Guides, SAP Learning, SAP Tutorial and Material, SAP CRM Guides, SAP All Modules List

8. After you’ve created the XML for the date rule that calls the ABAP function module you’ll create in the next step, save your work.

9. Before you can use this date rule in a date profile, you now must code the ABAP logic that will evaluate the date passed and return a result. Create a function module that has two importing parameters:

◉ _ CONTEXT: A type reference to IF_TIMECONTEXT.
◉ _ TIMEMESSAGE: A type reference to CL_TIMEMESSAGE.

Your function module also must return a reference value named ERROR that is of type XFLAG.

The context reference provides you access to the date data being manipulated in your function module. The interface allows you to retrieve the list of time events and then add back a special time event called the result, which is the result of your calculation and will populate the date type that will use this rule.

1 Function Module Logic: Date Context

To better understand this logic, let’s take a look at the following function module that calculates your date. The first call will be to get the event set from the context as shown in the code fragment:

li_eventset = context->get_eventset( ).

This is always needed to provide the result back and calculate any dates you may encounter.

Next you’ll get the GUID of the current transaction you’re processing so you can access any data needed for the calculation via the one order API. You’ll use the function module CRM_CONTEXT_GET_ACTUALGUID_OW to get this GUID.

After you have the GUID, you retrieve any other data from the business transaction using the one order OW function modules by passing in the header GUID. As you might have noticed, your function module doesn’t provide any data about the business transaction you’re working with directly.

If your calculation is based on another date, you first need to retrieve the value of that date by retrieving it from the event set. The following code fragment can be used to achieve this in your date rule function module:

li_tns_zfirstcont ?= li_eventset->get_by_name( lv_name ).

if li_tns_zfirstcont is initial.

  exit.

endif.

Note that you won’t want to process the date rule if the date you need to calculate hasn’t been entered or already calculated. Thus, you’ll exit the function module to prevent any short dumps with improper date calls.

One big difference of working with a date context as compared to standard ABAP time and date types is that you can’t perform simple add or subtract functions on the dates themselves. You instead need to create a duration that corresponds to how much you want to increment or decrement the date and then apply the duration to the date itself. To do this, create a new duration object using the class CL_TIMEDURA. You can then calculate the new date by using the static method CL_TIMECALC.

Tuesday, 3 October 2017

CRM status management important table

I record down my self study notes here in order to be used in the future.

TJ01: Business Transactions definition

TJ02: System status definition. For some of entries in this table, the corresponding constants are defined in include CRM_STATUS_CON

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access
SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

TJ03: status object type definition. Storage table for tcode BS12, see screenshot below:

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

TJ04: define initial status for system object. For example, I1002 ( open ) is defined as initial status for status object COH ( CRM Order Header ). Due to this setting, every time you create an order, it always has open as initial status.

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

TJ05: Permitted transactions per object type

For example, status object COH has totally 369 permitted business transactions. The system status bound with a unpermitted business transaction will not appear in status drop down list in WebUI.

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

TJ06: System statuses set/deleted by process

For example, the following report checks whether a given user status is actually mapped to Completed system status I1005 or not.

REPORT order_is_status_completed.
PARAMETERS: t_type   TYPE crmd_orderadm_h-process_type OBLIGATORY DEFAULT 'OPPT',
            i_status TYPE crm_j_status OBLIGATORY DEFAULT 'I1001'.
DATA lt_sys_stat          TYPE TABLE OF tj06.
DATA lv_status_profile      TYPE j_stsma.

SELECT SINGLE user_stat_proc FROM crmc_proc_type INTO lv_status_profile
  WHERE process_type = t_type.
CALL FUNCTION 'CRM_WAP_GET_OPP_POSSIBLE_STAT'
  EXPORTING
    iv_stat           = i_status
    iv_user_stat_proc = lv_status_profile
  TABLES
    et_06             = lt_sys_stat.
READ TABLE  lt_sys_stat WITH KEY istat = 'I1005' inact = abap_false TRANSPORTING NO FIELDS. "check system status is complete
IF sy-subrc = 0.
  WRITE:/ 'This status is Completed Status'.
ELSE.
  WRITE:/ 'This status is NOT Completed Status'.
ENDIF.

Can you tell the answer that for status profile CRMOPPOR below, which user status is actually mapped to system status I1005?

The answer is COMP ( Completed – Jerry ), since it is assigned with business transaction CCOR,

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

And there is one entry for CCOR and I1005 in this TJ06 table.

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

TJ07: Influence of system status on transactions

For example, this entry below means it is not allowed to perform transaction ARCH ( Archive ) if order has status I1002 – Open.

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

This table is part of storage table for tcode BS22 – maintain system status

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

TJ21: Permitted object types for status profile
For example, status profile is only allowed for status object type COH.

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

TJ30: storage table for tcode BS02 – Maintain status profiles
Compare the content of this table with tcode BS02:

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

CRM_JSTO: assignment of object with its status object type

If you would like to get a statistics for example which combination of status object and status profile has been used most of the time in your system.

For example, the screenshot belows show in my system there are totally 69436 objects which has used object type MPL and empty status profile for status management.

SAP CRM, SAP Certifications, SAP Learning, SAP Tutorial, Material and Certification, SAP Live Access

CRM_JEST: object guid and all of its status value

Thursday, 27 July 2017

Creating New Date Rules in SAP CRM

This blog explains the process for creating new date rules in SAP CRM.

To create a new date rule, you need to perform a series of configuration and development steps:

1. Open the Date Rule customizing screen by going into the IMG and following the menu path: Customer Relationship Management > Basic Functions > Date Management > Define Date Types, Duration Types and Date Rules.

2. In the dialog structure that appears, select Date Rules, and then click the New Entries button. The screen shown below appears.

SAP Customer Relationship Management, SAP CRM, SAP All Modules, SAP Modules

Enter a technical name for the rule such as “ZBOOKEX1”, and then enter a description such as “Book Example”.

4. Click Save, and you are prompted for a customizing request. If you don’t have an existing customizing request, you’ll create a new one; otherwise, you’ll select one for your work.

5. Go back to the overview screen of all existing date rules as shown below, select the date rule that you created, and then click the Details icon.

SAP Customer Relationship Management, SAP CRM, SAP All Modules, SAP Modules, SAP Tutorials and Materials

6. An overview screen appears showing all of the versions of the underlying XML that makes up the date rule as shown in the figure below. Double-click on the only row, and then you’re ready to start editing the XML of the date rule. There isn’t much documentation on this format, but to invoke an ABAP function module for date rules, you can enter a certain pattern as shown in the second figure and code below.

7. When you first open the editor, it will be in display mode. Click the Change button to insert the necessary XML code.

SAP Customer Relationship Management, SAP CRM, SAP All Modules, SAP Modules, SAP Tutorials and Materials

The Editor for Date Rules screen expects a certain pattern of XML to be entered that specifies the date rule as shown in the following code. The pattern has been derived by examining the delivered date rule in the system called “Planned Date (Activities)” with a technical key of “000000000002”.

<?xml version="1.0"?>

<SAPTimeRule>

  <ABAPTimeRule function="Z_CRM_DATE_CALC"/>

</SAPTimeRule>

SAP Customer Relationship Management, SAP CRM, SAP All Modules, SAP Modules, SAP Tutorials and Materials

8. After you’ve created the XML for the date rule that calls the ABAP function module you’ll create in the next step, save your work.

9. Before you can use this date rule in a date profile, you now must code the ABAP logic that will evaluate the date passed and return a result. Create a function module that has two importing parameters:
  • _ CONTEXT: A type reference to IF_TIMECONTEXT.
  • _ TIMEMESSAGE: A type reference to CL_TIMEMESSAGE.
Your function module also must return a reference value named ERROR that is of type XFLAG.

The context reference provides you access to the date data being manipulated in your function module. The interface allows you to retrieve the list of time events and then add back a special time event called the result, which is the result of your calculation and will populate the date type that will use this rule.

1 Function Module Logic: Date Context

To better understand this logic, let’s take a look at the following function module that calculates your date. The first call will be to get the event set from the context as shown in the code fragment:

li_eventset = context->get_eventset( ).

This is always needed to provide the result back and calculate any dates you may encounter.

Next you’ll get the GUID of the current transaction you’re processing so you can access any data needed for the calculation via the one order API. You’ll use the function module CRM_CONTEXT_GET_ACTUALGUID_OW to get this GUID.

After you have the GUID, you retrieve any other data from the business transaction using the one order OW function modules by passing in the header GUID. As you might have noticed, your function module doesn’t provide any data about the business transaction you’re working with directly.

If your calculation is based on another date, you first need to retrieve the value of that date by retrieving it from the event set. The following code fragment can be used to achieve this in your date rule function module:

li_tns_zfirstcont ?= li_eventset->get_by_name( lv_name ).

if li_tns_zfirstcont is initial.

  exit.

endif.

Note that you won’t want to process the date rule if the date you need to calculate hasn’t been entered or already calculated. Thus, you’ll exit the function module to prevent any short dumps with improper date calls.

One big difference of working with a date context as compared to standard ABAP time and date types is that you can’t perform simple add or subtract functions on the dates themselves. You instead need to create a duration that corresponds to how much you want to increment or decrement the date and then apply the duration to the date itself. To do this, create a new duration object using the class CL_TIMEDURA. You can then calculate the new date by using the static method CL_TIMECALC.