Skip to Content
Former Member
Feb 08, 2012 at 11:03 AM

Header line data type changes when passed to subroutine



We have an existing problem in Production wherein the program encounters ABAP dump (details below).


Error analysis
    The statement
       "DELETE TABLE itab FROM wa ..."
    requires the lines of the internal table "IT_ZPA2003[]" and the
    work area " wa" to be compatible. Compatibility means
    equivalence in the context of ABAP/4 type checking.

    In this case, the condition is not satisfied because the internal table
    "IT_ZPA2003[]" has the line type "ZPA2003" and the length 301, but the work
     area " wa"
    has the type "PA2003" and the length 269.

For our common reference, ZPA2003 is really different from PA2003. ZPA2003 has additional customized fields.

Below is the problematic code:

DATA: it_zpa2003 LIKE zpa2003 OCCURS 0 WITH HEADER LINE. 
  PERFORM delimit TABLES itab

Below is the definition of the subroutine delimit :

FORM delimit  TABLES itab         STRUCTURE zpa2003
                     it_zpa2003   STRUCTURE pa2003 " This seems wrong, should be ZPA2003
                     new_records  STRUCTURE zpa2003
                     old_records  STRUCTURE zpa2003
                     it_old       STRUCTURE zpa2003
                     temp_zpa2003 STRUCTURE zpa2003.

  LOOP AT it_zpa2003 
    WHERE ( begda LE itab-begda AND endda GE itab-begda )
      OR ( begda LE itab-endda AND  endda GE itab-endda )
      OR ( begda GE itab-begda AND  endda LE itab-endda ).
            DELETE TABLE it_zpa2003.


This is code already existing in Production, so pardon the usage of obsolete statements.

i.e. internal table with header line, passing using TABLES for subroutine

And yes, the variable name of the internal table in the FM is the same as the variable name of the receiving parameter in the subroutine (i.e. IT_ZPA2003).

Anyway if you look at the code, there really is a problem since in the Function Module *it_zpa2003* is defined as *ZPA2003* while in the subroutine, the structure is defined to be *PA2003* only (no Z).

The weird part is -- this code is actually working in our Development environment.

And yes, the tables are the same versions, the function modules have the same versions, the include programs have the same versions.

I tried to debug this, and observed the following:

In Development, once inside the subroutine, header line IT_ZPA2005 still has the type as the table passed which is ZPA2003.

In Production, once inside the subroutine, header line IT_ZPA2005 changes type to PA2003.

I am not all that familiar as to how SAP actually executes ABAP code. We're not really sure as well if our SysAds updated anything in the backend.

I'm hoping someone can shed some light as to why the behavior is different.

I've tried to debug and the ABAP code is identical line per line...

As additional data, we have 2 other boxes -- Sandbox and Testing environment.

Development and Sandbox behave the same --the header line data type does not change.

Testing and Production behave the same -- the header line data type changes to the defined structure in the subroutine.

However, our Sandbox was refreshed from Production middle of last year, then our Testing was refreshed late last year, both from Production.

Edited by: Alexandra Co on Feb 8, 2012 12:08 PM