Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
TRM_UA
Associate
Associate
0 Kudos

Let’s say you’re a treasury trader using SAP Treasury and Risk Management in SAP S/4HANA Cloud or SAP S/4HANA. 

You have invested in money market funds on an external trading platform. It's been a good quarter, and your funds are paying dividends. Instead of reinvesting, you want to post the cash dividend into your general ledger.  

This post presents three ways to do this. Two are standard options for all customers with SAP Treasury and Risk Management. The third option requires some custom development and an additional subscription for the SAP Trading Platform Integration. 

Note: Options 1 and 2 are recommended, even if you’re using the SAP Trading Platform Integration. Option 3 requires custom development using BAdIs and mapping settings, so the results depend on your configuration.

Version Overview 

 

SAP S/4HANA lower than 1809 

SAP S/4HANA 1809 or higher  

S/4HANA Public Cloud 

Option 1  - Manual Posting

X 

X 

X 

Option 2 - Calculate Own Dividends

- 

X 

X 

Option 3 - SAP Trading Platform Integration

- 

X 

Only if no BAdI needed (no custom transaction types for cash dividends) 

 Option 1: Manually Post Cash Dividends 

You receive a notification from the trading platform or business partner that lists the dividend payout from your money market fund. You rely on the external calculation and post the provided values, instead of calculating your own dividends. 

Now all you need to do is manually post the dividend flows using the Create Manual Posting (FWBS) app. Depending on the SAP S/4HANA product you’re using, see the documentation here:  

TRM_UA_0-1709631672312.png

Option 2: Calculate Your Own Cash Dividends 

This process involves three steps:  

  1. Maintain or import the dividend factor using one of these options:
    1. Use the Import Market Data (F2610) app to automatically import the factor for calculation of dividends. 
    2. Use the Enter Factor Values (TMDFACTORVAL) app to enter the factor manually. 
  2. Use the Update Planned Records for Securities (FWUP) app to calculate the cash dividend based on the factor value.  
  3. Post the cash dividend into your securities account using the Automatic Debit Position and Posting - Security Accounts (FWSO) or Execute Debit Position - Manual Debit Position (FWZE) apps. 

 Option 3: Use the SAP Trading Platform Integration and Custom BAdI Implementations 

This option is only available to customers using the SAP Trading Platform Integration to connect to external trading platforms and SAP S/4HANA version 1809 or higher.  

Note: SAP S/4HANA Cloud does not support BAdIs. Since a BAdI is needed to change the transaction type, you can only use cash dividends in SAP S/4HANA Cloud, if your back-end system and the SAP Trading Platform Integration use the same transaction types for dividend reinvestments and cash dividends. Otherwise, you will not be able to map the transaction type in SAP S/4HANA Cloud. The following steps describe how to configure the mapping.

This is a custom solution which uses financial transactions (purchase/sale) to process cash dividends. Please check carefully whether this treatment works with your particular accounting process before implementing this option and make sure that your posting rules allow correct processing of the relevant transaction types.

The configuration for this option consists of two steps: 

  1. Map some fields under Configure Mappings – Trading Platform Format and Configure Mappings – Back-End Format in the SAP Trading Platform Integration. 
  2. If you are using separate transaction types for cash dividends: Create a custom BAdI implementation to correctly process the trades in your back-end system. The BAdI you need depends on your back-end configuration version. 

In the following figure, you see a general overview of this process. In this example, the custom value to identify cash dividends is DIVCASHPAY. The transaction types for dividend reinvestment are 500 (purchase / dividend reinvestment) and 600 (sale / dividend reinvestment reversal) and the transaction types for cash dividends in the back-end system are 700 (purchase) and 800 (sale). 

TRM_UA_1-1709631672318.png

 

Step 1: Mapping Configuration in the SAP Trading Platform Integration 

Let’s assume we have the transaction types 500 (purchase) and 600 (sale) for dividend reinvestments in the SAP Trading Platform Integration.  

Your back-end system, however, uses 700 (purchase) and 800 (sale) for cash dividends. So your goal is to separate cash dividends from dividend reinvestments. 

For this, you need to assign the correct transaction type in your back-end system, so the cash dividend payout can be posted properly to your general ledger without increasing any positions in the balance sheet.  

To identify cash dividends, the trading platform adds a custom value in a custom field, such as Payment_Type = DIVCASHPAY to the relevant trades. 

In the SAP Trading Platform Integration, you can see the field by choosing Display Trading Platform Details in the detail view of the trade. In this example, the source field name is Payment_Type. The name and value could be different in your case, however. 

First you need to map this value under Configure Mappings: Trading Platform Format. Choose a custom target field, for example, ACCOUNT_ASSIGNMENT and configure it to copy the value from the inbound field Payment_Type. 

Here are two excerpts in JSON format for the same transaction, as shown in the Display Trading Platform Details and Display Back-End Details windows:

Trading Platform Format

 

[...]
    "trade": {
      [...]
            "secMmf": {
                "transactionType": "PURCHASE",
                [...]
                    }
                },
                [...]
                "activityCategory": "DIV_REINVESTED",
                "customFields": [{
                    "id": "Payment_Type",
                    "value": "DIVCASHPAY"
                }],
[...]
}

 

Back-End Format

 

[...]
        },
        "additionalInfo": {
            "instrumentCategory": "MMF",
      [...]
        },
        "generalContractData": {
            [...]
            "assignment": "DIVCASHPAY",
       [...]
            "transactionType": "500",
[...]

 

Below you can see how to map the trading platform field Payment Type - simply copy the value to a custom field, such as Account Assignment under Configure Mappings – Trading Platform Format. 

TRM_UA_2-1709631672323.png

If mapped correctly, the value DIVCASHPAY should appear in the Assignment field in the trade detail view. Note that the activity category is Dividend Reinvestment, since there is no dedicated activity type for cash dividends. 

TRM_UA_3-1709632153244.png

Below is an example in the Manage Trades tile. It shows two trades with Activity Category: Dividend Reinvestment that have the value DIVCASHPAY. This tells the system that they should be treated as cash dividends: 

TRM_UA_4-1709632153246.png

Under Configure Mappings – Back-End Format > TRANSACTION_TYPE, you can also see that there is no default transaction type for cash dividends in the SAP Trading Platform Integration, only for dividend reinvestments (SEC_MMF_DIV_REINVESTED_PURCHASE and SEC_MMF_DIV_REINVESTED_SALE for the reversal). This value is then mapped to the transaction type used in your back-end system, in this case 500 and 600. 

TRM_UA_5-1709632153246.png

Remember, your back-end system also has a dedicated transaction type pair – 700 and 800 – for cash dividends. So next you need to implement a BAdI to change the transaction type if a trade has the value DIVCASHPAY. This way, you can leave regular dividend reinvestments unchanged. If your back-end system has no custom transaction types for cash dividends, you can skip Step 2. In this case, you can also process cash dividends with SAP S/4HANA Cloud. 

 Step 2: Create Custom BAdI Implementations 

If your back-end system uses a separate transaction type for cash dividends, you must create a custom BAdI implementation. Depending on your back-end configuration (V. 1.0 or V. 2.0 / 2.1), you need different BAdIs.  

 For more information on back-end configurations, see here. For details on how to create a BAdI implementation, refer to this article.

Back-End Configuration V. 1.0 - Integration via RFCs 

Back-End Configuration V. 2.0 and 2.1 - Integration via Web Services 

Create a custom implementation of the BAdI FTR_TPI_GENERAL_MAPPING, which you can find in the IMG under Treasury and Risk Management -> Transaction Manager -> General Settings -> Transaction Management -> External Link -> Connect to Trading Platform via SAP Trading Platform Integration -> Integration via RFCs - Back-End Configuration V. 1.0 -> BAdI: SAP Trading Platform Integration: Overwrite General Mapping.  

Inside this implementation, create a class that includes the method SECURITY_DET_TRANS_TYPE. 

 Note: If your scenario requires you to derive additional fields, such as flow type or securities account, use the BAdIFTR_TPI_PROD_SPEC_MAPPING and method SECURITY_DET_SPECIFIC_FIELDS. 

Create a custom implementation of the BAdI BN_TPI_I_TRD_CRT_SNGL, which you can find in the IMG under Treasury and Risk Management -> Transaction Manager -> General Settings -> Transaction Management -> External Link -> Connect to Trading Platform via SAP Trading Platform Integration -> Integration via Web Services - Back-End Configuration V. 2.0 -> BAdI: SAP Trading Platform Integration: Create Trade. 

 Inside this implementation, create a class that includes the method MAP_EXT2INT. 

 Note: If you are using back-end configuration version 2.0 or 2.1, you can use the same BAdI to derive additional fields. 

 In the relevant method, add an IF statement that changes the transaction type from 500 to 700 and from 600 to 800, if the relevant field of an inbound securities transaction has the value DIVCASHPAY, but otherwise leaves it unchanged. This way you can differentiate between regular dividend reinvestments and cash dividends. 

Here is an example statement:

 

  METHOD if_ftr_tpi_general_mapping~security_det_trans_type. 
    " The following code is just an example snippet for the cash dividend scenario 
    " Transaction Type '500': Dividend reinvestment purchase 
    " Transaction Type '600': Dividend reinvestment sale 
    " Transaction Type '700': Cash dividend purchase 
    " Transaction Type '800': Cash dividend sale 
    IF is_generalcontractdata-assignment = 'DIVCASHPAY'. 
      IF is_generalcontractdata-transaction_type = '500'. 
        cv_transaction_type = '700'. 
      ELSEIF is_generalcontractdata-transaction_type = '600'. 
        cv_transaction_type = '800'. 
      ENDIF. 
    ENDIF. 
  ENDMETHOD.

 

Here is how it looks in the transaction SE20:

TRM_UA_6-1709632153248.png

Now you’ve set up your SAP Trading Platform Integration and SAP S/4HANA back-end system to automatically process cash dividends. Test if everything works as intended and reach out in case of questions. Feel free to comment on this post and share your experiences. We’re looking forward to your feedback!