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 program

Former Member
0 Likes
750

hii,

I am submitting a program from my main program, now i want to pass a internal table from the submitted program to my main program..how to do that?? wats the syntax? plz help

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
722

Hi!

Use IMPORT and EXPORT statements, check this sample code

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:
  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.
  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.
  ENDLOOP.
  HIDE:
    fs_spfli-carrid,
    fs_spfli-connid.
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.


LOOP AT t_flight INTO fs_flight.
  WRITE: / fs_flight-carrid,
           fs_flight-connid,
           fs_flight-fldate.
ENDLOOP.

Regards

Abhijeet

7 REPLIES 7
Read only

Former Member
0 Likes
722

One way is to use IMPORT and EXPORT

take F1 on these commands and u will know.

There are used to send data from one program to another.

need further clarification pls ask.

Khusro Habib

Read only

Former Member
0 Likes
722

hi,

Use IMPORT/ EXPORT Statement.

In your main Program.

Submit <Called Program>

Import Table <itab> from memeory Id <mid>.

In your Called Program

Export Table <itab> to Memory Id <MId>.

Read the SAP help for Documentation.

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
723

Hi!

Use IMPORT and EXPORT statements, check this sample code

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:
  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.
  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.
  ENDLOOP.
  HIDE:
    fs_spfli-carrid,
    fs_spfli-connid.
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.


LOOP AT t_flight INTO fs_flight.
  WRITE: / fs_flight-carrid,
           fs_flight-connid,
           fs_flight-fldate.
ENDLOOP.

Regards

Abhijeet

Read only

Former Member
0 Likes
722

Hi Priya,

I think you can use export/import statements to store the data in memory id's within a single session.

After calling the program export the desired contents to a memory id and after in the main program import them.

I think this will solve your problem.

Thanks,

Anil.

Read only

Former Member
0 Likes
722

USE

EXPORT Table itab TO MEMORY ID 'KID' "Sender Program

then

IMPORT Table itab FROM MEMORY ID 'KID' "Receiving Program

rgds

rajesh

Read only

Former Member
0 Likes
722

Hi Priya,

If am right you are submitting

Report Programe 1.

Submit REPORT PROGRAME 2.

In Programe 2

where

submit ZTEST3 WITH FREE SELECTIONS texpr.

Passes dynamic selections.

texpr is an internal table of the type RSDS_TEXPR (see type pool RSDS).

You need to try not sure of the working of code.

Mohinder

Mohinder

Read only

Former Member
0 Likes
722

Hi,

try this below code.

wa_select-selname = 'S_WADAT'.

wa_select-kind = 'S'.

wa_select-sign = 'I'.

wa_select-option = 'EQ'.

wa_select-low = wa_ship-wadat.

APPEND wa_select TO i_select.

CLEAR wa_select.

SUBMIT zsdstu001 WITH SELECTION-TABLE i_select

AND RETURN.

regards,

bhupal.