Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 19, 2008 at 03:32 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 19, 2008 at 03:46 AM

    Hi,

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

    Cheers!!

    Balu

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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