Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Link to Content's target Space :

http://wiki.sdn.sap.com/wiki/display/CRM/CRM+Web+Client+UI+Framework 

Applies to:

SAP CRM WEB UI version 6.0 or more 

Summary

This paper tells that a url can be sent in an email, to the users and when the user clicks the email, the concerned document is opened in WEB ui.

I have shown the case of a Business activity. 

Author(s):  

   
Company:     IBM Pvt Ltd
Created on:    3.12.2010
Author(s) Bio

I have 6 years of experience in SAP CRM. My key areas are BSP, Web ui and CRM technical. 


Table of Contents

Initial Development

Before doing this development, we need a couple of things.

First of all we need to maintain the following entry in the generic Op mapping for our navigation profile.

If this entry already exists for the navigation profile, then there is no need to maintain it again.

Secondly we need the guid of the document which we are going to show in web ui.

We can get the guid from the table crmd_orderadm_h. I have taken the transaction type as '0010'
 

Concept

Before writing the code we need to build the url.

This url is shown below.http://xxxxxxxxxx.xx.xxx.com:8002/sap/bc/bsp/sap/crm_ui_start/default.htm?sap-client=800&sap-language=EN&sap-domainRelax=min&crm-object-type=BT126_APPT&crm-object-action=B&crm-object-value=4CF536DA49750074E1008000097E28D5 .

The first part of the url (shown below), we can get from the (browser) login screen of web ui.

 http://xxxxxxxxxx.xx.xxx.com:8002/sap/bc/bsp/sap/crm_ui_start/default.htm .

 In the second part, we will cover the query string parameters. 

sap-client = 800. In my case the client is 800. Please provide your client. 

sap-laguage=EN. Please provide your login language.

crm-object-type=BT126_APPT . This is the object type from generic op mapping. 

crm-object-action=B . value B is for display. 

crm-object-value. In this parameter we are passing the guid of the document.  

Once our url is ready, we can write a simple code for sending the email. I have hardcoded the url in my code.

  

Once you execute the report you can see the email in SOST.
Once you copy the url and paste it in browser, it will ask redirect you to the web ui login screen.

  

On entering the username and password, it will directly take you the activity display screen.

 

Coding

Shown below is the code written for sending the email.

REPORT  ZCRM_EMAIL.

DATA: GS_MAIL_DATA    TYPE SODOCCHGI1,
      GT_TEXT_LINES   TYPE STANDARD TABLE OF TLINE,
      GT_MAIL_CONTENT TYPE STANDARD TABLE OF SOLISTI1  WITH HEADER LINE,
      GT_RECEIVERS    TYPE STANDARD TABLE OF SOMLRECI1 WITH HEADER LINE,
      GS_TEXT_LINES   TYPE TLINE.

  gt_mail_content-line = 'Dear User'.

  append gt_mail_content.

  gt_mail_content-line = ''.
  append gt_mail_content.

  gt_mail_content-line =
    'A new activity has been created' &
     '. Please login in the below link '.
  append gt_mail_content.

  gt_mail_content-line = ''.
  append gt_mail_content.

  gt_mail_content-line = 'http://xxxxxxx013.in.xxx.com:8002/sap/bc/bsp/sap/crm_ui_start/default.htm?sap-client=800&sap-language=EN&sap-domainRelax=min&crm-object-type=BT126_APPT&crm-object-action=B&crm-object-value=4CF536DA49750074E1008000097E28D5'.
  append gt_mail_content.

  gt_mail_content-line = ''.
  append gt_mail_content.

  gt_mail_content-line = 'Regards,'.
  append gt_mail_content.

  gt_mail_content-line = 'Abhilash'.
  append gt_mail_content.

* mail data
  GS_MAIL_DATA-OBJ_NAME = 'Activity'.
  MOVE 'My test activity' TO GS_MAIL_DATA-OBJ_DESCR.
  condense GS_MAIL_DATA-OBJ_DESCR.
  GS_MAIL_DATA-OBJ_LANGU = 'EN'.

* receiver data
  CLEAR   GT_RECEIVERS.
  REFRESH GT_RECEIVERS.
  MOVE 'abhilashpmenon@hotmail.com'           TO GT_RECEIVERS-RECEIVER.
  MOVE 'U'                  TO GT_RECEIVERS-REC_TYPE.
  MOVE 'INT'                TO GT_RECEIVERS-COM_TYPE.
  APPEND GT_RECEIVERS.

  MOVE 'abhilashpmenon@hotmail.com'        TO GT_RECEIVERS-RECEIVER.
  MOVE 'X'                  TO GT_RECEIVERS-COPY.
  MOVE 'U'                  TO GT_RECEIVERS-REC_TYPE.
  MOVE 'INT'                TO GT_RECEIVERS-COM_TYPE.
  APPEND GT_RECEIVERS.

  CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
    EXPORTING
      DOCUMENT_DATA              = GS_MAIL_DATA
      PUT_IN_OUTBOX              = 'X'
    TABLES
      OBJECT_CONTENT             = GT_MAIL_CONTENT
      RECEIVERS                  = GT_RECEIVERS
    EXCEPTIONS
      TOO_MANY_RECEIVERS         = 1
      DOCUMENT_NOT_SENT          = 2
      DOCUMENT_TYPE_NOT_EXIST    = 3
      OPERATION_NO_AUTHORIZATION = 4
      PARAMETER_ERROR            = 5
      X_ERROR                    = 6
      ENQUEUE_ERROR              = 7
      OTHERS                     = 8.
  IF SY-SUBRC = 0.
    COMMIT WORK AND WAIT.
  ENDIF.