Google Search - Blog...........

ABAP - Calling A Transaction In New Session (Window).

Description :

In SAP Dialog Programming we call transactions using the CALL TRANSACTION statement but it opens up the new Tcode in the same session. Is there any option in CALL TRANSACTION Statement to open a transaction in New Session(window) No ! . But there is a way in which we can attain the same result , its by using the CALL TRANSACTION Statement inside a Remote-Enabled Function Module and then using the STARTING NEW TASK addition while calling the
Function Module.

Creating a Remote-Enabled Function module

Its just the same procedure as of ordinary Function module, but in the Attributes Tab, under Processing Type you have to select Remote-Enabled Module instead of Normal Function Module.



Example :
ZFM_CALL_TCODE_IN_NEW_WINDOW
FUNCTION ZFM_CALL_TCODE_IN_NEW_WINDOW.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(TCODE) TYPE SY-TCODE
*" VALUE(SONO) TYPE VBELN
*"----------------------------------------------------------------------
SET PARAMETER ID 'AUN' FIELD SONO.
CALL TRANSACTION tcode AND SKIP FIRST SCREEN.
ENDFUNCTION.

So How Can i call the Function Module to Open the Transaction in New Session
You have to use the following code segment to call that Function Module , and here Sales Document 9000000012 will open for Display in a New Session(Window).

/* E_tcode = 'VA03'.
E_SONO = '9000000012'
CALL FUNCTION 'ZFM_CALL_TCODE_IN_NEW_WINDOW' STARTING NEW TASK 'TEST'
DESTINATION 'NONE'
EXPORTING
tcode = E_tcode
sono = E_SONO. */
Hope the above snippet will be useful for all.

1 comment:

  1. Due to it will create new session after use option STARTING NEW TASK.
    How do you do if the session you are using is the last session ?
    That's mean STARTING NEW TASK is not applicable for this case, isn't it ?

    ReplyDelete