何时在ABAP中使用TYPE和LIKE

sat*_*tya -1 sap abap

为什么会出现此错误.当我使用*类型(在第2行的类似位置)时不会显示任何错误,当我使用像显示错误.什么是LIKE和之间的区别TYPE

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

shr*_*t18 7

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

现在,如果要创建另一个变量,变量student_name,则可以使用like声明中的关键字作为data student_name2 like student_name.

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