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: 

calling another program

Former Member
0 Kudos
91

Hi Experts ,

I want to call a program from another program . i want to get the internal table from that program ,process it and then i want to return back the internal table to that program . Can anyone help me how to overcome this ?

Points will be assured .

Thanks ,

Senthil .

1 ACCEPTED SOLUTION

vikram_maduri2
Explorer
0 Kudos
65

Hi Senthil,

first of all create one subroutine in program1 with syntax :

DATA : BEGIN OF ITAB OCCURS 2,

MATNR TYPE MARA-MATNR,

END OF ITAB.

&----


*& Form f1

&----


  • text

----


  • -->ITAB text

----


FORM F1 TABLES ITAB.

SELECT MATNR FROM MARA INTO TABLE ITAB.

ENDFORM. "f1

then goto program 2 and call that subroutine which u have created in program 1 with syntax :

DATA : BEGIN OF ITAB OCCURS 2,

MATNR TYPE MARA-MATNR,

END OF ITAB.

PERFORM F1(ZTESTPAD2) TABLES ITAB.

thats it.................

if helpful then please reward me some points.

Regards,

Vikram.M

5 REPLIES 5

Former Member
0 Kudos
65

hi,

use SUBMIT .

eg:

*Code used to populate 'select-options' & execute report  
DATA: seltab type table of rsparams,
      seltab_wa like line of seltab.

  seltab_wa-selname = 'PNPPERNR'.
  seltab_wa-sign    = 'I'.
  seltab_wa-option  = 'EQ'.

* load each personnel number accessed from the structure into
* parameters to be used in the report
  loop at pnppernr.
    seltab_wa-low = pnppernr-low.
    append seltab_wa to seltab.
  endloop.
  SUBMIT zreport with selection-table seltab
                                via selection-screen.

*Code used to populate 'parameters' & execute report

SUBMIT zreport with p_param1 = 'value'
                with p_param2 = 'value'.

Other additions for SUBMIT

*Submit report and return to current program afterwards 
 SUBMIT zreport AND RETURN.

*Submit report via its own selection screen 
 SUBMIT zreport VIA SELECTION-SCREEN

.

*Submit report using selection screen variant
 SUBMIT zreport USING SELECTION-SET 'VARIANT1'.

*Submit report but export resultant list to memory, rather than 
*it being displayed on screen
 SUBMIT zreport EXPORTING LIST TO MEMORY.
*  Once report has finished and control has returned to calling 
*  program, use function modules LIST_FROM_MEMORY, WRITE_LIST and 
*  DISPLAY_LIST to retrieve and display report.

Regards

Reshma

former_member2382
Active Participant
0 Kudos
65

Hi,

you can do this way..

SUBMIT rguslsep EXPORTING LIST TO MEMORY AND RETURN

WITH ledger = p_rldnr

WITH satzart = p_rrcty

WITH version = p_rvers

WITH company = p_rcomp

WITH jahr = p_ryear.

Regards

Parvez.

vikram_maduri2
Explorer
0 Kudos
66

Hi Senthil,

first of all create one subroutine in program1 with syntax :

DATA : BEGIN OF ITAB OCCURS 2,

MATNR TYPE MARA-MATNR,

END OF ITAB.

&----


*& Form f1

&----


  • text

----


  • -->ITAB text

----


FORM F1 TABLES ITAB.

SELECT MATNR FROM MARA INTO TABLE ITAB.

ENDFORM. "f1

then goto program 2 and call that subroutine which u have created in program 1 with syntax :

DATA : BEGIN OF ITAB OCCURS 2,

MATNR TYPE MARA-MATNR,

END OF ITAB.

PERFORM F1(ZTESTPAD2) TABLES ITAB.

thats it.................

if helpful then please reward me some points.

Regards,

Vikram.M

Former Member
0 Kudos
65

hi,

you can use submit <program name> with <select-options> and return.

Reward with points if helpful.

Former Member
0 Kudos
65

HI,

see this example.

program1.

REPORT ZEXAMPLE10.

tables:mara.

select-options:matnr for mara-matnr.

submit zexample11 with i_matnr in matnr and return.

program2.

REPORT ZEXAMPLE11.

tables:mara.

select-options:i_matnr for mara-matnr.

select * from mara where matnr in i_matnr.

write:/ mara-matnr.

endselect.

check this code this will b helpful.

Regards,

Kumar.