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.