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: 

Internal table

Former Member
0 Kudos

Hi all,

i am new to abap so orking on my skills. i have declared 2 tables as below, i can populate the data in one table(itab) but could not do the same in another(jtab).

Can some one please rectify the mistake iam doing.

REPORT ZPRACTICE NO STANDARD PAGE HEADING.

DATA: BEGIN OF ITAB occurs 0,

CARRID LIKE SPFLI-CARRID,

CONNID LIKE SPFLI-CONNID,

CITYFROM LIKE SPFLI-CITYFROM,

END OF ITAB.

data: jtab like table of itab with header line.

select carrid connid cityfrom from spfli into table itab up to 5

rows.

move-corresponding itab to jtab.

loop at jtab.

write:/ jtab-cityfrom.

endloop.

uline.

loop at itab.

write: /5(3) itab-carrid, 9(5) itab-connid.

endloop.

regards

Rahul.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Rahul - try:


select carrid connid cityfrom from spfli
  into table itab
  up to 5 rows.

loop at itab
  move-corresponding itab to jtab.
  modify jtab.
  write:/ jtab-cityfrom.
endloop.

Rob

9 REPLIES 9

Former Member
0 Kudos

Rahul - try:


select carrid connid cityfrom from spfli
  into table itab
  up to 5 rows.

loop at itab
  move-corresponding itab to jtab.
  modify jtab.
  write:/ jtab-cityfrom.
endloop.

Rob

0 Kudos

Thanks Rob.

For one think, it takes me to shot dump when i reach the statement modify jtab. It says some like cursor is not set for the position for which i want to modify.

Anyway, You got your points.

Regards

Rahul

0 Kudos

I didn't notice how you declared jtab. You need to declare a work are with the same structure and move data to that. Then

append wa_jab to jtab.

Rob

0 Kudos

<b>

loop at itab.
move-corresponding itab to jtab.
append jtab.
endloop.

</b>

istead of modify use append.

regards

vijay

former_member188685
Active Contributor
0 Kudos

try the dark one

and this will help you.

REPORT ZPRACTICE NO STANDARD PAGE HEADING.

DATA: BEGIN OF ITAB occurs 0,

CARRID LIKE SPFLI-CARRID,

CONNID LIKE SPFLI-CONNID,

CITYFROM LIKE SPFLI-CITYFROM,

END OF ITAB.

data: jtab like table of itab with header line.

select carrid connid cityfrom from spfli into table itab up to 5

rows.

<b>loop at itab.

move-corresponding itab to jtab.

modify jtab.

endloop.</b>

loop at jtab.

write:/ jtab-cityfrom.

endloop.

uline.

loop at itab.

write: /5(3) itab-carrid, 9(5) itab-connid.

endloop.

regards

vijay

reward points if it helps you

Former Member
0 Kudos

Try this.

REPORT ZPRACTICE NO STANDARD PAGE HEADING.

DATA: BEGIN OF ITAB occurs 0,

CARRID LIKE SPFLI-CARRID,

CONNID LIKE SPFLI-CONNID,

CITYFROM LIKE SPFLI-CITYFROM,

END OF ITAB.

data: jtab like table of itab with header line.

select carrid connid cityfrom from spfli into table itab up to 5

rows.

<b>jtab[] = itab[].</b>

loop at jtab.

write:/ jtab-cityfrom.

endloop.

uline.

loop at itab.

write: /5(3) itab-carrid, 9(5) itab-connid.

endloop.

Former Member
0 Kudos

try this one kesi,

***********************

REPORT ZPRACTICE NO STANDARD PAGE HEADING.

DATA: BEGIN OF ITAB OCCURS 0,

CARRID LIKE SPFLI-CARRID,

CONNID LIKE SPFLI-CONNID,

CITYFROM LIKE SPFLI-CITYFROM,

END OF ITAB.

DATA: JTAB LIKE ITAB OCCURS 0 WITH HEADER LINE .

SELECT CARRID CONNID CITYFROM FROM SPFLI INTO TABLE ITAB UP TO 5

ROWS.

LOOP AT ITAB.

MOVE-CORRESPONDING ITAB TO JTAB.

COLLECT: JTAB.

ENDLOOP.

LOOP AT JTAB.

WRITE:/ JTAB-CITYFROM.

ENDLOOP.

ULINE.

LOOP AT ITAB.

WRITE: /5(3) ITAB-CARRID, 9(5) ITAB-CONNID.

ENDLOOP.

Former Member
0 Kudos

hI,

uSE LIKE THIS,

ITAB1[] = ITAB2[].

APPEND ITAB1.

OTHERWISE,

MOVE ITAB1 TO ITAB2.

APPEND ITAB1.

Former Member
0 Kudos

Hi,

I think jtab[] = itab[] statement will slove your problem rather than move-corresponding itab to jtab.

regards,

Amey