2008 Mar 31 4:33 AM
hi expert
I met a simple question of abap, when I insert a record to a custom table, the code is:
insert into zerc_test from ws_test, error message says:client specified valuse field is expected, and then I changed it to:
insert into zerc_test from ws_test client specified.
but the error message says: from ws_test is not expected.
I do not know why.
and after I changed it to:
insert into zerc_test VALUES ws_test. error message disappeared.
so can anyone tell me what's the difference between 'insert into dbtab value wa' and 'insert into dbtab from wa'?
many thanks
2008 Mar 31 6:17 AM
Hai
sun walni,
There is small difference between the two variants of insert statements.
INSERT INTO dbtab FROM wa.
(ii) INSERT INTO dbtab VALUES wa.
These variants are working in the following manner,
-> It Inserts one line into a database table.
-> The line to be inserted is taken from the work area wa and the data read from left to right according to the line structure of the database table dbtab.
-> Here, the structure of wa is not taken into account.
-> For this reason, the work area wa must be at least as wide as the line structure of dbtab, and
the alignment of the work area wa must correspond to the alignment of the line structure.Otherwise, a runtime error occurs.
If the database table dbtab or the work area wa contain strings, wa must be compatible with the line structure of dbtab.
For CLIENT SPECIFIED:
you can use this optpion ,
-> when you process data on cross-client basis for client-specific tables.
-> The client field is then treated like a normal table field which the program must fill with values in the work area wa.
Note: The CLIENT SPECIFIED must be specified after the dbtab name.
In your program, you are using after the work area name.so,it gives error.
if it useful, reward points.
bye
G.V.K.Prasad
hi expert
I met a simple question of abap, when I insert a record to a custom table, the code is:
insert into zerc_test from ws_test, error message says:client specified valuse field is expected, and then I changed it to:
insert into zerc_test from ws_test client specified.
but the error message says: from ws_test is not expected.
I do not know why.
and after I changed it to:
insert into zerc_test VALUES ws_test. error message disappeared.
so can anyone tell me what's the difference between 'insert into dbtab value wa' and 'insert into dbtab from wa'?
many thanks
2008 Mar 31 4:51 AM
Hi
so can anyone tell me what's the difference between 'insert into dbtab value wa' and 'insert into dbtab from wa'?
Well the addition values wa is correct and from wa will not work because of the way you have declared your table. If you were inserting values from an internal table you could use insert into dbtab from table itab.
The construct and syntax is explained in the ABAP help. If you specify the table name in a tables statement then you cannot use 'from wa'. But if you specify the tablename at runtime, then you must use 'from wa'.
Regards
Gareth
2008 Mar 31 4:53 AM
Hi,
If you check the syntax for INSERT INTO, you will find two things.
1. INSERT INTO DBTAB VALUES XXXX
2. INSERT INTO DBTAB FROM WA.
Just check the F1 help for INSERT. You will find the answer for your question.
Thanks,
Anil
2008 Mar 31 6:17 AM
Hai
sun walni,
There is small difference between the two variants of insert statements.
INSERT INTO dbtab FROM wa.
(ii) INSERT INTO dbtab VALUES wa.
These variants are working in the following manner,
-> It Inserts one line into a database table.
-> The line to be inserted is taken from the work area wa and the data read from left to right according to the line structure of the database table dbtab.
-> Here, the structure of wa is not taken into account.
-> For this reason, the work area wa must be at least as wide as the line structure of dbtab, and
the alignment of the work area wa must correspond to the alignment of the line structure.Otherwise, a runtime error occurs.
If the database table dbtab or the work area wa contain strings, wa must be compatible with the line structure of dbtab.
For CLIENT SPECIFIED:
you can use this optpion ,
-> when you process data on cross-client basis for client-specific tables.
-> The client field is then treated like a normal table field which the program must fill with values in the work area wa.
Note: The CLIENT SPECIFIED must be specified after the dbtab name.
In your program, you are using after the work area name.so,it gives error.
if it useful, reward points.
bye
G.V.K.Prasad
2008 Mar 31 9:14 AM
Hai
sun walni,
There is small difference between the two variants of insert statements.
INSERT INTO dbtab FROM wa.
(ii) INSERT INTO dbtab VALUES wa.
These variants are working in the following manner,
-> It Inserts one line into a database table.
-> The line to be inserted is taken from the work area wa and the data read from left to right according to the line structure of the database table dbtab.
-> Here, the structure of wa is not taken into account.
-> For this reason, the work area wa must be at least as wide as the line structure of dbtab, and
the alignment of the work area wa must correspond to the alignment of the line structure.Otherwise, a runtime error occurs.
If the database table dbtab or the work area wa contain strings, wa must be compatible with the line structure of dbtab.
For CLIENT SPECIFIED:
you can use this optpion ,
-> when you process data on cross-client basis for client-specific tables.
-> The client field is then treated like a normal table field which the program must fill with values in the work area wa.
Note: The CLIENT SPECIFIED must be specified after the dbtab name.
In your program, you are using after the work area name.so,it gives error.
if it useful, reward points.
2008 Mar 31 12:14 PM
hi,
see the reason for your problem and if i say the insert statements in your context the difference is as follows,
INSERT (without VALUE) in this case of your problem your db table structure is having a MANDT field inside it with is not having vale in your work area so when you insert your work area inside your table it throws an error saying that CLIENT value is required.here work area is inserted as one row inside the table.
When you use INSERT ( with VALUE) your value in work area for specific fields is stored equating each other individually.
some what like
dbtab-field1 = wa-field1
thus here your MANDT field is field by the system itself.
thus no error.
if you find this helpful, kindly reward
thanks
mayank
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |