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

Help

Former Member
0 Likes
1,240

Hello Genuis

I m inserting values in database throught screen

i had made a button with SAVE fcode

<b>when 'SAVE'.

select max( empno ) from zsun_emp INTO MM.

MM = MM + 1.

WA_ZSUN_EMP-EMPNO = zsun_emp-empno.

WA_ZSUN_EMP-ENAME = ZSUN_EMP-ENAME.

WA_ZSUN_EMP-DOJ = ZSUN_EMP-DOJ.

WA_ZSUN_EMP-COMM = ZSUN_EMP-COMM.

WA_ZSUN_EMP-SAL = ZSUN_EMP-SAL.

WA_ZSUN_EMP-DEPTNO = ZSUN_EMP-DEPTNO.

INSERT INTO ZSUN_EMP FROM WA_ZSUN_EMP.</b>this code i had written and its giving some error

that error is

<u>"VALUES field.", "CONNECTION ... VALUES field.", "CLIENT SPECIFIED

VALUES field.", or "CLIENT SPECIFIED CONNECTION ..." expected after

"ZSUN_EMP". </u>

please tell me how to solve it

Please reply urgent as i m goin on with that

i m new to Module Pool tooo

With Best Regards

Ruby

Hoping for Quick Reply

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,202

Hi Ruby,

Use this code it will execute perfectly.

when 'SAVE'.

select max( empno ) from zsun_emp INTO MM.

MM = MM + 1.

MOVE MM TO ZSUN_EMP-<VARIABLE NAME>.

WA_ZSUN_EMP-EMPNO = zsun_emp-empno.

WA_ZSUN_EMP-ENAME = ZSUN_EMP-ENAME.

WA_ZSUN_EMP-DOJ = ZSUN_EMP-DOJ.

WA_ZSUN_EMP-COMM = ZSUN_EMP-COMM.

WA_ZSUN_EMP-SAL = ZSUN_EMP-SAL.

WA_ZSUN_EMP-DEPTNO = ZSUN_EMP-DEPTNO.

APPEND WA_ZSUN.

INSERT ZSUN_EMP.

IF USEFULL REWARD

11 REPLIES 11
Read only

Former Member
0 Likes
1,202

hi,

U did not give the values extension to the insert statement.Give it and check it ones.

Read only

Former Member
0 Likes
1,202

Hi

Something wrong with syntax, remove INTO and see

INSERT ZSUN_EMP FROM WA_ZSUN_EMP

Keep the Cursor on INSERT keyword and press F1 you will get the help for INSERT

see and correct it

Reward points for useful Answers

Regards

Anji

Read only

0 Likes
1,202

friend

wen i write

<b>

INSERT ZSUN_EMP FROM WA_ZSUN_EMP.</b>

then

error comes

<u>The type of the database table and work area (or internal table)

"WA_ZSUN_EMP" are not Unicode convertible. Unicode convertible.</u>

now wats this friend

Ruby

Read only

0 Likes
1,202

for the above error i code like this

<b>INSERT ZSUN_EMP FROM WA_ZSUN_EMP UNICODE ENABLING 'X'.</b> .

but it gives some other error

<u>

"." expected after "WA_ZSUN_EMP".</u>

please now tell me how do i solve

Hoping for quick answer

With Best Regards

Ruby

Read only

Former Member
0 Likes
1,202

declare WA_ZSUN_EMP like zsun_emp. and then insert. one more thing i can not under stand what is the use MM variable here when you are not using it any where. If you are trying to insert the duplicate entries in database then you cannot enter that(i.e duplicate key values).

for avoiding error you can use

INSERT ZSUN_EMP FROM WA_ZSUN_EMP accepting duplicate keys.

here it will not insert your data but it is for just avoiding the error.

regards

shiba dutta

Read only

0 Likes
1,202

friend

i had declared the table

<b>DATA: BEGIN OF WA_ZSUN_EMP OCCURS 0,

EMPNO LIKE ZSUN_EMP-EMPNO,

ENAME LIKE ZSUN_EMP-ENAME,

DOJ LIKE ZSUN_EMP-DOJ,

COMM LIKE ZSUN_EMP-COMM,

SAL LIKE ZSUN_EMP-SAL,

DEPTNO LIKE ZSUN_EMP-DEPTNO,

END OF WA_ZSUN_EMP.</b>

and for mm

<u>DATA: MM LIKE ZSUN_EMP-EMPNO.</u>

now tell how to solve

Hope now u got the problem

With Best Regards

ruby

Read only

0 Likes
1,202

check whether you have declared all the fields of that ztable have you define in the internal table or not ? if not declare all the fields there and check whether you are repeating the key fields in insert or not?

regards

shiba dutta

Read only

Former Member
0 Likes
1,202

Hi Ruby,

Check with this code.

INSERT <work_area> INTO <internal_table>

<b>INSERT WA_ZSUN_EMP INTO ZSUN_EMP.</b>

Thanks,

Vinay

Read only

0 Likes
1,202

if i go like this

<b>INSERT WA_ZSUN_EMP from ZSUN_EMP .</b>

then error

<u>Field "FROM" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement.</u>

if i go like this

<b>INSERT ZSUN_EMP from WA_ZSUN_EMP.</b>

then error comes

<u>The type of the database table and work area (or internal table)

"WA_ZSUN_EMP" are not Unicode convertible. Unicode convertible.</u>

and if i solve above by

<b>INSERT ZSUN_EMP from WA_ZSUN_EMP UNICODE ENABLING 'X'.</b>

then

error comes

<u>"." expected after "WA_ZSUN_EMP".</u>

Now tell wats the solution

Please for sure as i struct out here.

With Best Regards

ruby

Read only

Former Member
0 Likes
1,203

Hi Ruby,

Use this code it will execute perfectly.

when 'SAVE'.

select max( empno ) from zsun_emp INTO MM.

MM = MM + 1.

MOVE MM TO ZSUN_EMP-<VARIABLE NAME>.

WA_ZSUN_EMP-EMPNO = zsun_emp-empno.

WA_ZSUN_EMP-ENAME = ZSUN_EMP-ENAME.

WA_ZSUN_EMP-DOJ = ZSUN_EMP-DOJ.

WA_ZSUN_EMP-COMM = ZSUN_EMP-COMM.

WA_ZSUN_EMP-SAL = ZSUN_EMP-SAL.

WA_ZSUN_EMP-DEPTNO = ZSUN_EMP-DEPTNO.

APPEND WA_ZSUN.

INSERT ZSUN_EMP.

IF USEFULL REWARD

Read only

0 Likes
1,202

Friend

i had done

when 'SAVE'.

select max( empno ) from zsun_emp INTO MM.

MM = MM + 1.

MOVE MM TO ZSUN_EMP-empno.

WA_ZSUN_EMP-EMPNO = zsun_emp-empno.

WA_ZSUN_EMP-ENAME = ZSUN_EMP-ENAME.

WA_ZSUN_EMP-DOJ = ZSUN_EMP-DOJ.

WA_ZSUN_EMP-COMM = ZSUN_EMP-COMM.

WA_ZSUN_EMP-SAL = ZSUN_EMP-SAL.

WA_ZSUN_EMP-DEPTNO = ZSUN_EMP-DEPTNO.

APPEND WA_ZSUN_emp.

INSERT ZSUN_EMP.

but its not inserting values in database

errors are removed

Please tell me how could i insert the values

Hoping for earlier and apprpiate answer

With Best Regards

Ruby