何时在ABAP中使用TYPE和LIKE

时间:2015-01-06 08:13:22

标签: sap abap

为什么会出现此错误。当我使用*类型(在第2行中的类似位置)时,如果我使用类似的节目错误,则显示任何错误。LIKETYPE

TYPES name(20) type c.
data student_name *like name.
student_name = 'satya'.
write student_name.

错误 - NAME must a flat structure you can not use internal table,string referenceses or structure as component

1 个答案:

答案 0 :(得分:7)

您已将name创建为type。因此,如果您声明一个类型 name的变量,则需要将该语句写为data student_name type name.

现在,如果您想创建另一个变量,如变量student_name,您可以在声明中使用like关键字data student_name2 like student_name.

有关更详细的说明,请参阅documentation