Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP Syntax Error

Former Member
0 Likes
668

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.

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
585

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

3 REPLIES 3
Read only

Former Member
0 Likes
585

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.

Read only

uwe_schieferstein
Active Contributor
0 Likes
586

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

Read only

0 Likes
585

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