将记录添加到内部 table
Add records into internal table
我想将记录添加到内部 table。当我尝试添加时,t 显示
的错误
字段 "ITAB_EMPLOYEE" 未知,但有一个名称相似的字段 "ITAB_EMPLOYEE_I"。 .
REPORT zitab_siddhi.
TYPES: BEGIN OF EMPLOYEE,
EMPID TYPE C,
EMPNAME TYPE string,
EMPADDRESS TYPE c,
EMPEMAIL TYPE c,
EMPDEPT TYPE c,
EMPROLE TYPE string,
EMPCONT TYPE C,
END OF employee.
TYPES ITAB_EMPLOYEE TYPE STANDARD TABLE OF EMPLOYEE.
DATA: ITAB_EMPLOYEE_I TYPE EMPLOYEE.
ITAB_EMPLOYEE_I-EMPID = '123'.
ITAB_EMPLOYEE_I-EMPNAME = 'JOHN DOE'.
ITAB_EMPLOYEE_I-EMPADDRESS = 'BANGALORE'.
ITAB_EMPLOYEE_I-EMPEMAIL = 'JOHN@BANGALORE.COM'.
ITAB_EMPLOYEE_I-EMPDEPT = 'SALES'.
ITAB_EMPLOYEE_I-EMPROLE = 'MANAGER'.
ITAB_EMPLOYEE_I-EMPCONT = '1234567890'.
APPEND ITAB_EMPLOYEE_I TO ITAB_EMPLOYEE.
ITAB_EMPLOYEE
在您的代码中被声明为 table 类型而不是内部 table 。将 TYPES
替换为 DATA
:
DATA itab_employee TYPE STANDARD TABLE OF employee.
我想将记录添加到内部 table。当我尝试添加时,t 显示
的错误字段 "ITAB_EMPLOYEE" 未知,但有一个名称相似的字段 "ITAB_EMPLOYEE_I"。 .
REPORT zitab_siddhi.
TYPES: BEGIN OF EMPLOYEE,
EMPID TYPE C,
EMPNAME TYPE string,
EMPADDRESS TYPE c,
EMPEMAIL TYPE c,
EMPDEPT TYPE c,
EMPROLE TYPE string,
EMPCONT TYPE C,
END OF employee.
TYPES ITAB_EMPLOYEE TYPE STANDARD TABLE OF EMPLOYEE.
DATA: ITAB_EMPLOYEE_I TYPE EMPLOYEE.
ITAB_EMPLOYEE_I-EMPID = '123'.
ITAB_EMPLOYEE_I-EMPNAME = 'JOHN DOE'.
ITAB_EMPLOYEE_I-EMPADDRESS = 'BANGALORE'.
ITAB_EMPLOYEE_I-EMPEMAIL = 'JOHN@BANGALORE.COM'.
ITAB_EMPLOYEE_I-EMPDEPT = 'SALES'.
ITAB_EMPLOYEE_I-EMPROLE = 'MANAGER'.
ITAB_EMPLOYEE_I-EMPCONT = '1234567890'.
APPEND ITAB_EMPLOYEE_I TO ITAB_EMPLOYEE.
ITAB_EMPLOYEE
在您的代码中被声明为 table 类型而不是内部 table 。将 TYPES
替换为 DATA
:
DATA itab_employee TYPE STANDARD TABLE OF employee.