launch sap® gui transaction from webclient ui...launch sap® gui transaction from webclient ui...

41
Development and Extension Guide Launch SAP® GUI Transaction from WebClient UI Target Audience Consultants Administrators Others Legal Disclaimer The information in this document is confidential and proprietary to SAP and may not be disclosed without the permission of SAP. This presentation is not subject to your license agreement or any other service or subscription agreement with SAP. SAP has no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation and SAP's strategy and possible future developments, products and or platforms directions and functionality are all subject to change and may be changed by SAP at any time for any reason without notice. The information on this document is not a commitment, promise or legal obligation to deliver any material, code or functionality. This document is provided without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. This document is for informational purposes and may not be incorporated into a contract. SAP assumes no responsibility for errors or omissions in this document, except if such damages were caused by SAP intentionally or grossly negligent. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions. Internal Document version 1.6 17/12/2012

Upload: others

Post on 09-Feb-2021

12 views

Category:

Documents


0 download

TRANSCRIPT

  • Development and Extension Guide

    Launch SAP® GUI Transaction from WebClient UI

    Target Audience

    ■ Consultants ■ Administrators ■ Others

    Legal Disclaimer The information in this document is confidential and proprietary to SAP and may not be disclosed without the permission of SAP. This presentation is not subject to your license agreement or any other service or subscription agreement with SAP. SAP has no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation and SAP's strategy and possible future developments, products and or platforms directions and functionality are all subject to change and may be changed by SAP at any time for any reason without notice. The information on this document is not a commitment, promise or legal obligation to deliver any material, code or functionality. This document is provided without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. This document is for informational purposes and may not be incorporated into a contract. SAP assumes no responsibility for errors or omissions in this document, except if such damages were caused by SAP intentionally or grossly negligent.

    All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.

    Internal Document version 1.6 – 17/12/2012

  • © Copyright 2012 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.

    Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, xApps, xApp, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. Disclaimer

    Some components of this product are based on Java™. Any code change in these components may cause unpredictable and severe malfunctions and is therefore expressively prohibited, as is any decompilation of these components. Any Java™ Source Code delivered with this product is only to be used by SAP’s Support Services and may not be modified or altered in any way.

    SAP AG

    Dietmar-Hopp-Allee 16 69190 Walldorf Germany T +49/18 05/34 34 24 F +49/18 05/34 34 20 www.sap.com

  • Terms for Included Open

    Source Software

    This SAP software contains also the third party open source software products listed below. Please note that for these third party products the following special terms and conditions shall apply. 1. This software was developed using ANTLR. 2. gSOAP Part of the software embedded in this product is gSOAP software. Portions created by gSOAP are Copyright (C) 2001-2004 Robert A. van Engelen, Genivia inc. All Rights Reserved. THE SOFTWARE IN THIS PRODUCT WAS IN PART PROVIDED BY GENIVIA INC AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3. SAP License Agreement for STLport SAP License Agreement for STLPort between SAP Aktiengesellschaft Systems, Applications, Products in Data Processing Neurottstrasse 16 69190 Walldorf, Germany (hereinafter: SAP) and you (hereinafter: Customer) a) Subject Matter of the Agreement A) SAP grants Customer a non-exclusive, non-transferrable, royalty-free license to use the STLport.org C++ library (STLport) and its documentation without fee. B) By downloading, using, or copying STLport or any portion thereof Customer agrees to abide by the intellectual property laws, and to all of the terms and conditions of this Agreement. C) The Customer may distribute binaries compiled with STLport (whether original or modified) without any royalties or restrictions. D) Customer shall maintain the following copyright and permissions notices on STLport sources and its documentation unchanged:

    Copyright 2001 SAP AG E) The Customer may distribute original or modified STLport sources, provided that: o The conditions indicated in the above permissions notice are met; o The following copyright notices are retained when present, and conditions provided in accompanying permission notices are met: Coypright 1994 Hewlett-Packard

    Company

    Copyright 1996,97 Silicon Graphics

    Computer Systems Inc.

    Copyright 1997 Moscow Center for

    SPARC Technology.

    Copyright 1999,2000 Boris Fomitchev

    Copyright 2001 SAP AG

    Permission to use, copy, modify, distribute and sell this software and its documentation for any purposes is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Hewlett-Packard Company makes no representations about the suitability of this software for any purpose. It is provided “as is” without express or implied warranty. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Silicon Graphics makes no representations about the suitability of this software for any purpose. It is provided “as is” without express or implied warranty. Permission to use, copy, modify, distribute and sell this software and its documentation for any purposes is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Moscow Center for SPARC makes no representations about the suitability of this software for any purpose. It is provided “as is” without express or implied warranty. Boris Fomitchev makes no representations about the suitability of this software for any purpose. This material is provided "as is", with absolutely no warranty expressed or implied. Any use is at your own risk. Permission to use or copy this software for any purpose is hereby granted without fee, provided the above notices are retained on all copies.

  • Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice. Permission to use, copy, modify, distribute and sell this software and its documentation for any purposes is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. SAP makes no representations about the suitability of this software for any purpose. It is provided with a limited warranty and liability as set forth in the License Agreement distributed with this copy. SAP offers this liability and warranty obligations only towards its customers and only referring to its modifications. b) Support and Maintenance SAP does not provide software maintenance for the STLport. Software maintenance of the STLport therefore shall be not included. All other services shall be charged according to the rates for services quoted in the SAP List of Prices and Conditions and shall be subject to a separate contract. c) Exclusion of warranty As the STLport is transferred to the Customer on a loan basis and free of charge, SAP cannot guarantee that the STLport is error-free, without material defects or suitable for a specific application under third-party rights. Technical data, sales brochures, advertising text and quality descriptions produced by SAP do not indicate any assurance of particular attributes. d) Limited Liability A) Irrespective of the legal reasons, SAP shall only be liable for damage, including unauthorized operation, if this (i) can be compensated under the Product Liability Act or (ii) if caused due to gross negligence or intent by SAP or (iii) if based on the failure of a guaranteed attribute. B) If SAP is liable for gross negligence or intent caused by employees who are neither agents or managerial employees of SAP, the total liability for such damage and a maximum limit on the scope of any such damage shall depend on the extent to which its occurrence ought to have anticipated by SAP when concluding the contract, due to the circumstances known to it at that point in time representing a typical transfer of the software. C) In the case of Art. 4.2 above, SAP shall not be liable for indirect damage, consequential damage caused by a defect or lost profit.

    D) SAP and the Customer agree that the typical foreseeable extent of damage shall under no circumstances exceed EUR 5,000. E) The Customer shall take adequate measures for the protection of data and programs, in particular by making backup copies at the minimum intervals recommended by SAP. SAP shall not be liable for the loss of data and its recovery, notwithstanding the other limitations of the present Art. 4 if this loss could have been avoided by observing this obligation. F) The exclusion or the limitation of claims in accordance with the present Art. 4 includes claims against employees or agents of SAP. 4. Adobe Document Services Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and / or other countries. For information on Third Party software delivered with Adobe document services and Adobe LiveCycle Designer, see SAP Note 854621.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 5

    Typographic

    Conventions

    Type Style Description

    Example Text Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options.

    Cross-references to other documentation

    Example text Emphasized words or phrases in body text, graphic titles, and table titles

    EXAMPLE TEXT Technical names of system objects. These include report names, program names, transaction codes, table names, and key concepts of a programming language when they are surrounded by body text, for example, SELECT and INCLUDE.

    Example text Output on the screen. This includes file and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools.

    Example text Exact user entry. These are words or characters that you enter in the system exactly as they appear in the documentation.

    Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system.

    EXAMPLE TEXT Keys on the keyboard, for

    example, F2 or ENTER.

    Icons

    Icon Meaning

    Caution

    Example

    Note

    Recommendation

    Syntax

    Additional icons are used in SAP Library documentation to help you identify different types of information at a glance. For more

    information, see Help on Help General Information Classes and Information Classes for Business Information Warehouse on the first page of any version of SAP Library.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    6 December 12

    Table of Contents 1 Introduction ............................................................................................................................... 7

    1.1 Naming Conventions ......................................................................................................... 7 1.2 CSN Components ............................................................................................................. 8 1.3 Helpful Links ..................................................................................................................... 8

    2 Scenario Overview .................................................................................................................... 9

    3 Architecture Overview ............................................................................................................. 10

    4 Implementation ....................................................................................................................... 11

    4.1 Prerequisites ................................................................................................................... 11 4.2 Setup Launch Transaction (LTX) .................................................................................... 11

    4.2.1 Create BSP ................................................................................................................ 11 4.2.2 Define URL & Parameters ......................................................................................... 12 4.2.3 Configure Transaction Launcher (Wizard) ................................................................. 13

    4.3 Setup Navigation Bar Profile ........................................................................................... 16 4.3.1 Define Logical Links ................................................................................................... 16 4.3.2 Define Direct Link Groups.......................................................................................... 17 4.3.3 Assign Direct Link Group to Navigation Bar Profile ................................................... 17 4.3.4 Adjust Direct Link Groups .......................................................................................... 18

    4.4 Adjust Launch Transaction Handler Class ...................................................................... 19 4.5 Implement BSP ............................................................................................................... 21 4.6 Create and Implement Adapter Transaction ................................................................... 22

    5 Example .................................................................................................................................. 33

    5.1 Identify Account in WebClient UI .................................................................................... 33 5.2 Start Launch Transaction ................................................................................................ 33 5.3 Create Sales Order in SAP GUI for Windows................................................................. 34 5.4 Check Interaction Record in WebClient UI ..................................................................... 35

    6 Debugging Tips ....................................................................................................................... 36

    7 Alternative approaches ........................................................................................................... 38

    7.1 Launch SAP GUI Windows Transaction via SAP NetWeaver Portal ............................. 38 7.2 Call ERP Transactions via RFC Function modules instead of using BOR Method Invokation 39 7.3 Launch SAP GUI Windows – no Callback required ........................................................ 40

    8 Further hints ............................................................................................................................ 41

    8.1 Security warning messages ............................................................................................ 41 8.2 Using Single Sign On ...................................................................................................... 41 8.3 Veto handling .................................................................................................................. 41 8.4 Multi Sessioning .............................................................................................................. 41

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 7

    1 Introduction This extension guide provides information on how to integrate business transactions running in SAP GUI for Windows into the WebClient UI.

    About this Document

    The development and extension guide is written for the following main target groups:

    Technology consultants

    Development consultants

    Developers at customer site

    This document is mainly intended for the above-mentioned target groups who have basic ABAP skills, who know SAP CRM and SAP ERP, and who want to launch SAP GUI business transactions from the WebClient UI.

    The development and extension guide consists of the following main sections:

    Introduction

    Scenario Overview

    Architecture Overview

    Implementation Guide

    Example

    1.1 Naming Conventions In this documentation, the following naming conventions apply:

    Business Object Repository (BOR)

    Business Server Pages (BSP)

    SAP Graphical User Interface (SAP GUI)

    Internet Transaction Launcher (ITS)

    Launch Transaction (LTX)

    Remote Function Call (RFC)

    Simple ABAP messaging (SAM)

    Software component (SC)

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    8 December 12

    1.2 CSN Components The following table lists the CSN components that are applicable for this scenario:

    CSN Component Component Description

    BC-DWB-TOO-BOB Business Object Builder

    CA-EPT-SSC Shared Service Center Framework

    CA-GTF-IC-ACC Activity Clipboard

    BC-BMT-WFM SAP Business Workflow

    BC-FES-GUI Graphical User Interface

    1.3 Helpful Links The following table contains helpful links to the Internet:

    Topic Web Link

    Transaction Launcher http://help.sap.com/saphelp_crm70/helpdata/en/46/231befc17b5872e10000000a11466f/frameset.htm

    Business Object Repository

    http://help.sap.com/saphelp_nw73/helpdata/en/4d/d26f601acb2cc0e10000000a42189b/frameset.htm

    SAP Shortcut Link http://help.sap.com/saphelp_erp60/helpdata/en/2f/6d2e42e1ef5633e10000000a155106/frameset.htm

    Business Server Pages http://help.sap.com/saphelp_nw73/helpdata/en/4c/4bada9aea0697ae10000000a42189b/frameset.htm

    http://help.sap.com/saphelp_crm70/helpdata/en/46/231befc17b5872e10000000a11466f/frameset.htmhttp://help.sap.com/saphelp_crm70/helpdata/en/46/231befc17b5872e10000000a11466f/frameset.htmhttp://help.sap.com/saphelp_nw73/helpdata/en/4d/d26f601acb2cc0e10000000a42189b/frameset.htmhttp://help.sap.com/saphelp_nw73/helpdata/en/4d/d26f601acb2cc0e10000000a42189b/frameset.htmhttp://help.sap.com/saphelp_erp60/helpdata/en/2f/6d2e42e1ef5633e10000000a155106/frameset.htmhttp://help.sap.com/saphelp_erp60/helpdata/en/2f/6d2e42e1ef5633e10000000a155106/frameset.htmhttp://help.sap.com/saphelp_nw73/helpdata/en/4c/4bada9aea0697ae10000000a42189b/frameset.htmhttp://help.sap.com/saphelp_nw73/helpdata/en/4c/4bada9aea0697ae10000000a42189b/frameset.htm

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 9

    2 Scenario Overview The standard technique to integrate SAP GUI business transactions into the WebClient UI is using the transaction launcher. The transaction launcher starts SAP GUI for HTML transactions via the Internet Transaction Server (ITS). SAP GUI for HTML is based completely on Web technologies and some functionality is different or not available in comparison to SAP GUI for Windows (see SAP Note 314568 SAP GUI for HTML functionality / limitations / special behavior).

    This document describes an integration scenario to integrate SAP GUI for Windows into the WebClient UI.

    © 2011 SAP AG. All rights reserved. 3

    Transaction Launcher:

    Call Transaction in Local SAP GUI

    URL Based Launch Transaction

    SAP Shortcut File (SSF)

    Parameters:System, Client: ERP Q43 778

    User: e.g. DUERHOLTH

    BOR object: BUS2032 (“VA01”)

    BOR method: Create_With_Dialog

    BOR Attributes:

    Transaction Type: TA

    Current Customer: 3271

    CRM session ID: 4711

    SAP GUI Adapter Transaction

    CRM SystemStart Shortcut & Transfer Parameters

    Start BOR

    Object &

    Method &

    Transfer

    Parameters

    BOR object: BUS2032

    BOR Method: Create_With_Dialog

    Keep: CRM session ID: 4711

    Launch in

    Local SAP

    GUIStart Launch Transaction

    Transferring Parameters

    ID of Created

    Sales Order

    ID of Created

    Sales Order

    CRM IC: Session ID: 4711

    Bring Sales Order ID to

    UI Through IC Polling 1.)

    2.)

    3.)

    4.)5.)

    6.)7.)

    8.)

    ERP Systems

    CRM System

    Figure 1 - Scenario Overview

    The picture describes a very common integration use case.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    10 December 12

    3 Architecture Overview

    CRM BSPERP RFC

    Session

    CRM SAP

    GUI Session

    WebClient UI

    Session

    Start URL Based LTX

    Start Adapter Transaction

    in SAP GUI Windows

    via Shortcut Link

    Return

    RFC

    BOR Method Invoke

    HTTP Callback (SAM)

    Figure 2 - Architecture Overview

    The picture shows the sequence diagram for the typical program flow.

    The scenario starts within a WebClient UI session. Here, a certain data context is prepared (e.g. account and contact are identified).

    From the navigation bar or alternatively from within a UI component, a URL-based LTX is started which invokes a BSP application. The task of this BSP application is to retrieve data from the current context, to build a SAP shortcut link and finally to trigger SAP shortcut link execution. In principle, the desired SAP ERP transaction could be executed from here directly. To be able to enrich data and later to return data to the WebClient UI session, an adapter transaction is executed instead.

    The adapter transaction gets data from the BSP application and invokes a BOR method via RFC in the SAP ERP System. After the transaction related to the BOR method is executed in SAP ERP, an object ID is returned to the adapter transaction (e.g. sales order number in case of BOR BUS2032, method create).This information can be passed back to the WebClient UI session using callback via SAM.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 11

    4 Implementation The following chapters contain detailed information on how to implement a scenario described in chapter 2 Scenario Overview

    It takes 15 steps of configuration and implementation. All activities have to be processed in the CRM back end system.

    4.1 Prerequisites The CRM back end system has to be on release CRM 7.0 or higher. For CRM 7.0 there is some additional effort required. All additional efforts are labeled like this:

    CRM 7.0 only:

    4.2 Setup Launch Transaction (LTX) LTX is an integration tool. It enables the display of web pages within the WebClient UI that provide functionality that has not been implemented within the WebClient UI. There are three different kinds of integration:

    Calling URLs

    Calling a method of the business object repository (BOR) using the SAP GUI for HTML

    Front office (FO) processes in the utilities industry (IS-U)

    In this scenario we make use of URL-based launch transactions.

    4.2.1 Create BSP This BSP application will be invoked by LTX. The task of this BSP application is to retrieve data from the current context, to build a SAP shortcut link, and finally to trigger SAP shortcut link execution. The BSP application contains one page with flow logic. The implementation for Event Handler OnCreate can be done later and is explained in 4.5 Implement BSP

    Step 1: Use transaction SE80 in your CRM back end system to create the new BSP application., The structure looks like this:

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    12 December 12

    4.2.2 Define URL & Parameters You define URL IDs and properties for all URL-based applications you want to use in the transaction launcher.

    Step 2: Choose SAP Implementation Guide → Customer Relationship Management → UI Framework → Technical Role Definition → Transaction Launcher → Define URLs and Parameters to create a new URL ID. The URL ID looks like this:

    Step 3: Define parameters to be passed to the BSP application:

    CRM 7.0 only: In addition, define the following parameters, all using Element type Import and marked as Form Field:

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 13

    4.2.3 Configure Transaction Launcher (Wizard)

    You use this wizard to create or maintain launch transactions which are used in the WebClient UI.

    Use SAP Implementation Guide → Customer Relationship Management → UI Framework → Technical Role Definition → Transaction Launcher → Configure Transaction Launcher, to create the new launch transaction ID.

    Step 4: Define Launch Transaction ID

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    14 December 12

    Step 5: Define the handler class which will be generated after all wizard steps have been executed. For the parameter Source Session Type select Simple ABAP Messaging. This is required for returning information from the SAP ERP transaction via SAM callback:

    CRM 7.0 only: The attribure Source Session Type is not available.

    Step 6: Refer to the URL ID created in 4.2.2 Define URL & Parameters:

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 15

    Step 7: Refer to the parameter(s) created in 4.2.2 Define URL & Parameters:

    CRM 7.0 only: Select parameters LOGSYS, SOURCE_SESSION_TYPE and SOURCE_SESSION_ID

    The next step within the wizard Activity Clipboard Integration can be skipped.

    In this scenario we use SAM callback instead of the Activity Clipboard Integration provided by LTX framework to achieve Activity Clipboard Integration.

    After the completion of all steps, you will find a generated handler class in transaction SE80:

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    16 December 12

    4.3 Setup Navigation Bar Profile

    To be able to start the launch transaction created in 4.2 Setup Launch Transaction (LTX), you need to create an entry in the menu area of the navigation bar.

    After completing the following 4 steps, you will find the new group Launch SAP GUI in the navigation bar:

    4.3.1 Define Logical Links Step 8: Create logical link and assign launch transaction ID referring from 4.2.3 Configure

    Transaction Launcher (Wizard).

    SAP Implementation Guide → Customer Relationship Management → UI Framework → Technical Role Definition → Define Navigation Bar Profile:

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 17

    4.3.2 Define Direct Link Groups Step 9: Create direct link group and assign logical link referring from 4.3.1 Define Logical

    Links.

    SAP Implementation Guide → Customer Relationship Management → UI Framework → Technical Role Definition → Define Navigation Bar Profile:

    4.3.3 Assign Direct Link Group to Navigation Bar Profile

    Step 10: Add Direct Link Group referring from 4.3.2 Define Direct Link Groups to Navigation Bar Profile which is linked to the preferred business role.

    SAP Implementation Guide → Customer Relationship Management → UI Framework → Technical Role Definition → Define Navigation Bar Profile:

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    18 December 12

    4.3.4 Adjust Direct Link Groups

    Step 11: Make sure the newly created Direct Link Group from 4.3.2 Define Direct Link Groups is visible for the preferred business role.

    SAP Implementation Guide → Customer Relationship Management → UI Framework → Technical Role Definition → Define Business Role:

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 19

    4.4 Adjust Launch Transaction Handler Class The launch transaction handler class represents the ABAP object class that contains all code needed to execute a specific launch transaction. The class is generated based on input referring from steps described in 4.2.3 Configure Transaction Launcher (Wizard).

    There is a method PREPARE_DATA_FLOW in the handler class which can be used to retrieve data from the current context of the WebClient UI session to be passed to the subsequent programs.

    The following lines were generated:

    method IF_CRM_IC_ACTION_HANDLER~PREPARE_DATA_FLOW.

    data: __gdc type ref to if_crm_ui_data_context,

    __source type string,

    __line type string,

    __path type crmt_ic_ac_identify_path.

    __gdc ?=

    cl_crm_ui_data_context_srv=>get_instance( gv_view_controller ).

    ********** Begin of parameter declaration ***********

    data: __value type string.

    concatenate

    space

    'CURRENTCUSTOMER/BP_NUMBER'

    into __source.

    if __gdc is bound.

    try.

    call method __gdc->GET_ENTITY_ATTRIBUTE_AS_VALUE

    exporting

    path = __source

    importing

    value = __value .

    catch cx_crm_bdc_no_data cx_crm_bdc_xpath_error cx_root.

    clear __value .

    endtry.

    endif.

    add_parameter(

    iv_name =

    'CUSTOMER_ID'

    iv_value = __value ).

    me->add_source_session( ).

    * Data flow is complete - set to false if data is missing

    gv_data_flow_complete = abap_true.

    endmethod.

    CRM 7.0 only: Replace line ‘me->add_source_session() with the following lines of coding:

    * retrieve SAM Session ID

    CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

    IMPORTING

    own_logical_system = lv_src_logsys

    EXCEPTIONS

    own_logical_system_not_defined = 1

    OTHERS = 2.

    IF sy-subrc NE 0.

    RAISE EXCEPTION TYPE cx_crm_ui_ltx

    EXPORTING

    textid = cx_crm_ui_ltx=>no_ownlogsys_error

    system = sy-sysid

    client = sy-mandt.

    ENDIF.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    20 December 12

    lv_src_session_id = cl_icwc_session_registry=>get_agent_session_id( ).

    lv_src_session_type = 'SAM'.

    __value = lv_src_logsys.

    me->add_parameter( iv_name = cl_crm_ic_ltx_constants=>logsys

    iv_value = __value ).

    __value = lv_src_session_type.

    me->add_parameter( iv_name = cl_crm_ui_ltx_constants=>source_session_type

    iv_value = __value ).

    __value = lv_src_session_id.

    me->add_parameter( iv_name = cl_crm_ui_ltx_constants=>source_session_id

    iv_value = __value ).

    Step 12: Use transaction SE80 to add any further parameters by providing a logic to retrieve parameter value, pass it to variable __value and use

    add_parameter( iv_name = 'PARAMETER_XYZ' iv_value = __value ).

    before the data flow is set to complete.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 21

    4.5 Implement BSP

    For the BSP application created in 4.2.1 Create BSP, you need to implement the Event Handler OnCreate.

    Step 13: Use transaction SE80 to implement the method OnCreate:

    * this handler is called once the page is first created (stateful mode)

    * it performs a once-off data initialization or object creation

    DATA: lv_shortcut TYPE string.

    DATA: lv_xshortcut TYPE xstring.

    DATA: lo_bsp_runtime TYPE REF TO if_bsp_runtime.

    DATA: lv_customer_id TYPE string.

    DATA: lv_samsys TYPE string.

    DATA: lv_samtyp TYPE string.

    DATA: lv_samsid TYPE string.

    * Prepare SAP GUI Shortcut Link

    CALL FUNCTION 'SWN_CREATE_SHORTCUT'

    EXPORTING

    i_transaction = 'ZRR_BOR_INVOKE'

    i_title = 'Launching SAP GUI...'

    IMPORTING

    shortcut_string = lv_shortcut

    EXCEPTIONS

    inconsistent_parameters = 1

    OTHERS = 1.

    * Retrieve parameter data passed via LTX

    * Retrieve SAM Session

    lv_samsys = runtime->server->request-

    >get_form_field( cl_crm_ic_ltx_constants=>logsys ).

    CONCATENATE 'p_samsys=' lv_samsys INTO lv_samsys.

    lv_samtyp = runtime->server->request-

    >get_form_field( cl_crm_ui_ltx_constants=>source_session_type ).

    CONCATENATE 'p_samtyp=' lv_samtyp INTO lv_samtyp.

    lv_samsid = runtime->server->request-

    >get_form_field( cl_crm_ui_ltx_constants=>source_session_id ).

    CONCATENATE 'p_samsid=' lv_samsid INTO lv_samsid.

    * Retrieve Customer ID

    lv_customer_id = runtime->server->request->get_form_field( 'CUSTOMER_ID' ).

    CONCATENATE 'p_okey=' lv_customer_id INTO lv_customer_id.

    * Adapt SAP GUI Shortcut Link with parameters

    REPLACE FIRST OCCURRENCE OF 'Command=ZRR_BOR_INVOKE' IN lv_shortcut WITH

    'Command=*ZRR_BOR_INVOKE p_otype=BUS2032;p_okey=;p_method=create;p_logsys=ZZZCNLT600;p

    _samsys=;p_samtyp=;p_samsid='.

    * Commented code demonstrates usage of parameter Customer ID. In this use case

    * Customer ID is passed as object key for BUS1006

    *'Command=*ZRR_BOR_INVOKE p_otype=BUS1006;p_logsys=ZZZCLNT600;p_okey=;p_method=display

    ;p_samsys=;p_samtyp=;p_samsid='.

    *REPLACE FIRST OCCURRENCE OF 'p_okey=' IN lv_shortcut WITH lv_customer_id.

    REPLACE FIRST OCCURRENCE OF 'p_samsys=' IN lv_shortcut WITH lv_samsys.

    REPLACE FIRST OCCURRENCE OF 'p_samtyp=' IN lv_shortcut WITH lv_samtyp.

    REPLACE FIRST OCCURRENCE OF 'p_samsid=' IN lv_shortcut WITH lv_samsid.

    CONCATENATE lv_shortcut '[Options] Reuse=1;' INTO lv_shortcut.

    * Trigger SAP GUI Shortcut execution

    runtime->server->response->set_header_field( name = 'content-type'

    value = 'application/x-sapshortcut' ).

    CALL METHOD cl_http_utility=>if_http_utility~encode_utf8

    EXPORTING

    unencoded = lv_shortcut

    RECEIVING

    encoded = lv_xshortcut

    EXCEPTIONS

    OTHERS = 1.

    IF sy-subrc = 0.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    22 December 12

    CALL METHOD runtime->server->response->set_data( data = lv_xshortcut ).

    ENDIF.

    In this example, the SAP shortcut link to execute the adapter transaction ZRR_BOR_INVOKE is created. It passes the BOR object BUS2032 (sales order), BOR method create as parameter, and session information to the adapter transaction. The variable p_logsys contains the SAP ERP RFC destination.

    All parameters passed in the command line have to be known/in synch with report parameters of the adapter transaction (see next chapter).

    4.6 Create and Implement Adapter Transaction

    This transaction is called via the SAP shortcut link as described in chapter 4.5 Implement BSP.

    Technically, the adapter transaction is a report transaction.

    Step 14: Use transaction SE80 to create program ZRR_BOR_INVOKE of type Executable program.

    *&---------------------------------------------------------------------*

    *& Report ZRR_BOR_INVOKE

    *&---------------------------------------------------------------------*

    REPORT zrr_bor_invoke.

    INCLUDE .

    PARAMETERS:

    p_otype TYPE swotobjid-objtype,

    p_okey TYPE swotobjid-objkey,

    p_logsys TYPE logsys,

    p_method TYPE swotinvoke-verb,

    p_samsys TYPE logsys,

    p_samtyp TYPE wcft_ltx_src_session_type,

    p_samsid TYPE crmc_ic_string.

    DATA:

    gs_borident TYPE borident,

    gr_object TYPE obj_record,

    gs_return TYPE swotreturn,

    gt_container TYPE TABLE OF swcont,

    gv_return_object_key TYPE swo_typeid.

    gs_borident-objtype = p_otype.

    gs_borident-objkey = p_okey.

    * Test VA01 – ideally this input is also passed as parameter via BSP

    * application. Hardcoded setting is done for simplification reason.

    swc_set_element gt_container 'TransactionCode' 'VA01'.

    swc_set_element gt_container 'SalesDocumentType' 'TA'.

    IF gs_borident IS NOT INITIAL.

    * create BOR reference

    CALL FUNCTION 'SWO_CREATE' DESTINATION p_logsys

    EXPORTING

    objtype = gs_borident-objtype

    objkey = gs_borident-objkey

    IMPORTING

    object = gr_object-handle

    return = gs_return.

    * call BOR-Method

    CALL FUNCTION 'SWO_INVOKE' DESTINATION p_logsys

    EXPORTING

    access = 'C'

    object = gr_object-handle

    verb = p_method

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 23

    persistent = ' '

    IMPORTING

    return = gs_return

    TABLES

    container = gt_container

    EXCEPTIONS

    system_failure = 1

    communication_failure = 2

    OTHERS = 3.

    IF sy-subrc 0.

    * Exception occurs e.g. when user navigates away from called transaction

    LEAVE PROGRAM.

    ENDIF.

    * get key and default attribute for return data flow

    CALL FUNCTION 'SWO_OBJECT_ID_GET' DESTINATION p_logsys

    EXPORTING

    object = gr_object-handle

    IMPORTING

    return = gs_return

    OBJID = gv_return_object_key.

    * free BOR object

    CALL FUNCTION 'SWO_FREE' DESTINATION p_logsys

    EXPORTING

    object = gr_object-handle

    IMPORTING

    return = gs_return.

    ENDIF.

    * Trigger SAM Callback (CRM IC only!)

    PERFORM callback_via_sam.

    * End of program

    FORM callback_via_sam .

    * Set the source session info into callback

    IF NOT p_samsid IS INITIAL.

    CALL METHOD cl_ssc_ic_callback=>set_source_session

    EXPORTING

    iv_logsys = p_samsys

    iv_session_id = p_samsid

    iv_session_type = p_samtyp

    EXCEPTIONS

    parameter_not_complete = 1

    no_rfc_destination = 2

    OTHERS = 3.

    CHECK sy-subrc = 0.

    * Call callback method

    * Put object key of created sales order to IREC

    CALL METHOD cl_ssc_ic_callback=>add_to_irecord

    EXPORTING

    iv_objtype = gs_borident-objtype

    iv_objkey = gv_return_object_key

    iv_logsys = p_logsys

    EXCEPTIONS

    callback_failed = 1

    no_session_id = 2

    no_rfc_destination = 3

    own_logical_system_not_defined = 4

    link_to_irecord_failed = 5

    OTHERS = 6.

    IF sy-subrc 0.

    * Raise Error message!

    ENDIF.

    ENDIF.

    ENDFORM. " CALLBACK_VIA_SAM

    CRM 7.0 only: Replace FORM callback_via_sam with the following lines of coding:

    FORM callback_via_sam .

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    24 December 12

    data:

    lr_request type ref to if_crm_ic_5x_ws_request,

    lr_processor type ref to cl_crm_ic_5x_ws_processor,

    lr_response type ref to if_crm_ic_5x_ws_response,

    lr_param_obj type ref to if_crm_ic_5x_ws_param_value,

    lt_properties type crmt_ic_name_value_tab,

    ls_property type crmt_ic_name_value,

    lv_key type string,

    lt_data type crmt_ic_5x_param_value_tab,

    lv_error_message TYPE string.

    check p_samsid is not initial.

    check gv_return_object_key is not initial.

    * Callback to WebUI Client via SAM Handler ZCL_CRM_IC_SSC_SET_OBJECT

    lv_key = p_samsid.

    lv_key = cl_sam_session_queue_registry=>get_queue( key = lv_key ).

    try.

    * create request object

    create object lr_request

    type cl_crm_ic_5x_ws_request.

    lr_request->set_session_key( lv_key ).

    lr_request->set_class_name( 'ZCL_CRM_IC_SSC_SET_OBJECT' ).

    * set properties

    ls_property-name = 'OBJECT_KEY'.

    ls_property-value = gv_return_object_key.

    append ls_property to lt_properties.

    ls_property-name = 'OBJECT_TYPE'.

    ls_property-value = gs_borident-objtype.

    append ls_property to lt_properties.

    ls_property-name = 'OBJECT_LOGICSYS'.

    ls_property-value = p_logsys.

    append ls_property to lt_properties.

    lr_request->set_properties( lt_properties ).

    * send request for processing

    create object lr_processor

    type cl_crm_ic_5x_ws_processor.

    try.

    lr_processor->send_request( lr_request ).

    catch cx_sam_messaging_exception.

    lv_error_message = 'SAM_ERROR'.

    endtry.

    * get response

    lr_response = lr_processor->get_response( ).

    lt_data = lr_response->get_response( ).

    create object lr_param_obj

    type cl_crm_ic_5x_ws_param_value.

    lr_param_obj->set_params( lt_data ).

    call method lr_param_obj->get_param_value

    EXPORTING

    iv_name = cl_crm_ic_5x_ws_const=>gc_error_message

    IMPORTING

    ev_value = lv_error_message.

    catch cx_root.

    endtry.

    ENDFORM. " CALLBACK_VIA_SAM

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 25

    CRM 7.0 only: Implement class ZCL_CRM_IC_SSC_SET_OBJECT Add interface IF_CRM_IC_5X_WS_COMP_HANDLER:

    Add the following attributes, whereas GT_LOGIC_SYS type TABLE of TBDLS:

    Implement the following methods:

    Method IF_CRM_IC_5X_WS_COMP_HANDLER~GET_INSTANCE:

    method IF_CRM_IC_5X_WS_COMP_HANDLER~GET_INSTANCE.

    IF NOT gr_self IS BOUND.

    CREATE OBJECT gr_self.

    ENDIF.

    rv_result = gr_self.

    endmethod.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    26 December 12

    Method IF_CRM_IC_5X_WS_COMP_HANDLER~GET_PROPERTY_NAMES:

    method IF_CRM_IC_5X_WS_COMP_HANDLER~GET_PROPERTY_NAMES.

    IF gt_properties IS INITIAL.

    APPEND GC_OBJECT_KEY TO gt_properties.

    APPEND GC_OBJECT_TYPE TO gt_properties.

    APPEND GC_OBJECT_LOGICSYS TO gt_properties.

    ENDIF.

    rt_result = gt_properties.

    endmethod.

    Method IF_CRM_IC_5X_WS_COMP_HANDLER~HANDLE:

    METHOD if_crm_ic_5x_ws_comp_handler~handle.

    DATA: lr_sam_message TYPE REF TO if_sam_object_message,

    lr_context_area TYPE REF TO cl_crmcmp_i_cucohiddenvie_impl,

    lv_object_type TYPE string,

    lv_object_logicsys TYPE string,

    lv_object_key TYPE string,

    lv_logic_sys TYPE logsys,

    lv_obj_logsys TYPE logsys,

    lr_clipboard TYPE REF TO if_crm_ui_bol_clipboard,

    lr_so TYPE REF TO cl_crm_bol_entity,

    lt_data TYPE crmt_ic_5x_param_value_tab,

    lv_msg_v1 TYPE symsgv,

    lr_param_obj TYPE REF TO if_crm_ic_5x_ws_param_value,

    lr_msg_class TYPE REF TO cl_crm_ic_5x_ws_msg_srv,

    lv_error_message TYPE string,

    lv_obj_key TYPE swo_typeid,

    lv_bor_obj_type TYPE swo_objtyp,

    own_system TYPE logsys,

    lv_link_possible TYPE abap_bool VALUE abap_false.

    lr_msg_class = cl_crm_ic_5x_ws_msg_srv=>get_instance( ).

    lr_sam_message ?= cv_message.

    TRY .

    lv_object_type = lr_sam_message->get_string_property( gc_object_type ).

    lv_bor_obj_type = lv_object_type .

    lv_object_key = lr_sam_message->get_string_property( gc_object_key ).

    lv_obj_key = lv_object_key.

    lv_object_logicsys = lr_sam_message->get_string_property( gc_object_logicsys ).

    lv_obj_logsys = lv_object_logicsys.

    CATCH cx_root .

    ENDTRY.

    *Get the local logic system

    CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

    IMPORTING

    own_logical_system = own_system

    EXCEPTIONS

    own_logical_system_not_defined = 1

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 27

    OTHERS = 2.

    IF sy-subrc 0 OR own_system IS INITIAL.

    "file error message.

    lv_error_message = 'No logical system maintained in CRM'.

    ENDIF.

    IF lv_error_message IS INITIAL.

    IF lv_object_logicsys IS NOT INITIAL AND lv_object_logicsys own_system.

    CALL METHOD get_erp_object

    EXPORTING

    iv_object_key = lv_obj_key

    iv_bor_obj_type = lv_bor_obj_type

    iv_logic_sys = lv_obj_logsys

    IMPORTING

    er_entity = lr_so

    ev_error_message = lv_error_message.

    ELSE.

    CALL METHOD get_crm_object

    EXPORTING

    iv_object_key = lv_obj_key

    iv_bor_obj_type = lv_bor_obj_type

    iv_logic_sys = lv_obj_logsys

    IMPORTING

    er_entity = lr_so

    ev_error_message = lv_error_message.

    ENDIF.

    ENDIF.

    IF lr_so IS BOUND.

    lv_link_possible = me->entity_2_ac_check( iv_entity = lr_so ).

    IF lv_link_possible = abap_true.

    lr_clipboard = cl_crm_ui_bol_clipboard_srv=>get_instance( ).

    IF lr_clipboard IS BOUND.

    CALL METHOD lr_clipboard->add_root_object

    EXPORTING

    ir_root_entity = lr_so.

    ENDIF.

    ELSE.

    lv_msg_v1 = lv_bor_obj_type.

    CONCATENATE 'Object type' lv_msg_v1 'cannot be linked'

    INTO lv_error_message SEPARATED BY space.

    ENDIF.

    ENDIF.

    IF lv_error_message IS NOT INITIAL.

    " file error message

    CREATE OBJECT lr_param_obj TYPE cl_crm_ic_5x_ws_param_value.

    lr_param_obj->add_param_value(

    iv_name = cl_crm_ic_5x_ws_const=>gc_error_message

    iv_value = lv_error_message

    ).

    lt_data = lr_param_obj->get_params( ).

    TRY.

    lr_sam_message->set_object( lt_data ).

    CATCH cx_root.

    ENDTRY.

    ENDIF.

    CALL METHOD refresh_browser( ).

    ENDMETHOD.

    Method GET_ERP_OBJECT:

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    28 December 12

    method GET_ERP_OBJECT.

    DATA: lv_logic_sys TYPE logsys,

    lr_sam_message TYPE REF TO if_sam_object_message,

    lr_core TYPE REF TO cl_crm_bol_core,

    lr_factory TYPE REF TO cl_crm_bol_entity_factory,

    lt_pt TYPE crmt_name_value_pair_tab,

    ls_p TYPE crmt_name_value_pair,

    lt_data TYPE crmt_ic_5x_param_value_tab,

    lv_msg_v1 TYPE symsgv,

    lr_param_obj TYPE REF TO if_crm_ic_5x_ws_param_value,

    lr_msg_class TYPE REF TO cl_crm_ic_5x_ws_msg_srv,

    lr_property_access TYPE REF TO if_bol_bo_property_access,

    lr_nav_obj TYPE REF TO cl_crm_ui_navobject_bor.

    IF gt_logic_sys IS INITIAL .

    SELECT logsys FROM tbdls INTO lv_logic_sys.

    APPEND lv_logic_sys TO gt_logic_sys.

    ENDSELECT.

    ENDIF.

    CLEAR lv_logic_sys.

    READ TABLE gt_logic_sys WITH TABLE KEY logsys = iv_logic_sys INTO lv_logic_sys .

    IF sy-subrc IS NOT INITIAL.

    lv_msg_v1 = iv_logic_sys.

    lr_msg_class = cl_crm_ic_5x_ws_msg_srv=>get_instance( ).

    ev_error_message = lr_msg_class->get_message_text(

    iv_msg_id = 'CRM_IC_SSC_RFC'

    iv_msg_number = '001'

    iv_msg_v1 = lv_msg_v1

    ).

    RETURN.

    ENDIF.

    CREATE OBJECT lr_nav_obj

    EXPORTING

    iv_bor_object_type = iv_bor_obj_type

    iv_bor_object_key = iv_object_key

    iv_logical_system = iv_logic_sys.

    CALL METHOD lr_nav_obj->if_crm_ui_navigation_object~get_entity

    RECEIVING

    rr_result = lr_property_access.

    IF lr_property_access IS BOUND.

    er_entity ?= lr_property_access.

    RETURN.

    ENDIF.

    lr_core = cl_crm_bol_core=>get_instance( ).

    lr_factory = lr_core->get_entity_factory( cl_crm_ic_bor_wrapper=>gc_borwrapper_name ).

    ls_p-name = cl_crm_ic_bor_wrapper=>param_object_key.

    ls_p-value = iv_object_key .

    APPEND ls_p TO lt_pt.

    ls_p-name = cl_crm_ic_bor_wrapper=>param_object_type.

    ls_p-value = iv_bor_obj_type .

    APPEND ls_p TO lt_pt.

    ls_p-name = cl_crm_ic_bor_wrapper=>param_logical_system.

    ls_p-value = iv_logic_sys.

    APPEND ls_p TO lt_pt.

    er_entity = lr_factory->create( lt_pt ).

    endmethod.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 29

    Method GET_CRM_OBJECT:

    method GET_CRM_OBJECT.

    DATA: lv_msg_v1 TYPE symsgv,

    lv_msg_v2 TYPE symsgv,

    lv_msg_v3 TYPE symsgv,

    lv_object_key TYPE swo_typeid,

    lr_entity TYPE REF TO if_bol_bo_property_access,

    lr_msg_class TYPE REF TO cl_crm_ic_5x_ws_msg_srv,

    lr_nav_obj TYPE REF TO cl_crm_ui_navobject_bor.

    lv_object_key = iv_object_key.

    CREATE OBJECT lr_nav_obj

    EXPORTING

    iv_bor_object_type = iv_bor_obj_type

    iv_bor_object_key = lv_object_key

    iv_logical_system = iv_logic_sys.

    CALL METHOD lr_nav_obj->if_crm_ui_navigation_object~get_entity

    RECEIVING

    rr_result = lr_entity.

    er_entity ?= lr_entity.

    IF er_entity IS NOT BOUND.

    lv_msg_v3 = iv_logic_sys.

    lv_msg_v2 = iv_bor_obj_type.

    lv_msg_v1 = IV_OBJECT_KEY.

    lr_msg_class = cl_crm_ic_5x_ws_msg_srv=>get_instance( ).

    ev_error_message = lr_msg_class->get_message_text(

    iv_msg_id = 'CRM_IC_SSC_RFC'

    iv_msg_number = '002'

    iv_msg_v1 = lv_msg_v1

    iv_msg_v2 = lv_msg_v2

    iv_msg_v3 = lv_msg_v3

    ).

    ENDIF.

    endmethod.

    Method REFRESH_BROWSER:

    METHOD refresh_browser.

    DATA: lr_sam_message TYPE REF TO if_sam_text_message.

    DATA: lv_sam_agent_queue TYPE string.

    DATA: lr_sam_sender TYPE REF TO cl_sam_session_queue_sender.

    DATA: lv_session_id TYPE string,

    lv_text TYPE string.

    *get agent session queue

    lv_sam_agent_queue = cl_icwc_session_registry=>get_client_session_queue( ).

    * create sender object

    TRY.

    CREATE OBJECT lr_sam_sender

    TYPE

    cl_sam_session_queue_sender

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    30 December 12

    EXPORTING

    queue = lv_sam_agent_queue.

    CATCH cx_root.

    RETURN.

    ENDTRY.

    CHECK lr_sam_sender IS BOUND.

    * create message object

    CREATE OBJECT lr_sam_message TYPE cl_sam_text_message.

    * set message properties

    TRY.

    lv_session_id = cl_icwc_session_registry=>get_session_id( ).

    CHECK lv_session_id IS NOT INITIAL.

    lr_sam_message->set_string_property( name = 'session_id'

    value = lv_session_id ).

    lv_text = 'Refresh Browser'.

    lr_sam_message->set_string_property( name = 'SOURCE'

    value = lv_text ).

    lr_sam_message->set_string_property(

    name = 'icwc_eventname'

    value = 'com.sap.ic.bspinvoke' ).

    CATCH cx_sam_messaging_exception.

    ENDTRY.

    *send message to browser

    TRY.

    lr_sam_sender->send_to_client( message = lr_sam_message ).

    CATCH cx_root.

    ENDTRY.

    ENDMETHOD.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 31

    Method ENTITY_2_AC_CHECK:

    METHOD entity_2_ac_check.

    DATA: lr_mapping_srv TYPE REF TO cl_crm_ui_object_mapping_srv,

    lr_clip_cuco TYPE REF TO cl_crm_ui_f_cucoclipboard_impl,

    lt_cbentry TYPE TABLE OF crmc_ui_cbentry,

    lv_type TYPE bsp_dlc_object_type.

    FIELD-SYMBOLS: TYPE crmc_ui_cbentry.

    rv_link_possible = abap_false.

    lr_mapping_srv = cl_crm_ui_object_mapping_srv=>get_instance( ).

    CHECK lr_mapping_srv IS BOUND.

    CALL METHOD lr_mapping_srv->determine_ui_object_of_entity

    EXPORTING

    iv_entity = iv_entity

    RECEIVING

    rv_result = lv_type.

    CHECK lv_type IS NOT INITIAL.

    * get clipboard customizing

    lr_clip_cuco ?= cl_crm_ui_bol_clipboard_srv=>get_instance( ).

    lr_clip_cuco->get_customizing( IMPORTING et_cbentry = lt_cbentry ).

    READ TABLE lt_cbentry WITH KEY object_type = lv_type TRANSPORTING NO FIELDS.

    IF sy-subrc = 0.

    rv_link_possible = abap_true.

    ELSE.

    rv_link_possible = abap_false.

    ENDIF.

    ENDMETHOD.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    32 December 12

    Step 15: Use transaction SE80 to create transaction ZRR_BOR_INVOKE.

    After completing the last two steps, you can use the adapter transaction to test the BOR method invocation in a remotely connected SAP ERP system directly by executing transaction ZRR_BOR_INVOKE:

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 33

    5 Example After all 15 steps of configuration and implementation according to chapter 4 Implementation are executed, you can to process the scenario described in 2 Scenario Overview.

    5.1 Identify Account in WebClient UI

    The account is identified and the contact confirmed. The agent starts SAP GUI via Launch SAP GUI link in the navigation bar.

    5.2 Start Launch Transaction

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    34 December 12

    In case a SAP GUI session is open in the back end and not used, the SAP ERP business transaction is called without forcing login. In case there is no open SAP GUI session, the user has to log on.

    5.3 Create Sales Order in SAP GUI for Windows

    Enter all required details for the sales order and save it.

    After saving the sales order, the RFC session closes, but the SAP GUI session stays open.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 35

    5.4 Check Interaction Record in WebClient UI

    In the WebClient UI session, a new line entry representing the created sales order is displayed in the Interaction Record, in the assignment block Activity Clipboard.

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    36 December 12

    6 Debugging Tips

    This chapter contains some information on where to put break-points when debugging the scenario.

    Scenario Overview:

    ERP BackendCRM BackendAgent Session

    CRM BSPERP RFC

    Session

    CRM SAP

    GUI Session

    CRM

    WebClient

    Session

    1) Start URL based LTX

    2) Start SAP GUI

    via Shortcut Link

    return

    3) BOR Method Invoke

    4) HTTP Callback (SAM)

    1) Start URL based LTX

    In LTX Handler Class ZRR_CL_LTX_GUI4WIN, method

    IF_CRM_IC_ACTION_HANDLER~PREPARE_DATA_FLOW

    the Agent Session ID is determined and set via me->add_source_session( ).

    Agent Session ID is sourced from

    CL_ICWC_SESSION_REGISTRY=>S_AGENT_SESSION_ID via

    cl_icwc_session_registry=>get_agent_session_id( )

    All parameters are passed as URL parameter to BSP ZRR_LTX_GUI4WIN

    2) Start SAP GUI via Shortcut Link

    In BSP ZRR_LTX_GUI4WIN\Launch_ZRR_BOR_INVOKE.htm, OnCreate the execution of

    SAP GUI Shortcut is prepared. URL parameters are retrieved and converted into SAP

    Shortcut command parameters

    SAP Shortcut command calls transaction ZRR_BOR_INVOKE with parameters

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 37

    3) BOR Method Invoke & return

    In program ZRR_BOR_INVOKE the BOR method (e.g. BUS2032, CREATE) is invoked

    utilizing RFC functions SWO_CREATE, SWO_INVOKE.

    Function SWO_OBJECT_ID is returning object key resulting from BOR method execution

    (e.g. Sales Order ID).

    Function SWO_FREE is used for cleanup

    Finally callback into CRM WebUI Agent Session is triggered in subroutine

    CALLBACK_VIA_SAM

    4) HTTP Callback (SAM)

    SAM session parameters (including AGENT_SESSION_ID) are set via

    cl_ssc_ic_callback=>set_source_session

    Method ADD_TO_IRECORD (CL_SSC_IC_CALLBACK) calls function

    CRM_IC_SSC_SET_OBJECTS_WRAP in SAM source system

    In Function CRM_IC_SSC_SET_OBJECTS_WRAP the Agent Session ID is converted into

    the Agent Session Queue (URL) via cl_sam_session_queue_registry=>get_queue

    In Function CRM_IC_SSC_SET_OBJECTS an IC Webservice

    (if_crm_ic_5x_ws_request) is sent to Agent Session Queue(URL)

    The request is handled within the Agent Session by

    CL_SAM_SESSION_QUEUE_CNTRLER->DO_REQUEST. Later event WebServiceEvent is

    raised via CL_CRM_IC_5X_WS_SAM_TO_EVENT-

    >IF_SAM_MESSAGE_LISTENER~ON_MESSAGE

    The WebServiceEvent is handled within the same session by CL_CRM_IC_SSC_SET_OBJECT->if_crm_ic_5x_ws_comp_handler~handle. Here the message load including object key is

    processed and update to Interaction Record is processed via lr_clipboard->add_root_object

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    38 December 12

    7 Alternative approaches

    7.1 Launch SAP GUI Windows Transaction via SAP NetWeaver Portal

    If you are running a SAP NetWeaver Portal you can utilize the Application Integrator which allows you to integrate different back end systems in the Portal UI.

    There is community project ZAPP_INTEGRATOR published in the SAP Community Network (SCN) demonstrating the launch of SAP GUI for windows in a BSP Application via Application Integrator.

    CRM BSPERP RFC

    Session

    CRM SAP

    GUI Session

    WebClient UI

    Session

    Start URL Based LTX

    Start Adapter Transaction

    in SAP GUI Windows

    via EP Application Integrator

    Return

    RFC

    BOR Method Invoke

    HTTP Callback (SAM)

    http://wiki.sdn.sap.com/wiki/display/ABAP/ZAPP_INTEGRATOR

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 39

    7.2 Call ERP Transactions via RFC Function modules instead of using BOR Method Invokation

    If you have custom transactions which cannot be started via BOR Method invocation, additional effort is necessary to create a custom business object and to implement the mandatory methods.

    Alternatively, you can implement an RFC-enabled function module which wraps the custom ERP transaction. This can be called from the CRM adapter transaction.

    CRM BSPERP RFC

    Session

    CRM SAP

    GUI Session

    WebClient UI

    Session

    Start URL Based LTX

    Start Adapter Transaction

    in SAP GUI Windows

    via Shortcut Link

    Return

    RFC

    Custom Transaction

    HTTP Callback (SAM)

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    40 December 12

    7.3 Launch SAP GUI Windows – no Callback required

    Some scenarios may not need a callback into the WebClient UI session update from the ERP transaction.

    In this case there is no need to implement the adapter transaction.

    There is a wiki published in the SAP Community Network (SCN) demonstrating launching SAP GUI Windows transactions from the WebClient UI.

    CRM BSP ERP SessionWebClient UI

    Session

    Start URL Based LTX

    Start SAP GUI Windows

    Transaction via SAP Shortcut

    http://wiki.sdn.sap.com/wiki/display/CRM/CRM+WebUI+-+Launching+transactions+in+GUI+for+Windows

  • Development & Extension Guide: Launch SAP GUI Transaction from WebClient UI

    December 12 41

    8 Further hints

    8.1 Security warning messages When SAP Shortcut is opening the SAP GUI connection in the browser a security popup window is shown. Use the following notes to prevent this allow/deny dialog:

    Note 1559107 - SAP GUI Security Confirmation Each Time When Using Shortcut

    Note 1630673 - Always Allow/Deny not Available in SAP GUI Security Popup

    Note 1689016 - User Decisions (Allow/Deny) are not persisted/remembered

    8.2 Using Single Sign On When SAP Shortcut is opening the SAP GUI connection the user has to logon to the backend system. This is because the generated shortcut does not contain any user / password information. To prevent logon add the backend system to SAP Logon connections and activate ‘Secure Network Communication’ on each user client.

    8.3 Veto handling In standard there is the possibility to provide error message to agents if they select End when a launch transaction is still open. This concept is not available when using the documented example.

    8.4 Multi Sessioning When working in multi sessioning enabled environment the update of the Interaction Record will fail in case the agent has switched into another session while ending the launch transaction.

    Update: As of note 1800650 this limitation has been resolved!