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

Internal table

Former Member
0 Likes
833

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
Read only

Former Member
0 Likes
804

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
Read only

Former Member
0 Likes
805

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

Read only

0 Likes
804

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

Read only

0 Likes
804

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

Read only

0 Likes
804

<b>

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

</b>

istead of modify use append.

regards

vijay

Read only

Former Member
0 Likes
804

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

Read only

Former Member
0 Likes
804

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.

Read only

Former Member
0 Likes
804

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.

Read only

Former Member
0 Likes
804

hI,

uSE LIKE THIS,

ITAB1[] = ITAB2[].

APPEND ITAB1.

OTHERWISE,

MOVE ITAB1 TO ITAB2.

APPEND ITAB1.

Read only

Former Member
0 Likes
804

Hi,

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

regards,

Amey