Hello Gurus,
i have an internal table ITAB, which has all the fields of DB table ZDESC which has all total 6 fields ( 3-key fields).
I am fetching 4 fields from scrren to ITAB including the key fields.
and then saving these data into ZDESC table .
But here the error is - work area 'ITAb' is not long enough.
whats the reason and how to solve this ?
here is my code , its so simple
.
PAI include.
-
case ok_code. when 'enter' IT_HEAD-CCODE = S_CCODE . * s_code = screen field. IT_HEAD-PCODE = S_PCODE . * first three field are key fields except c_name IT_HEAD-BCODE = S_BCODE . IT_HEAD-CNAME = S_CNAME . when 'save'. modify zdesc from table it_head. endcase.
dats it.
Do check if your table is deinfed as:
you are confusing between table and work area.
1. Have clear distiction between table and work area.
DATA: it_head type table of ZDESC.
DATA: wa_head type ZDEC.
MODIFICATION TO DB TABLE:
From Table:
MODIFY ZDESC FROM TABLE IT_HEAD
From Workarea:
MODIFY ZDESC FROM WA_HEAD.
Moreover your work area seems to be not of same type as your table.
In that case you have to use UPDATE ,
CHEERS !
does it also have the mandt field?
The internal table record must be at least as long as the database structure, look at online help with F1. (or [Work Areas in Open SQL Statements |http://help.sap.com/abapdocu/en/ABENOPEN_SQL_WA.htm]) (except: client/mandt)
If you don't have the whole data to update you MUST either
- read the actual database, update an internal table of same length/field order and then update database
- use syntax like [UPDATE dbtab SET expr1 WHERE expr2|http://help.sap.com/abapdocu/en/ABAPUPDATE_SOURCE.htm#!ABAP_ALTERNATIVE_1@1@]
NB 1: you must not only have every field of the database table, but they must be in the same sequence and have the same definition, so the same internal length (so you must have field MANDT, even if you left the field initial)
NB 2 : i hope some lines are not copied here from your program. Else whet if user press SAVE and not ENTER first time, where is the APPEND, is IT_HEAD actually an internal table ?
Regards,
Raymond
Add a comment