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

SUBMIT AND RETURN

Former Member
0 Likes
1,107

I am calling a program Y from my program X. In my program Y i am populating an internal table which should be available when I return to the calling program X. I am using the SUBMIT AND RETURN for this purpose. But the internal table which i populated in the program Y is not available when i return to the program X. Could anyone tell me why this happens?

11 REPLIES 11
Read only

Former Member
0 Likes
1,085

You can use EXPORT and IMPORT to achieve the same.

Regards

Kannaiah

Read only

0 Likes
1,085

Hi

Use Export in your y program and thenmport it in X program it will work .

Regards'

Hitesh

Read only

Former Member
0 Likes
1,085

Hi,

Use EXPORT and IMPORT

for detail concept check

http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9df735c111d1829f0000e829fbfe/content.htm

or GET PARAMETER ID and SET PARAMETER ID statement.

For detail check

http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9e0435c111d1829f0000e829fbfe/content.htm

Regards,

anirban

Read only

Former Member
0 Likes
1,085

Hi,

use the statement in program Y

Export <internal table> TO memory id 'ABC'.

and in program X.... import the same

Import <internal table> FROM memory id 'ABC'.

use the same internal table name

regards

padma

Edited by: Padmavathi Palli on Aug 19, 2008 8:04 AM

Read only

rainer_hbenthal
Active Contributor
0 Likes
1,085

If both are your own reports (Z-Reports) better do a redesign. Put the functionality into a function module or a class/method which serves both of your report.

Read only

bpawanchand
Active Contributor
0 Likes
1,085

HI

[Sample Code|http://www.sapdevelopment.co.uk/reporting/rep_submit.htm]

Regards

Pavan

Read only

Former Member
0 Likes
1,085

Sorry. duplicate post.

Edited by: Kannaiah Kavuri on Aug 19, 2008 11:37 AM

Read only

Former Member
0 Likes
1,085

Hi,

In this case you are calling the Y program and executing the the Functionality of the called program and returnig back to calling program but you are not passing any table to the calling program.

For this you can use EXPORT to MEMORY In the called program(Y) and IMPORT from MEMORY in the Calling program(X).

For details just write Export in the editior and Press F1 in placing the cursor on the keyword.

Regards,

Sujit

Read only

Former Member
0 Likes
1,085

Hi Dinesh,

Check out this sample code:

http://www.sapdevelopment.co.uk/reporting/rep_submit.htm

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
1,085

Hi,

Check these two sample programs

Here I'm sending t_spfli table to memory id abc in program z_abap_memory1. then from z_abap_memory1 program, I'm sending t_flight table back to program z_abap_memory.

PROGRAM 1


REPORT  z_abap_memory.
DATA:
  w_carrid TYPE spfli-carrid,
  BEGIN OF fs_spfli,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    fltime LIKE spfli-fltime,
  END OF fs_spfli.

DATA:
  BEGIN OF fs_flight,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
  END OF fs_flight.

DATA:
  t_flight LIKE
     TABLE OF
           fs_flight.

DATA:
  t_spfli LIKE
    TABLE OF
          fs_spfli.

SELECT-OPTIONS:
  s_carrid FOR w_carrid.

START-OF-SELECTION.
  PERFORM get_spfli.
  PERFORM disp_spfli.

AT LINE-SELECTION.
  IF sy-lsind EQ 1.
    EXPORT t_spfli TO MEMORY ID 'ABC'.
    SUBMIT z_abap_memory1 AND RETURN.
    IMPORT t_flight FROM MEMORY ID 'XYZ'.
    LOOP AT t_flight INTO fs_flight.
      WRITE: / fs_flight-carrid,
               fs_flight-connid,
               fs_flight-fldate.
    ENDLOOP.
  ENDIF.

END-OF-SELECTION.
  PERFORM disp_spfli.
*&---------------------------------------------------------------------*
*&      Form  get_spfli
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_spfli .
  SELECT carrid
         connid
         fltime
    FROM spfli
    INTO TABLE t_spfli
   WHERE carrid IN s_carrid.

ENDFORM.                    " get_spfli
*&---------------------------------------------------------------------
*
*&      Form  disp_spfli
*&---------------------------------------------------------------------
*
*       text
*----------------------------------------------------------------------
*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------
*
FORM disp_spfli .
  LOOP AT t_spfli INTO fs_spfli.
    WRITE: / fs_spfli-carrid,
             fs_spfli-connid,
             fs_spfli-fltime.
       HIDE:
    fs_spfli-carrid,
    fs_spfli-connid.  
ENDLOOP.

ENDFORM.                    " disp_spfli

PROGRAM 2


REPORT  z_abap_memory1.

DATA:
  BEGIN OF fs_spfli,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    fltime LIKE spfli-fltime,
  END OF fs_spfli,
  fs_fl LIKE fs_spfli.
DATA:
  BEGIN OF fs_flight,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
  END OF fs_flight.

DATA:
  t_spfli LIKE
    TABLE OF
          fs_spfli.

DATA:
  t_fl LIKE t_spfli.

DATA:
  t_flight LIKE
     TABLE OF
           fs_flight.

IMPORT t_spfli FROM MEMORY ID 'ABC'.
t_fl = t_spfli.

SELECT carrid
       connid
       fldate
  FROM sflight
  INTO TABLE t_flight
  FOR ALL ENTRIES IN t_spfli
 WHERE carrid = t_spfli-carrid
   AND connid = t_spfli-connid.

EXPORT t_flight TO MEMORY ID 'XYZ'.

Regards

Abhijeet

Read only

Former Member
0 Likes
1,085

Answered