sapdev logo background
sapdev logo sapdev logo
Comments

SAP OO OBS OCCURS 1 documentation, setup help and example usage



Return to SAP documentation index


INCLUDE
ARTICLE

Cannot Use OCCURS with Declarative Statements

In ABAP Objects, you cannot define internal tables using the OCCURS
addition in the TYPES or DATA statements (or any other declarative statement).

  • In ABAP Objects, the following statements cause an error message:


  • DATA: BEGIN OF itab OCCURS n,
    ...
    fi ...,
    ...
    END OF itab.

    and

    TYPES|DATA itab TYPE|LIKE line_type OCCURS n.
  • Correct syntax:


  • TYPES|DATA: BEGIN OF line_type,
    ...
    fi ...,
    ...
    END OF line_type.

    TYPES itab TYPE|LIKE STANDARD TABLE OF line_type
    WITH NON-UNIQUE DEFAULT KEY
    [INITIAL SIZE n].

    DATA itab TYPE|LIKE [STANDARD] TABLE OF line_type
    [INITIAL SIZE n].
  • Cause:


  • TYPE|LIKE TABLE OF , the new addition for the DATA and TYPES statements, makes the OCCURS addition superfluous in table declarations. If necessary, you can define the initial main memory requirement using the INITIAL SIZE addition.
  • Note:


  • The system automatically updates the short form

    DATA itab TYPE|LIKE TABLE of line_type.

    to

    DATA itab TYPE|LIKE STANDARD TABLE OF line_type
    WITH NON-UNIQUE DEFAULT KEY
    INITIAL SIZE 0.

    so that you can use the former.

    The system automatically updates the short form

    TYPES itab TYPE|LIKE STANDARD TABLE of line_type.

    to

    TYPES itab TYPE|LIKE STANDARD TABLE of line_type
    INITIAL SIZE 0.

    and defines a standard table type with a generic key that can be used to type interface parameters and field symbols.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    OO_OBS_NO_LENGTH_1
    OO_OBS_ON_CHANGE_1




    comments powered by Disqus