Skip to Content

Introduction

With Duet Sales Management, users can enable the replication of account fact sheets from CRM to their familiar Microsoft Outlook environment. This blog talks about how the standard replication mechanism works, and how you can exchange the standard factsheet document with a custom one in CRM 5.0

Account factsheet in Duet

One of the features of Duet Sales Management is the availability of the account’s factsheet in the respective Microsoft Outlook contact.

image

This document is actually the PDF output of the standard smartform CRM_ACC_ACCOUNT_OVERVIEW_PRN. It is important to note that although within Duet, this document is called factsheet, it does not use the same data source as the factsheet you might know from the business partner cockpit. Let’s look at how Duet grabs this document output.

  1. For every account, the Duet Server J2EE calls the function module
    CRM_BSP_BP_PRINT_BACKGROUND

    with the smartform name

    CRM_ACC_ACCOUNT_OVERVIEW_PRN

    and the business partner id of the account as input parameters.

  2. The function module reads the database table
    CRM_PRN_CONTROL

    in order to find the processing class which will call the smartform.

  3. The processing class
    CL_BSP_PRN_ACCOUNT

    uses the smartform

    CRM_ACC_ACCOUNT_OVERVIEW_PRN

  4. The output of the smartform
    CRM_ACC_ACCOUNT_OVERVIEW_PRN

    is sent back in PDF format to the Duet Server J2EE.

image

Changing the smartform used

The smartform CRM_ACC_ACCOUNT_OVERVIEW_PRN might not show you exactly what you want to see in such a factsheet. Hence if you want to change the smartform which is used in order to produce the Duet factsheet, you will have to do the following steps:

  1. Create a new smartform Z_MY_NEW_DUET_FACTSHEET (or any other name of course) as a copy of CRM_ACC_ACCOUNT_OVERVIEW_PRN and implement data retrieval in this smartform in order to display the data that fits your requirements.
  2. Have the function module CRM_BSP_BP_PRINT_BACKGROUND use the new smartform name Z_MY_NEW_DUET_FACTSHEET. As the picture and sequence above shows you, the Duet Server J2EE uses the smartform name CRM_ACC_ACCOUNT_OVERVIEW_PRN as an input parameter value for the function module CRM_BSP_BP_PRINT_BACKGROUND. Since you do not have access to that Java code which performs the RFC call, and since there is no customization available in Duet which allows you to define the smartform name, the only option left is to change the value of the input parameter IV_SMARTFORM after CRM_BSP_BP_PRINT_BACKGROUND has been called, meaning you will have to modify the function module and add an additional line at the beginning:
    *{ INSERT ABCK123456
    * MODIFICATION FOR DUET; use this smartform instead of standard one
    iv_smartform = 'Z_MY_NEW_DUET_FACTSHEET'.
    *} INSERT

    The downside of this approach is that no matter who calls this function module with whatever IV_SMARTFORM value will end up using your new smartform Z_MY_NEW_DUET_FACTSHEET.

  3. The function module CRM_BSP_BP_PRINT_BACKGROUND reads the database table CRM_PRN_CONTROL in order to find out which ABAP Objects Class and method to use for the smartform processing. An additional entry in this table is needed with the new smartform name Z_MY_NEW_DUET_FACTSHEET as a key, similar to the already existing entry for ‘CRM_ACC_ACCOUNT_OVERVIEW_PRN’.

    image

  4. That should do the trick, the next time a Duet client tries to update it’s account factsheet documents, the call should end up in your new smartform and the PDF output of this new smartform will be sent to the Duet client as the account factsheet.

Testing the Duet factsheet download

Using this sample report, you can simulate the factsheet retrieval for a given business partner id without needing to trigger an actual replication from a real Duet Client. You don’t even need to do the modification mentioned above, this report allows you to test the standard behaviour as well. Simply create the report and execute it, you’ll be prompted with a “Save As…” dialogue which enables you to save the smartform PDF output to a local file. The radiobuttons P_OLDFS and P_NEWFS toggle between the standard smartform name CRM_ACC_ACCOUNT_OVERVIEW_PRN and your new smartform name used in order to call CRM_BSP_BP_PRINT_BACKGROUND.

image

*&---------------------------------------------------------------------*
*& Report Z_DUET_DOWNLOAD_FACTSHEET
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT Z_DUET_DOWNLOAD_FACTSHEET.

PARAMETERS: p_bupa TYPE BU_PARTNER DEFAULT '391',
p_oldfs RADIOBUTTON GROUP gp1,
p_newfs RADIOBUTTON GROUP gp1.

data: lT_PRINT_PARAMETER type table of CRMT_PRT_MAP_ENTRY,
ls_PRINT_PARAMETER type CRMT_PRT_MAP_ENTRY,
lv_PDF_LENGTH type i,
lV_BIN_FILE type xstring,
lv_smartform_name type CRM_PRN_CONTROL-SMARTFORM.

ls_PRINT_PARAMETER-ENTRY_KEY = 'ACCOUNT_NUMBER'.
ls_PRINT_PARAMETER-ENTRY_VALUE = p_bupa.
append ls_PRINT_PARAMETER to lt_PRINT_PARAMETER.

ls_PRINT_PARAMETER-ENTRY_KEY = 'ACTIVITIES'.
ls_PRINT_PARAMETER-ENTRY_VALUE = 'X'.
append ls_PRINT_PARAMETER to lt_PRINT_PARAMETER.

ls_PRINT_PARAMETER-ENTRY_KEY = 'OPPORTUNITIES'.
ls_PRINT_PARAMETER-ENTRY_VALUE = 'X'.
append ls_PRINT_PARAMETER to lt_PRINT_PARAMETER.

ls_PRINT_PARAMETER-ENTRY_KEY = 'ADDRESS_OVERVIEW'.
ls_PRINT_PARAMETER-ENTRY_VALUE = 'X'.
append ls_PRINT_PARAMETER to lt_PRINT_PARAMETER.

ls_PRINT_PARAMETER-ENTRY_KEY = 'HISTORY'.
ls_PRINT_PARAMETER-ENTRY_VALUE = 'X'.
append ls_PRINT_PARAMETER to lt_PRINT_PARAMETER.

ls_PRINT_PARAMETER-ENTRY_KEY = 'CONTACTS'.
ls_PRINT_PARAMETER-ENTRY_VALUE = 'X'.
append ls_PRINT_PARAMETER to lt_PRINT_PARAMETER.

ls_PRINT_PARAMETER-ENTRY_KEY = 'SALES_AREAS'.
ls_PRINT_PARAMETER-ENTRY_VALUE = 'X'.
append ls_PRINT_PARAMETER to lt_PRINT_PARAMETER.

ls_PRINT_PARAMETER-ENTRY_KEY = 'R3_FACT_SHEET'.
ls_PRINT_PARAMETER-ENTRY_VALUE = 'X'.
append ls_PRINT_PARAMETER to lt_PRINT_PARAMETER.

ls_PRINT_PARAMETER-ENTRY_KEY = 'RELATION_TYPES'.
ls_PRINT_PARAMETER-ENTRY_VALUE = 'X'.
append ls_PRINT_PARAMETER to lt_PRINT_PARAMETER.

if p_oldfs = 'X'.
lv_smartform_name = 'CRM_ACC_ACCOUNT_OVERVIEW_PRN'.
endif.

if p_newfs = 'X'.
lv_smartform_name = 'Z_MY_NEW_DUET_FACTSHEET'.
endif.


CALL FUNCTION 'CRM_BSP_BP_PRINT_BACKGROUND'
EXPORTING
IV_APPLICATION = 'COMM_BUPA'
IV_US_ROLE = SPACE
IV_SMARTFORM = lv_smartform_name
IV_PARAMETER_STRUCTURE = 'CRMT_BSP_PRN_SCREEN_DATA_ACC'
IV_LANGU = 'E'
IV_OUTPUT_FORMAT = 'PDF'
IMPORTING
EV_PDF_LENGTH = lv_pdf_length
EV_BIN_FILE = lV_BIN_FILE
TABLES
IT_PRINT_PARAMETER = lt_PRINT_PARAMETER
* ET_OUTPUT_OTF =
* ET_OUTPUT_PDF =
EXCEPTIONS
NO_CUSTOMIZING_FOUND = 1
CLASS_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
CALL FUNCTION 'LXE_COMMON_XSTRING_FILE_EXPORT'
EXPORTING
XSTRING = lV_BIN_FILE.
ENDIF.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply