Application Development 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: 

Why does my internal table(with header line) ignore 4 of its fields?

Former Member
0 Kudos
149

Hi Gurus,

I am a newbie to ABAP how has spent far to much of my weekend time trying to solve the following problem;

when trying to insert data from table cdpos into my internal table, I only get the two object* fields, the other 3 are not even part of the internal table according to the debugger.

my select code is:

-


SELECT fname tabkey changenr objectclas objectid

FROM cdpos

INTO CORRESPONDING FIELDS OF i_cd_index

WHERE tabname = 'XXX'

AND fname = 'XXX'

AND chngind = 'U'

ENDSELECT.

IF sy-subrc <> 0.

ENDIF.

-


- If I use a wa like line of i_cd_index the other fields will show up.

- I have tried with including 'TABLE' in the INTO statement, same result.

Please help out, getting very frustrated here....

/Mike

1 ACCEPTED SOLUTION

Former Member
0 Kudos
104

Hi Magdic,

Check the below logic

DATA: ITAB LIKE CDPOS OCCURS 0 WITH HEADER LINE.

SELECT * FROM CDPOS INTO ITAB.

APPEND ITAB.

ENDSELECT.

LOOP AT ITAB.

WRITE: ITAB.

ENDLOOP.

Copy paste and check the code data is fetching into my internal table.

Cheers!!

Balu

4 REPLIES 4

Former Member
0 Kudos
105

Hi Magdic,

Check the below logic

DATA: ITAB LIKE CDPOS OCCURS 0 WITH HEADER LINE.

SELECT * FROM CDPOS INTO ITAB.

APPEND ITAB.

ENDSELECT.

LOOP AT ITAB.

WRITE: ITAB.

ENDLOOP.

Copy paste and check the code data is fetching into my internal table.

Cheers!!

Balu

Former Member
0 Kudos
104

Hi,

Is your issue solved, if there are any issues revert back someone will you.

Cheers!!

Balu

0 Kudos
104

No, it didn't help, still the same behaviour.

cdpos is a clustered table, can that have an effect?

0 Kudos
104

Hi Magdic,

I have completely coded for but i have taken as parameters rather direct values (XXXX). Under stand the code and select statement you will get it. Program which i have shown is working fine.

Do one thing first go the table CDPOS take one entry of Objectid, Tabname, fname and chngind and then enter in the selection and find whether the values are fetched correctly or not.

To my knowledge there might be no data in your table.

Anyhow try the below code.

TABLES: CDPOS.

DATA: ITAB LIKE CDPOS OCCURS 0 WITH HEADER LINE.

parameters: p_CHGID like CDPOS-chngind,

p_TAB like CDPOS-TABNAME,

P_FNAM LIKE CDPOS-FNAME.

SELECT OBJECTID TABNAME FNAME CHNGIND FROM CDPOS INTO CORRESPONDING FIELDS OF ITAB WHERE OBJECTID = P_CHGID

AND TABNAME = P_TAB

AND FNAME = P_FNAM.

APPEND ITAB.

ENDSELECT.

WRITE: ITAB-OBJECTID, ITAB-TABNAME, ITAB-FNAME, ITAB-CHNGIND.

Cheers!!

Balu