Skip to Content
5
Apr 18, 2018 at 09:16 PM

DATA definition: TYPE or ?

816 Views

Was hoping to find some guidelines on this but didn't see any specific suggestions.

When you define variables, do you use a data element or table and field name as type? For example:

DATA: lv_werks TYPE vbap-werks.

or

DATA: lv_werks type werks_d ?

(And it always gets me that WERKS is a structure. :) )

I lean towards the first option, especially when defining internal tables for SELECT. Obviously SAP can change the assigned data element in a standard table, so reference like vbap-werks prevents from a possible type error. But I'm wondering if there are any other factors to consider. What do you use and why?

Thank you.