When calling transactions using the ITS, you might run into the limitations of the Business Object Repository. The available objects and methods of the Business Object Repository can be found in transaction SWO1.
Often used objects to call transactions or reports using the ITS are TSTC and REPORT.
If you want to use TSTC, you will have to create a copy (like ZTSTC) of the standard TSTC
The execute method of the ZTSTC should be the same as the standard execute from TSTC, except that the checkbox 'synchronous' should be checked.
An often heard requirement is to forward parameters like the businesspartnernumber to the transaction. This unfortunately is not possible with the standard TSTC object. To work around this limitation, you can add a method to the ZTSTC called for instance ZEXECUTE_WITH_PARAM.
When defining the method, you should add 4 import parameters:
- Param1 type structure CPIDLIST
- Param2 type structure CPIDLIST
- Param3 type structure CPIDLIST
- Skipsc type BUTOOO-BP_EEW_DUMMY (or any other CHAR1 field).
The ABAP code in the method should be a copy of the TSTC-EXECUTE, but with some extra ABAP coding between the AUTHORITY_CHECK_TCODE and the CALL TRANSACTION OBJECT-KEY-CODE.
BEGIN_METHOD ZEXECUTE_WITH_PARAM CHANGING CONTAINER.
CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
tcode = OBJECT-KEY-CODE
ok = 0
not_ok = 1
others = 2.
IF sy-subrc NE 0.
MESSAGE s059(eu) WITH OBJECT-KEY-CODE.
lv_param1 TYPE CPIDLIST,
lv_param2 TYPE CPIDLIST,
lv_param3 TYPE CPIDLIST,
lv_skipscreen TYPE char1.
swc_get_element container 'param1' lv_param1.
swc_get_element container 'param2' lv_param2.
swc_get_element container 'param3' lv_param3.
swc_get_element container 'skipsc' lv_skipscreen.
IF lv_param1 IS NOT INITIAL.
SET PARAMETER ID: lv_param1-pid FIELD lv_param1-value.
IF lv_param2 IS NOT INITIAL.
SET PARAMETER ID: lv_param2-pid FIELD lv_param2-value.
IF lv_param3 IS NOT INITIAL.
SET PARAMETER ID: lv_param3-pid FIELD lv_param3-value.
IF lv_skipscreen IS INITIAL.
CALL TRANSACTION OBJECT-KEY-CODE.
CALL TRANSACTION OBJECT-KEY-CODE and skip first screen.
In the coding, the parameters are read, and forwarded to the parameter-id’s. Because the Parameters are defined as name-value-pairs, this is fully flexible.
As an example, if you would want to call transaction BP in ERP using the ZEXECUTE_WITH_PARAM, you would go ahead as follows:
1. Define the method as described above.
3. Create a transaction launch definition in SAP CRM using the transaction launcher wizard (CRMC_UI_ACTIONWZ).