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

Passing an internal to another program using SUBMIT

pankajs_dwivedi
Participant
0 Likes
2,105

Hi,

I need to pass one internal table from one program to another which i am calling using SUBMIT. Is there any way to pass this data without using export/import or selection screen.

If i do use EXPORT is there a retriction to the maximum size i can export?

Thanks

7 REPLIES 7
Read only

Former Member
0 Likes
1,411

nope there is no restriction to the size of the internal table that we export to memory id. memory id is the best way...

Regards,

Vijay

Read only

Former Member
0 Likes
1,411

u will get this exception if data is too large

Catchable Exceptions

CX_SY_EXPORT_BUFFER_NO_MEMORY

Cause: The EXPORT data cluster is too large for the application buffer. With EXPORT TO SHARED BUFFER, this error should only rarely occur since the buffer uses a replacement procedure similar to the LRU (Least Recently Used) procedure. If the error occurs nevertheless, it could be useful to increase the profile parameter rsdb/obj/buffersize (see Profile Parameter Properties).

Runtime Error: EXPORT_BUFFER_NO_MEMORY (catchable)

Read only

0 Likes
1,411

Hi,

you can use TRY CATCH to catch the exception, if the data is large in internal table.

Regards

vijay

Read only

Former Member
0 Likes
1,411

you HAVE to use import/export or submit via selection screen there is no other alternative.(A far fetched alternative would be updating a ztable in prog1 and retrieving from it in prog2).

using selection screen.

in prog1

loop at itab.

r_matnr-sign = 'I'.

r_matnr-option = 'EQ'.

r_matnr-low = itab-matnr.

append r_matnr.

clear r_matnr.

endloop.

submit prog2 via selection-screen

with s_matnr in r_matnr and return.

in prog2

select-options: s_matnr for mara-matnr no-display.

loop at s_matnr.

itab-matnr = s_matnr-low.

append itab.

clear itab.

endloop.

Regards,

ravi

Read only

0 Likes
1,411

Here is some sample code for the IMPORT/EXPORT.

program.

report zkis1.

data: imara type table of mara with header line.

start-of-selection.

select * into table imara from mara up to 10 rows.

export imara to memory id 'YOURID'.

submit zkis2 and return.

The submitted program.

report zkis2 .

data: imara type table of mara with header line.

import imara from memory id 'YOURID'.

loop at imara.

write:/ imara-matnr.

endloop.

Read only

Former Member
0 Likes
1,411

Hi Pankaj,

Consider these two programs I have done using both WITH SELECTION-TABLE and IMPORT/EXPORT.

In Program 1(ZZTEST_ARUN_1).

I have two radio buttons. If I select Material the program executes its own code. If I select plant data is fetched and exported to memory. Then it gets the selection parameters of the Program 2(ZZTEST_ARUN_2) through the FM RS_REFRESH_FROM_SELECTOPTIONS. Then I populate the values for selection screen and pass using the

SUBMIT....WITH SELECTION-TABLE option.

REPORT zztest_arun_1.
  TABLES: t001w.
  DATA : it_marc TYPE STANDARD TABLE OF marc WITH HEADER LINE,
         it_werks TYPE STANDARD TABLE OF t001w WITH HEADER LINE.
 
   PARAMETERS material RADIOBUTTON  GROUP  abc.     "Material General Details
 
   PARAMETERS plant RADIOBUTTON GROUP abc DEFAULT 'X'.      "Material Plant Details
 
   START-OF-SELECTION.
 
   IF material EQ 'X'.
   
*If Material selected own code executes   
 
    SELECT * FROM marc INTO TABLE it_marc UP TO 200 ROWS .
     LOOP AT it_marc.
 
     WRITE :/ it_marc-matnr,
            it_marc-werks.
     ENDLOOP.
 
   ENDIF.
 
  IF plant EQ 'X'.
 
*If Plant selected data fetched   
 
    SELECT * FROM t001w INTO TABLE it_werks UP TO 50 ROWS.
    
*Exported to Memory
    
    EXPORT it_werks[] TO MEMORY ID 'TEST'.
 
*Declare on selection table type RSPARAMS
 
    DATA :   stable	LIKE	rsparams OCCURS 0 WITH HEADER LINE.
 
*Call this FM to get the Selection screen details
*of Program ZZTEST_ARUN_2 (it returns Select Options, Parameters..)
 
    CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
       EXPORTING
         curr_report     = 'ZZTEST_ARUN_2'
      TABLES
         selection_table = stable
      EXCEPTIONS
         not_found       = 1
         no_report       = 2
         OTHERS          = 3.
      
    IF sy-subrc <> 0.
     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
 
   stable-sign = 'I'.
   stable-option = 'BT'.
   
* populate some selection condition
   READ TABLE it_werks INDEX 10.
   stable-low = it_werks-werks.
 
   READ TABLE it_werks INDEX 40.
   stable-high = it_werks-werks.
 
   APPEND stable.
 
*Submit it then
   SUBMIT zztest_arun_2
       WITH SELECTION-TABLE stable
       AND RETURN.
 
   ENDIF.
 

<b>Second Program.</b>

REPORT zztest_arun_2.
TABLES: t001w.
 
DATA : it_werks TYPE STANDARD TABLE OF t001w WITH HEADER LINE.
 
SELECT-OPTIONS : s_werks FOR t001w-werks.
 
 
 
*Import the stored data.
IMPORT it_werks[] FROM MEMORY ID 'TEST'.
 
 
*Display the data based on selection criteria got
*form ZZTEST_ARUN_1
LOOP AT it_werks WHERE werks  IN s_werks.
  WRITE : / it_werks-werks,
            it_werks-name1.
 
ENDLOOP.

Regards,

Arun Sambargi.

Read only

Former Member
0 Likes
1,411

Hi Pankaj,

Use <b>import/export</b> statements.

Lets take a simple example.

Calling program(say zprog1)

-



data: i_tab type table of mara with header line.

start-of-selection.

select * into table i_tab from mara up to 10 rows.
<b>
export i_tab to memory id 'YOURID'.
submit zprog2 and return.
</b>

-


Called program (zprog2)

-




data: i_tab type table of mara with header line.
<b>
import i_tab from memory id 'YOURID'.
</b>
loop at i_tab.

write:/ i_tab-matnr.
endloop.

Hope this helps you.

Regards,

Anirban.