‎2007 Sep 17 3:09 PM
How do everyone,
I have the following work areas and internal table defintion:
TYPES: BEGIN OF equi_rec,
equnr, " Registration
herst, " Make
typbz, " Model
zzdept, " Department
zzoperator, " Operator
zzregdate, " Registration Date
END OF equi_rec.
DATA: equi_wa TYPE equi_rec,
equi_tab TYPE TABLE OF equi_rec.
In the code:
SELECT *
INTO CORRESPONDING FIELDS OF TABLE equi_tab
FROM
equi.
The ABAP is falling over at runtime. I have since found out that if
I comment out the ZZREGDATE in the EQUI_REC above, the program works.
The ZZREGDATE is defined as a date in the dicionary.
Can anyone tell me why the program is falling over when I am trying to
move the date field??
Any help much apprectaied.
Thanks in advance
Andy
‎2007 Sep 17 3:38 PM
Hi,
Here is the answer ..
TYPES: BEGIN OF equi_rec,
equnr, " Registration
herst, " Make
typbz, " Model
zzdept, " Department
zzoperator, " Operator
zzregdate, " Registration Date
END OF equi_rec.
If you declare like above, then all the fields will have Charecter type and length is 1, so the EQUNR, HERST and all other fields is charecter type then it is storing the first charecter in this Internal table, but the ZZREGDATE is the date field and it will not store the first charecter from the date field, because if you use the MOVE-CORRESPONDING then you need to write the same type, so that it is giving the dump ..
after writing the TYPE for ZZREGDATE then the program will run properly, but all the fields will store only the first charecter from the table values,
you need to give the correct TYPE to all the fields from the data dictionary inorder to store the total value
Reward points for all the helpful answers
Regards
Sudheer
‎2007 Sep 17 3:12 PM
it shud work. check for the declaration and is the declaration valid in table aswell?
‎2007 Sep 17 3:16 PM
Hi,
You need to assign the data dictonary types to the Internal table fields
TYPES: BEGIN OF equi_rec,
equnr type EQUNR, " Registration " Here i assigned the EQUNR data element
herst, " Make
typbz, " Model
zzdept, " Department
zzoperator, " Operator
zzregdate, " Registration Date
END OF equi_rec.
In the same way, attach to all the fields
Regards
Sudheer
‎2007 Sep 17 3:17 PM
can u please paste ur code so that i can help u...
thanks,
maheedhar
‎2007 Sep 17 3:18 PM
In you types definition how are you defining zzregdate (i.e. TYPE, LIKE) ? Is it defined or referenced to a date field?
‎2007 Sep 17 3:20 PM
Did you specify the type of the fields in your table equi_rec?
like
equinr type table-equinr,
zzregdate type table-date
And instead of using into corresponding field of table .... identify the fields you want to select which is more faster.
Then try your program again.
‎2007 Sep 17 3:27 PM
Thanks for replying everyone.
The strange thing is that I have a similar piece of code:
TYPES: BEGIN OF viqmel_rec,
aufnr,
equnr,
qmtxt,
kunum,
END OF viqmel_rec.
DATA: viqmel_wa TYPE viqmel_rec,
viqmel_tab TYPE TABLE OF viqmel_rec.
and if I write:
SELECT *
INTO CORRESPONDING FIELDS OF TABLE viqmel_tab
FROM
viqmel.
The program works.
I have now since found out that the problem is ZZREGDATE if I comment
out this in the table delcaration the program works. Why shoud it fail
on a date field??
‎2007 Sep 17 3:32 PM
Ignore my last response.
I have the solution by having to declare the field as a date
i.e. ZZREGDATE like equi-zzregdate
So my question now is Why do you have to define the date fields
and not the other fields???
‎2007 Sep 17 3:38 PM
Hi,
Here is the answer ..
TYPES: BEGIN OF equi_rec,
equnr, " Registration
herst, " Make
typbz, " Model
zzdept, " Department
zzoperator, " Operator
zzregdate, " Registration Date
END OF equi_rec.
If you declare like above, then all the fields will have Charecter type and length is 1, so the EQUNR, HERST and all other fields is charecter type then it is storing the first charecter in this Internal table, but the ZZREGDATE is the date field and it will not store the first charecter from the date field, because if you use the MOVE-CORRESPONDING then you need to write the same type, so that it is giving the dump ..
after writing the TYPE for ZZREGDATE then the program will run properly, but all the fields will store only the first charecter from the table values,
you need to give the correct TYPE to all the fields from the data dictionary inorder to store the total value
Reward points for all the helpful answers
Regards
Sudheer
‎2007 Sep 17 3:42 PM