Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to create a new session by coding.

Former Member
0 Likes
1,853

Hi ,

Can anybody tell me how to generate a new session by Coding.

Its my requiement

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,330

Simply calling this function module will fire another frontend session.

call function 'TH_CREATE_FOREIGN_MODE'
  exporting
    client                 = sy-mandt
    user                   = sy-uname.

Regards,

Rich Heilman

11 REPLIES 11
Read only

Former Member
0 Likes
1,330

You mean BDC Session?

If yes call FM BDC_OPEN_GROUP

If not,

call transaction 'SESSION_MANAGER'

Eswar Kanakanti

Read only

rahulkavuri
Active Contributor
0 Likes
1,330

https://forums.sdn.sap.com/click.jspa?searchID=783965&messageID=1847407

u can use FM HLP_MODE_CREATE

if u are talking about a BDC session then u can use

bdc_open_group

bdc_insert

bdc_close_group

award points if found helpful

Read only

Former Member
0 Likes
1,330

Hi,

check out this function module:

'SAPGUI_SET_FUNCTIONCODE'.

Ashven

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,331

Simply calling this function module will fire another frontend session.

call function 'TH_CREATE_FOREIGN_MODE'
  exporting
    client                 = sy-mandt
    user                   = sy-uname.

Regards,

Rich Heilman

Read only

0 Likes
1,330

Hi Guys,

Thanks for the prompt reply,

I mean that I have requirement that when the user Clicks on the button then a new Session opens up and inside that session TCode: IW52 executes.

not BDC like things.

I want to open one new session of the Transaction Code: IW52

Read only

0 Likes
1,330

see it this helps.

- Guru

Read only

0 Likes
1,330

Thanks Rich,

I can create a new session, But how could i execute a new transaction(TCode: IW52) on the new session.

Read only

0 Likes
1,330

Ok, try this.



call function 'TH_CREATE_FOREIGN_MODE'
  exporting
    client                 = sy-mandt
    user                   = sy-uname
    tcode                  = 'IW52'.

Regards,

Rich Heilman

Read only

0 Likes
1,330

and now afterwards i want to skip the first screen of this transaction. Then how would i do

Read only

0 Likes
1,330

You are really making me earn it today, huh? In order to do that, we have to use another function module and say STARTING NEW TASK.



report zrich_0001 .

data: ipid type table of RFC_SPAGPA.
data: xpid type RFC_SPAGPA.



xpid-PARID = 'IQM'.
xpid-parval = '00010004'.  "<- Whatever value you want
append xpid to ipid.

call function 'ABAP4_CALL_TRANSACTION'
 starting new task 'TestTask'
  exporting
    tcode                         = 'IW52'
    SKIP_SCREEN                   = 'X'
*   MODE_VAL                      = 'A'
*   UPDATE_VAL                    = 'A'
* IMPORTING
*   SUBRC                         =
  TABLES
*   USING_TAB                     =
    SPAGPA_TAB                    = ipid
*   MESS_TAB                      =
* EXCEPTIONS
*   CALL_TRANSACTION_DENIED       = 1
*   TCODE_INVALID                 = 2
*   OTHERS                        = 3
          .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

Regards,

Rich Heilman

Read only

0 Likes
1,330

Thanks alot <b>Rich</b>,

Thats your speciality to solve any problem of any extent. Full Credit to you

Thanks alot