Wednesday, December 22, 2010

Calling transactions and reports using the Transaction Launcher

From CRM, you can call functions in other applications using the transaction launcher.
When calling a transaction in SAP ECC or when calling a SAPGUI transaction in SAP CRM, you will be using the ITS. The setup of the ITS is described here.

Calling reports or transactions is done using so-called BOR-Methods. BOR stands for Business Object Repository, and is one of the first object-oriented initiatives in SAP. The business object repository contains a wide variety of objects like 'businesspartner', 'activity', 'marketingcampaign' etc. Most Business objects in the BOR start with 'BUS', followed by a number.

The Objects of the Business Object Repository can be viewed using transaction SWO1 (not to be confused with SW01). In this transaction, you can view the standard BUS Objects, and if necessary create a new one containing your own coding.

Often used objects are REPORT and TSTC (which in the ERP system has to be copied to ZTSTC because the method has to be synchronous).

Maintenance of the transaction launcher is available in the IMG under Customer Relationship Management --> UI Framework --> Technical Role Definition --> Transaction Launcher --> Configure Transaction Launcher.
The wizard will guide you through the process.
In the first screen you enter an ID. This should start with a Z or Y.
In the field Component Set, you can enter value 'ALL'.
In the second screen you enter the Description and the class name.
The class name is important. When you finish the wizard, this class will be generated using the values you entered in the wizard. The class will be saved in collection $TMP. This means the generated class will not be transported to other systems.

This screen also contains two checkboxes. 
The stateful checkbox determines whether the called screen should open in a popup or embedded in the current screen. When you set the indicator, the screen will open as a popup.
The Raise Veto checkbox determines whether a message should be raised when the user navigates away from the page. At least, that's what the helpfile wants us to believe. In practice, the popup will unfortunately always be raised when calling a BOR Object, whether the Stateful and Raise Veto checkboxes are selected or not.

Once you have finished the wizard, you can take a look at the class in SE80. The class will contain a couple of important and less important methods.

Because the class isn't transported (because it's in $TMP), you can expect that the after transporting the customizing to the QAS and PRD, the system will automatically generate the class in the target system.

I have noticed that in some cases (I believe when you have changed your launch transaction customizing), it sometimes happens that the classes are not automatically generated in the target system. Due to this, your change will not take effect.

If this happens, just manually run the wizard in the QAS (or PRD). Even though the system tells you you are not allowed to change the customizing, it will regenerate the coding, and the change will be effective. You don't need to open customizing to do this.

4 comments:

  1. Hello Pieter! Great job you are doing here! Thanks!!

    About above topic I'd like to add that couple times I had to run a report SIAC_PUBLISH_ALL_INTERNAL to publish all internal services. It made WEBGUI (and transaction launcher) run properly. May be it should be done during instalation of the system, but... Anyway, think it'd be useful.

    ReplyDelete
  2. Hi Pieter,

    thank you for this wonderfull post (and it's related post: http://sapcrmweblog.blogspot.com/2011/01/extending-business-object-repository.html) about the transaction launcher and modification of the BOR in the ECC environment.

    What I would like to add to your blog; If you change the ZTSTC BOR object and you add new parameters to this particular execution method, you have to change the method IF_CRM_IC_ACTION_HANDLER~PREPARE_DATA_FLOW of the class you defined in the CRMC_UI_ACTIONWZ transaction too.

    In the standard generated code, the IC Web Client BOL component or the Web Client BOL component will be called. In here we can also find/lookup extra parameters and send those to ECC via:
    me->set_container_data(
    iv_name = 'YourCustomParameterName'
    iv_value = VariableOfYourCustomerParameter ).

    This can be fetched in ECC ZTSTC with the same methodology:
    swc_get_element container 'YourCustomParameterName' VariableOfYourCustomerParameter.

    This parameter also needs to be added to the EXECUTE_WITH_PARAMS method.

    Extra notes:
    Note 1: Create an extra method in the CRMC_UI_ACTIONWZ class for your custom developments; the IF_CRM_IC_ACTION_HANDLER~PREPARE_DATA_FLOW will be overwritten when you change something with the CRMC_UI_ACTIONWZ transaction. So, copy the automatic generated source, create a local private method named PREPARE_DATA_FLOW, and put in this code in the standard method:
    method IF_CRM_IC_ACTION_HANDLER~PREPARE_DATA_FLOW.

    me->prepare_data_flow( iv_use_portal ).

    endmethod.
    Paste the automatic generated source in your private method and alter this to your requirements.

    Note 2: If you have customized the automatic generated class, add the Class object to a package so it can be transported through your landscape. (Expert transport tool)

    Kind regards,

    Sander

    ReplyDelete
  3. Hi,

    Can you please explain me why TSTC Object should be set to synchronus.


    Best Regards,
    Raj

    ReplyDelete
  4. Hi Pieter, I am able to lanch the VF01 transaction from webui CRM , But I am want to open VF03 along with invoice document number . I am adding INVOICE NUMBER on opportunity header details, when I click on that it would open the VF03 transaction from ECC through webui. could you please provide some inputs?
    regards,Ram

    ReplyDelete