‎2008 Jun 30 7:48 AM
Hi,
I have a table called ZEX1_DEPT. Now I am trying to design a screen and written the follwoing program to insert data in the table ZEX1_DEPT. The structure of the table ZEX1_DEPT is DEPTNO NUMC, DEPTNAME CHAR.
REPORT Y_INSERT_INTO_DEPT_TABLE.
TABLES ZEX1_DEPT.
DATA: ok_code TYPE sy-ucomm,
save_ok LIKE ok_code,
v_dept_no TYPE n,
v_dept_name TYPE c,
v_dept TYPE ZEX1_DEPT.
CALL SCREEN 100.
MODULE init_screen_0100 OUTPUT.
CLEAR v_dept_no.
CLEAR v_dept_name.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'BUTTON_EXIT'.
LEAVE PROGRAM.
WHEN 'BUTTON_INSERT'.
v_dept.deptno = v_dept_no.
v_dept.deptname = v_dept_name.
INSERT INTO ZEX1_DEPT VALUES v_dept.
ENDCASE.
ENDMODULE.
But I am getting the following error during chek syntax.
Program Y_INSERT_INTO_DEPT_TABLE 33 @0A\QError@
Statement "V_DEPT" is not defined. Check your spelling. spelling.
spelling. spelling.
Can you please tell me why I am getting the error and how can I get rid of it.
Regards,
Koushik
‎2008 Jun 30 7:56 AM
hi,
is V_dept a strtucture then
mention in the tables statemnt tables : V_DEPT
insted of
v_dept.deptno = v_dept_no.
v_dept.deptname = v_dept_name.
do the following
v_dept-deptno = v_dept_no.
v_dept-deptname = v_dept_name.
regards
prasanth
‎2008 Jun 30 7:56 AM
hi,
is V_dept a strtucture then
mention in the tables statemnt tables : V_DEPT
insted of
v_dept.deptno = v_dept_no.
v_dept.deptname = v_dept_name.
do the following
v_dept-deptno = v_dept_no.
v_dept-deptname = v_dept_name.
regards
prasanth
‎2008 Jun 30 7:56 AM
hi,
you can take a structure same as to your database table.
move these two values to this internal table.
and use statement insert ztable from table internla table.
or in your case you hav to take a work area and move thses to value to work area..then use the statement you have used...
this may help u..
‎2008 Jun 30 8:00 AM
Hi,
Try like below
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'BUTTON_EXIT'.
LEAVE PROGRAM.
WHEN 'BUTTON_INSERT'.
v_dept-deptno = v_dept_no.
v_dept-deptname = v_dept_name.
INSERT INTO ZEX1_DEPT VALUES v_dept.
ENDCASE.
ENDMODULE.
Instaed of (v_dept.deptno) write (v_dept-deptno)
In all case when you are assigning values to structure.
Regards,
Sujit