‎2008 Jul 06 8:23 PM
I am getting the following sytnax error with the following program, would some one help me to recover this issue. Thx.
Syntax Error : The Work Area STREMP is not long enough
REPORT Zinsert.
Tables : zemp. " Employee Table
Data: Begin of STREMP ,
Empno type zemp-empno,
deptno like zemp-deptno,
empname like zemp-empname,
end of STREMP.
STREMP-Empno = 120.
STREMP-Deptno = 40.
STREMP-Empname = 'Jenni'.
Insert into zemp values STREMP.
‎2008 Jul 06 9:13 PM
Hello Jenni
Is there any reason why you do not define your workarea exactly as your DB table???
REPORT Zinsert.
Tables : zemp. " Employee Table
"Data: Begin of STREMP ,
"
"Empno type zemp-empno,
"deptno like zemp-deptno,
"empname like zemp-empname,
"
"end of STREMP.
DATA: gs_STREMP TYPE zemp.
gs_STREMP-Empno = 120.
gs_STREMP-Deptno = 40.
gs_STREMP-Empname = 'Jenni'.
Insert into zemp values gs_STREMP.
Regards
Uwe
‎2008 Jul 06 8:57 PM
Hi,
Please change your code as below :
Tables : zemp. " Employee Table
Data: Begin of STREMP1 ,
Empno type zemp-empno,
deptno like zemp-deptno,
empname like zemp-empname,
end of STREMP1.
data : stremp like stremp1 occurs 0 with header line.
STREMP1-Empno = 120.
STREMP1-Deptno = 40.
STREMP1-Empname = 'Jenni'.
append stremp1 to stremp.
Insert into zemp values STREMP.
Thanks,
Sriram POnna.
‎2008 Jul 06 9:13 PM
Hello Jenni
Is there any reason why you do not define your workarea exactly as your DB table???
REPORT Zinsert.
Tables : zemp. " Employee Table
"Data: Begin of STREMP ,
"
"Empno type zemp-empno,
"deptno like zemp-deptno,
"empname like zemp-empname,
"
"end of STREMP.
DATA: gs_STREMP TYPE zemp.
gs_STREMP-Empno = 120.
gs_STREMP-Deptno = 40.
gs_STREMP-Empname = 'Jenni'.
Insert into zemp values gs_STREMP.
Regards
Uwe
‎2008 Jul 06 11:37 PM
ur data base table has mandt field also..... so declare mandt field in the internal table also u will not get syntax error.. but industry practice is to declare internal table using 'include structure db table' whenevr u do a insert on the custom data base table