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: 

IMPORT Parameter run time CX_SY_IMPORT_MISMATCH_ERROR

paruchuri_nagesh
Active Contributor
0 Kudos
1,220

Recently we have upgraded our SAP system . After upgrade the new SAP standard append structures  been added to table VBAP
Due to this the import statement in one of the Z program throwing run time error as follows

Error when attempting to IMPORT object "I_VBAP" An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_IMPORT_MISMATCH_ERROR', was  not caught and

therefore caused a runtime error.The reason for the exception is:When importing the object "I_VBAP", the component 279 in the dataset

had a different length from the corresponding component of the target object in the program "YXYZ".
I did check all the EXPORT and IMPORT all are looking good . But could not figure out root cause . Hence requesting experts to help me out

8 REPLIES 8

former_member585060
Active Contributor
0 Kudos
215

Hi,

Have you verified how the I_VBAP declared in that Z program, how is the VBAP table accessed( selected specified fields or all fields). Also check whether the table VBAP is activated correctly after the Append structure., Activate it using Database Utility from SE11.

Thanks & Regards

Bala Krishna.

0 Kudos
215

Bala..

Declarations are as followed

DATA: BEGIN OF I_VBAP OCCURS 10000.

        INCLUDE STRUCTURE VBAP.

DATA: DELIVERY_BLOCK LIKE VBEP-LIFSP.

DATA: SEND_TO_IDOC.

DATA: ALREADY_CHECKED.

DATA: END OF I_VBAP.
VBAP table status showing as active

Regards
Nagesh

0 Kudos
215

Where exactly the dump occuring in the Z program, i mean is it at any select on VBAP, have you analysed the dump in ST22 tcode, just verify at which place of code the dump is getting triggered.

0 Kudos
215

Exactly at IMPORT I_VBAP . I have analysed the short dump

0 Kudos
215

Can you specify where the values are exported to I_VBAP with EXPORT statement and what the structure of that I_VBAP.

The I_VBAP used in EXPORT statement must be different from the IMPORT statement....

Message was edited by: Bala Krishna

Former Member
0 Kudos
215

One scenario where such dump can  happen is - the IMPORT statement getting data from memory which were saved before the upgrade happened(or change in structure happened).

If yes, then read the INDX table for thePGMID and move the old data(old format) from memory to the new  format in memory.

let me know, I can add the code for the same.

Regards,

Almas

0 Kudos
215

Hi Almas..

Yes , IMPORT statement getting data from memory which were saved before the upgrade happen

IMPORT EXPORT_STRUCTURE I_ZTABLE I_VBAP

        FROM DATABASE INDX(ST) ID INDEX

0 Kudos
215

Create a Z program to Read  data from INDX and update them.

tables: indx, usr01.

constants: c_object          type balobj_d value,

           c_subobject       type balsubobj value,

  *  old structure data definition

types: BEGIN OF vbap_old,

         INCLUDE OLD VBAP STRUCTURE

          END OF vbap_old.

types: BEGIN OF vbap_new,

        INCLUDE NEW VBAP STRUCTURE

        END OF vbap_new.

data: s_log                  type bal_s_log,

      s_msg                  type bal_s_msg,

      v_handle               type balloghndl,

      it_handle              type bal_t_logh,

      wa_bapi_return         type bapiret2.

data: vbap_data_new      type vbap_new,

      vbap_data               type vbap_old,

      it_orig_indx          type standard table of indx,

      it_orig_indx_fail     type standard table of indx,

      it_orig_indx_good     type standard table of indx,

      wa_orig_indx          type indx,

      wa_orig_indx2         type indx,

      lwa_indx              type indx.

select-options: s_user for USR01-BNAME.

start-of-selection.

   if s_user is initial.

    select * from indx into table it_orig_indx

      where relid =  'THE VALUES IN YOUR SCENARIO'

        and pgmid = ' 'THE VALUES IN YOUR SCENARIO'

  else.

    select * from indx into table it_orig_indx

        where relid =

        and pgmid =

        and usera in s_user.

  endif.

   loop at it_orig_indx into wa_orig_indx.

     clear: wa_orig_indx2.

    wa_orig_indx2 = wa_orig_indx.

     at new srtfd.

       try.

           import vbap_data from database indx(zi) id wa_orig_indx2-srtfd.

         catch cx_sy_import_format_error.

          append wa_orig_indx2 to it_orig_indx_fail.

          continue.

         catch cx_sy_import_mismatch_error.

          append wa_orig_indx2 to it_orig_indx_fail.

          continue.

       endtry.

********************************************************************************

********  BEGIN CODE TO REALIGN FROM OLD STRUCTURE TO NEW STRUCTURE  ***********

**     Import worked, now move to new data structure.

       "This should move the vbap data to the new structure 

      move-corresponding vbap_data to vbap_data_new.

********************************************************************************

********  END CODE TO REALIGN FROM OLD STRUCTURE TO NEW STRUCTURE  *************

********************************************************************************

*     Export back out to INDX.

      perform sub_export using vbap_data_new wa_orig_indx2.

     endat.

  endloop.

end-of-selection.

*&---------------------------------------------------------------------*

*&      Form  SUB_EXPORT

*&---------------------------------------------------------------------*

form sub_export using p_vbap_data_new type any

                      p_lcl_indx        type indx.

      vbap_data = p_vbap_data_new.

   try.

       clear: lwa_indx.

       lwa_indx-aedat = sy-datum.

      lwa_indx-usera = sy-uname.

      lwa_indx-pgmid = ' '.

      lwa_indx-begdt = p_lcl_indx-begdt.

       export vbap_data from vbap_data to database indx(ZI) id p_lcl_indx-srtfd from lwa_indx.

     catch cx_sy_export_buffer_no_memory.

      append wa_orig_indx2 to it_orig_indx_fail.

      return.

     catch cx_sy_export_no_shared_memory.

      append wa_orig_indx2 to it_orig_indx_fail.

      return.

   endtry.

* Export worked, place into success table for later app. log

  append wa_orig_indx2 to it_orig_indx_good.

endform.