Application Development and Automation 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: 
Read only

inner table

Former Member
0 Likes
489

program as following :

======================================

DATA : BEGIN OF line ,

num TYPE i,

sqr TYPE i,

END OF line,

itab TYPE STANDARD TABLE OF line WITH KEY table_line.

DO 5 TIMES.

line-num = sy-index .

line-sqr = sy-index ** 2.

APPEND line TO itab.

ENDDO.

LOOP AT itab INTO line.

WRITE : / line-num,line-sqr.

ENDLOOP.

CLEAR itab.

======================================

an error is checked on " APPEND line TO itab."

said as"A line of "ITAB" and "LINE" are not mutually convertible.In a Unicode program "ITAB" must have same structure layout as "LINE" independent of the length of a .Unicode character Unicode character "

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
439

Hi,

Just change the following declaration from

itab TYPE STANDARD TABLE OF line WITH KEY table_line

to

itab LIKE STANDARD TABLE OF line WITH KEY table_line.

Because line is declared using DATA statement.

Regards,

Nishant

Edited by: nishant gupta on Apr 13, 2008 1:43 PM

2 REPLIES 2
Read only

matt
Active Contributor
0 Likes
439
DATA: BEGIN OF line ,
        num TYPE i,
        sqr TYPE i,
     END OF line,
     itab TYPE STANDARD TABLE OF line WITH KEY table_line.

DO 5 TIMES.
  line-num = sy-index .
  line-sqr = sy-index ** 2.
  APPEND line TO itab.
ENDDO.

LOOP AT itab INTO line.
  WRITE : / line-num,line-sqr.
ENDLOOP.

CLEAR itab.

I can't see anything immediately obviously wrong. Try something like this:

TYPES: BEGIN OF line_type ,
         num TYPE i,
         sqr TYPE i,
       END OF line_type,

DATA: line TYPE line_Type
      itab TYPE STANDARD TABLE OF line_type WITH KEY table_line.

DO 5 TIMES.
  line-num = sy-index .
  line-sqr = sy-index ** 2.
  APPEND line TO itab.
ENDDO.

LOOP AT itab INTO line.
  WRITE : / line-num,line-sqr.
ENDLOOP.

CLEAR itab.

Read only

Former Member
0 Likes
440

Hi,

Just change the following declaration from

itab TYPE STANDARD TABLE OF line WITH KEY table_line

to

itab LIKE STANDARD TABLE OF line WITH KEY table_line.

Because line is declared using DATA statement.

Regards,

Nishant

Edited by: nishant gupta on Apr 13, 2008 1:43 PM