‎2005 Mar 02 5:36 PM
I know the conditions for this select are acceptable because when I select archiveykey and archiveofs into plain variable varKEY and varOFS, they get values. [the problem with this is that when there are more than one key and offset for the condition, varKEY and varOFS only retrieve the last record's info.]
For some reason, I cannot populate this internal table even though it's fields correspond directly to the fields from which I am trying to copy data.
DATA: BEGIN OF ITAB2 OCCURS 0,
KEY LIKE ZARIXFI3-ARCHIVEKEY,
OFS LIKE ZARIXFI3-ARCHIVEOFS.
DATA: END OF ITAB2.
*
*
*
SELECT: archivekey archiveofs INTO CORRESPONDING FIELDS OF TABLE ITAB2
FROM (tablename)
WHERE (lt_cond).Any suggestions?
N L
‎2005 Mar 02 7:10 PM
Natasha,
For the command INTO CORRESPONDING FIELDS OF TABLE ITAB2 to work the fields in teh ITAB2 have to be declared with the same name and datatype as the one you are selecting So your ITAB2 should be declared as
DATA: BEGIN OF ITAB2 OCCURS 0,
ARCHIVEKEY LIKE ZARIXFI3-ARCHIVEKEY,
ARCHIVEOFS LIKE ZARIXFI3-ARCHIVEOFS,
END OF ITAB2.or if that is not possible you can modify your select to read
SELECT ARCHIVEKEY ARCHIVEOFS INTO (ITAB2-key, itab2-ofs)
FROM (tablename)
WHERE (lt_cond).
if sy-subrc = 0 .
append itab2 .
endif.
ENDSELECT .
Either should work and populate the internal table.
Thanks,
Anu
‎2005 Mar 02 7:14 PM
When using cooresponding fields, the internal table fields names should be the same as the table itself. Your data statement should be like this.
DATA: BEGIN OF ITAB2 OCCURS 0,
ARCHIVEKEY LIKE ZARIXFI3-ARCHIVEKEY,
ARCHIVEOFS LIKE ZARIXFI3-ARCHIVEOFS.
DATA: END OF ITAB2.
*