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 call a tcode with variant using ABAP code?

Former Member
0 Likes
6,618

Hi Experts,

I want to write an ABAP code to call a tcode using an existing variant and it should return the results of that  tcode to the current program.

This tcode is not a custom tcode. it is a standard tcode WE09, and it has a variant ABC.

In the report, i have to call WE09 using ABC variant and should get the results back (Idocs which are resulted in WE09 tcode).

Please help me on this.

1 ACCEPTED SOLUTION
Read only

archanapawar
Contributor
0 Likes
4,279

Hi Vijaya,

You can use SUBMIT report USING SELECTION-SET variant.

9 REPLIES 9
Read only

archanapawar
Contributor
0 Likes
4,280

Hi Vijaya,

You can use SUBMIT report USING SELECTION-SET variant.

Read only

0 Likes
4,279

but the same report is used for 2 tcodes WE09 and WE10.

if i use SUBMIT statement on that report, which tcode it will call among those two?

Read only

0 Likes
4,279

Hi Vijaya,

The parameters you pass will decide which tcode if called. So, if your variant is fixed, it will all desired program only. You need to try it out.

WE09 Search for IDocs by Content

WE10 Search for IDoc in Archive

Read only

0 Likes
4,279

Thanks a lot Archana and Buddhika for the helpful answer

If I want to get back the result of WE09 to the current program (i mean WE09 will return some Idocs, i want to get all the list of Idocs into an internal table), which statement should be used here?

Read only

0 Likes
4,279

Hi Vijaya,

You can use SUBMIT REPORT EXPORTING LIST TO MEMORY.

Refer below link for example.

http://wiki.scn.sap.com/wiki/display/Snippets/The+SUBMIT+statement+executes+a+report+from+within+a+r...

Read only

0 Likes
4,279

You can use SUBMIT with RETURN keyword.

Read only

former_member620069
Participant
0 Likes
4,279

Hi Vijaya,

PASS VARIANT NAME IN ''REUSE_ALV_VARIANT_SELECT '' AND

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

       I_CALLBACK_PROGRAM       = SY-REPID

       I_CALLBACK_PF_STATUS_SET = 'PF'

       I_CALLBACK_USER_COMMAND  = 'PICK'

*     I_CALLBACK_TOP_OF_PAGE   = ' '

       IS_LAYOUT                = LT_LAYO

       IT_FIELDCAT              = LT_FCAT

*      IT_SORT                  = LT_SORTINFO

     TABLES

       T_OUTTAB                 = LT_FINAL.



FORM PICK USING COMM LIKE SY-UCOMM SEL TYPE SLIS_SELFIELD.

   DATA: V_IND TYPE SY-TABIX.

   CASE COMM.

     WHEN '&IC1

     read table........

CALL TRANSACTION''

      ENDCASE.

Read only

buddhika_krishantha
Active Participant
0 Likes
4,279
  1. First get programme name.
  2. Use following syntax.

          SUBMIT <programname> using SELECTION-SET 'ABC'.

Read only

Former Member
0 Likes
4,279

Hi

Any problem with set paratmer and call transaction combinations?

If on the selection screen of WE09, the field have no parameter id, then you can using

'call transaction using bdc_tab', detail grammar please refer F1.

And the return result, you can use class 'cl_salv_bs_runtime_info' to get.

regards,

Archer.