How to Open SAP Transaction in New Window Or in New Session using ABAP cc_call_transaction_new_task Function Module
ABAP developers can use ABAP function module CC_CALL_TRANSACTION_NEW_TASK in order to execute and display an SAP transaction in a new window or in a new session.
Using cc_call_transaction_new_task, parameters can be set for the first screen of many SAP transactions like VA02 or VA03.
In this sample ABAP report, I will execute the main ABAP program and write a message on the SAP screen.
And using the ABAP function module cc_call_transaction_new_task with required VBELN parameter is set to a valid Sales Order nnumber, I will open a new SAP GUI screen and display the Sales Order using the VA03 SAP Transaction code.
Here is the source code of the sample SAP report used for demonstrating the cc_call_transaction_new_task ABAP function.
You can realize that while using CC_CALL_TRANSACTION_NEW_TASK function, we also use STARTING NEW TASK with an identifier.
Also we are defining the DESTINATION 'NONE' for the cc_call_transaction_new_task function.
Later, you can pass required parameters like transaction code, whether to skip first screen or not and additional parameters like VBELN number using the EXPORTING and TABLES sections of the function module.
REPORT zopennewwindow .
WRITE 'This is the main ABAP program'.
DATA :
lv_skip(1) TYPE c VALUE 'X',
lv_vbeln LIKE vbak-vbeln VALUE '1500000015',
l_st_param TYPE tpara,
l_it_params TYPE TABLE OF tpara.
CLEAR l_st_param.
CLEAR l_it_params[].
l_st_param-paramid = 'AUN'.
l_st_param-partext = lv_vbeln.
APPEND l_st_param TO l_it_params.
CALL FUNCTION 'CC_CALL_TRANSACTION_NEW_TASK'
STARTING NEW TASK 'VA03'
DESTINATION 'NONE'
EXPORTING
transaction = 'VA03'
skip_first_screen = 'X'
TABLES
paramtab = l_it_params
EXCEPTIONS
communication_failure = 97
system_failure = 98
OTHERS = 99.
IF sy-subrc = 0.
" Success
ELSEIF sy-subrc = 97.
" Communication Failure
EXIT.
ELSEIF sy-subrc = 98.
" System Failure
EXIT.
ELSE.
EXIT.
ENDIF.
I hope, as an ABAP developer you find this sample ABAP program useful for demonstrating cc_call_transaction_new_task function module to open new window and call the transaction code in the new session.
For a similar ABAP function, please refer to How to Display SAP Transaction in a New Session Or in New Window using ABAP4_Call_Transaction Function Module.