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‘
EXPORTING
tcode = OBJECT-KEY-CODE
EXCEPTIONS
ok = 0
not_ok = 1
others = 2.
IF sy-subrc NE 0.
MESSAGE s059(eu) WITH OBJECT-KEY-CODE.
ELSE.
DATA:
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.
ENDIF.
IF lv_param2 IS NOT INITIAL.
SET PARAMETER ID: lv_param2-pid FIELD lv_param2-value.
ENDIF.
IF lv_param3 IS NOT INITIAL.
SET PARAMETER ID: lv_param3-pid FIELD lv_param3-value.
ENDIF.
IF lv_skipscreen IS INITIAL.
CALL TRANSACTION OBJECT-KEY-CODE.
ELSE.
CALL TRANSACTION OBJECT-KEY-CODE and skip first screen.
ENDIF.
ENDIF.
END_METHOD.
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.
2. Check the ParameterID of the field you want to add the parameter to.
3. Create a transaction launch definition in SAP CRM using the transaction launcher wizard (CRMC_UI_ACTIONWZ).
4 responses to “Extending the Business Object Repository”
Hi Pieter,
For an object like BUS2000111 (CRM Opportunity).
If I want to make a ZBUS…
Do I do that within SWO1? If so do I just do a copy of it ?
Found out I need a subtype not a copy.
Thanks
At-times in certain transactions in ECC the Parameter id is missing for fields required to be defaulted when calling transaction from CRM . what should be the approach in such scenarios?
Please help.
Hi,
Why TSTC BOR Object should be set to synchronous.
Best Regards,
Raj