1
votes

And which one should be preferred / why?

So I have a TYPE defined locally:

TYPES:
    BEGIN OF CUSTOMER_STRU_TYPE,
        KUNNR TYPE KNA1-KUNNR,
        NAME1 TYPE KNA1-NAME1,
    END OF CUSTOMER_STRU_TYPE.

and I think these 2 statements seen below will both do the same thing:

DATA:
    CUSTOMER_TAB TYPE CUSTOMER_STRU_TYPE OCCURS 5.

DATA:
    CUSTOMER_TAB TYPE STANDARD TABLE OF CUSTOMER_STRU_TYPE.

Are there any differences between the 2 statements seen above and which one should be preferred?

1
You have already asked about it. The first statement with OCCURS defines an internal table with header line, the other defines an internal table without header line. OCCURS 5 means that initially there will be assigned memory for 5 rows. - Jagger
Hi @Jagger . The difference between those 2 are: the existing / lack of: STANDARD TABLE OF not "WITH HEADER LINE".. This is a different question actually. - Koray Tugay
With all due respect I disagree. :) Especially that I mentioned about STANDARD TABLE OF WITH HEADER LINE in one of the comments there. - Jagger
@Jagger Well ok, you are probably right. I am very new to SAP / ABAP so I am still trying to understand. I think it will make sense with time, I am just confused at the moment. Thank you for your help. - Koray Tugay

1 Answers

3
votes

The main difference between the two statements is that, in the first one you're reserving memory space for storing 5 lines of customer_tab table. In terms of performance, the best statement is the second one.