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

EXPORT / IMPORT

Former Member
0 Likes
802

Program (A) has this code:

EXPORT gi_po TO MEMORY ID 'ZGI_PO'.

program (B) as this code:

IMPORT gi_po FROM MEMORY ID 'ZGI_PO'.

READ TABLE gi_po INTO gw_po

WITH KEY ebelp = i_input_user-kposn.

and program B got runtime error at this IMPORT stmt/ READ TABLE statement.

The ABAP error message:

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_IMPORT_MISMATCH_ERROR',

was neither

caught nor passed along using a RAISING clause, in the procedure

"EXIT_SAPLFYTX_USER_001" "(FUNCTION)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

The system found when importing that the target object was longer or

shorter than the object to be imported.

Pleasae advise.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
713

HI Helen,

Check whether you have declared <b>gi_po</b> same in both the programs A & B.

Consider these codes.


REPORT zztest_arun_1.
  TABLES: t001w.
  DATA : it_marc TYPE STANDARD TABLE OF marc WITH HEADER LINE,
        <b> it_werks TYPE STANDARD TABLE OF t001w WITH HEADER LINE.</b>
 
   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
    
<b>    EXPORT it_werks[] TO MEMORY ID 'TEST'.</b>
 
*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.
 
 




Second Program.


REPORT zztest_arun_2.
TABLES: t001w.
 
<b>DATA : it_werks TYPE STANDARD TABLE OF t001w WITH HEADER LINE.</b>
 
SELECT-OPTIONS : s_werks FOR t001w-werks.
 
 
 
*Import the stored data.
<b>IMPORT it_werks[] FROM MEMORY ID 'TEST'.</b>
 
 
*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.

5 REPLIES 5
Read only

Former Member
0 Likes
713

The error is because of the mismatch of declaration of gi_po in program A and B.

In both the programs the variable should definted exactly same.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
714

HI Helen,

Check whether you have declared <b>gi_po</b> same in both the programs A & B.

Consider these codes.


REPORT zztest_arun_1.
  TABLES: t001w.
  DATA : it_marc TYPE STANDARD TABLE OF marc WITH HEADER LINE,
        <b> it_werks TYPE STANDARD TABLE OF t001w WITH HEADER LINE.</b>
 
   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
    
<b>    EXPORT it_werks[] TO MEMORY ID 'TEST'.</b>
 
*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.
 
 




Second Program.


REPORT zztest_arun_2.
TABLES: t001w.
 
<b>DATA : it_werks TYPE STANDARD TABLE OF t001w WITH HEADER LINE.</b>
 
SELECT-OPTIONS : s_werks FOR t001w-werks.
 
 
 
*Import the stored data.
<b>IMPORT it_werks[] FROM MEMORY ID 'TEST'.</b>
 
 
*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

dani_mn
Active Contributor
0 Likes
713

Hi,

declaration of 'gi_po' should be same in both programs.

type of data object 'gi_po' should be same in both programs.

are you using same declaration.

plz show the code where you are declaring in both programs.

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
713

The data types of the tables in the exporting and importing programs should match exactly. Looks like a type mismatch error has occured.

Hope this helps.

Sudha

Read only

Former Member
0 Likes
713

Hi Helen,

The declaration of the internal tables in both the programs should be the same.

types: begin of ty_po,

vbeln like vbak-vbeln,

vgbel like vbak-vgbel,

end of ty_po.

for ex.

Program <b>A</b>:

data: gi_po type standard table of ty_po.

Program <b>B</b>:

data: gi_po type standard table of ty_po.

Pls check the same.

Reward if helpful.

Regards,

Tushar