How to Display SAP Transaction in a New Session Or in New Window using ABAP4_Call_Transaction Function Module
Using ABAP function module ABAP4_CALL_TRANSACTION, ABAP developers can open SAP transaction in a new window or in a new session.
Using abap4_call_transaction, function module parameters can also be set for the SAP Transaction first screen.
So that SAP users can be directly navigated to SAP Transaction screens like VA02 or VA03.
In this sample ABAP program, a main ABAP report will execute and display a dummy message on the screen.
On the other hand, the ABAP function module abap4_call_transaction will work and by setting the required VBELN parameter which is the target sales document's number, the user will see the VA03 SAP transaction screen in front of him or her in a new window / new session.
Here is the ABAP report source code for the sample program.
REPORT ZOPENNEWWINDOW2 .
WRITE 'This is the main ABAP report calling the SAP Transaction VA03 in a new session or in a new window'.
DATA :
wa_spa TYPE rfc_spagpa,
itab_spa TYPE TABLE OF rfc_spagpa.
wa_spa-parid = 'AUN'.
wa_spa-parval = '1500000010'.
APPEND wa_spa TO itab_spa.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'VA03'
DESTINATION 'NONE'
EXPORTING
tcode = 'VA03'
skip_screen = 'X'
TABLES
spagpa_tab = itab_spa
EXCEPTIONS
communication_failure = 1
system_failure = 2.
IF sy-subrc <> 0.
" ERROR
ENDIF.
ABAP developers can find a similar ABAP function module cc_call_transaction_new_task which can be used to open new window and display SAP transaction with first screen parameters are passed.