Application Development 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: 

ABAP- Call Tcode itself

Former Member
0 Kudos

Hi experts

I have a program in ABAP with many screens that

one of the screens is my main screen.it means i call other

screens from that screen.

now i want to start this program(or actuly the tcode)

in new session.

suppose my main screen is  0200  and there is other screen 0300

and I assigned tcode   zt100 to program.

I want to open   zt100 in new session

if user click on one button in screen 0300.

please help me how can do it.

regards ,

Reza Rostami

1 ACCEPTED SOLUTION

anilkumar_kalkivai
Active Participant
0 Kudos

Hi Reza,

Use FM: ABAP4_CALL_TRANSACTION

with Addition STARTING NEW TASK and DESTINATION NONE.

Sample Code:


DATA: msg_text(80) TYPE c, "Message text

      itab_spa TYPE STANDARD TABLE OF rfc_spagpa,

      wa_spa   TYPE rfc_spagpa.

* Fill out parameters

wa_spa-parid = 'AUN'.

wa_spa-parval = '0006012345'.

APPEND wa_spa TO itab_spa.

* Create a new session

* Asynchronous call to Transaction VA03 -->

CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'SORD'

  DESTINATION 'NONE'

  EXPORTING

      tcode = 'VA03'

      skip_screen = 'X'

  TABLES

      spagpa_tab = itab_spa

  EXCEPTIONS

    communication_failure = 1 MESSAGE msg_text

    system_failure        = 2 MESSAGE msg_text.

IF sy-subrc NE 0.

  WRITE: msg_text.

ELSE.

  WRITE: 'SCN.SAP.COM'.

ENDIF.

Regards,

Anil.


5 REPLIES 5

former_member188827
Active Contributor
0 Kudos

try using FM:"ABAP4_CALL_TRANSACTION". Please refer to following links:

https://scn.sap.com/thread/584508

https://scn.sap.com/thread/23574

Regards

0 Kudos

Hi

using this function i can call for example MM01 from my program but as i said i need to call tcode z100 while i am i this tcode.it means calling a tcode from one of its screens.

reza

Former Member
0 Kudos

Hi reza,

Use:-

CALL FUNCTION  ABAP4_CALL_TRANSACTION  STARTING NEW TASK

       EXPORTING

         tcode                         = ' '.

You can check this function module in detail.

anilkumar_kalkivai
Active Participant
0 Kudos

Hi Reza,

Use FM: ABAP4_CALL_TRANSACTION

with Addition STARTING NEW TASK and DESTINATION NONE.

Sample Code:


DATA: msg_text(80) TYPE c, "Message text

      itab_spa TYPE STANDARD TABLE OF rfc_spagpa,

      wa_spa   TYPE rfc_spagpa.

* Fill out parameters

wa_spa-parid = 'AUN'.

wa_spa-parval = '0006012345'.

APPEND wa_spa TO itab_spa.

* Create a new session

* Asynchronous call to Transaction VA03 -->

CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'SORD'

  DESTINATION 'NONE'

  EXPORTING

      tcode = 'VA03'

      skip_screen = 'X'

  TABLES

      spagpa_tab = itab_spa

  EXCEPTIONS

    communication_failure = 1 MESSAGE msg_text

    system_failure        = 2 MESSAGE msg_text.

IF sy-subrc NE 0.

  WRITE: msg_text.

ELSE.

  WRITE: 'SCN.SAP.COM'.

ENDIF.

Regards,

Anil.


0 Kudos

Hi experts

Thank you all. my problem was solved.

but let me say that as I understood this FM works properly if the start screen  of TCODE is a dialog

screen(not a selection screen)

REZA ROSTAMI