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

HI ALL LOOP

Former Member
0 Likes
912

loop at itab8 where MANDT eq '' and zwerks eq ''.

MOVE ITAB7-MANDT TO ITAB8-MANDT.

MOVE ITAB7-ZWERKS TO ITAB8-ZWERKS.

MOVE ITAB7-ZLDAT TO ITAB8-ZLDAT.

MOVE ITAB7-ZBLDAT TO ITAB8-ZBLDAT.

APPEND ITAB8.

endloop.

IN THE ABOVE CODE, DATA IS GOING INTO ITAB8 BUT IT IS ADDING IN THE ITAB TABLE INSTEAD OF GOING INTO THE RECORDS OF ITAB8.

CAN ANY ONE SUGGEST HOW TO PASS ITAB7 DATA INTO THE RECORDS OF ITAB8 IN THE ABOVE CODE.

ACTUALLY IT HAS 4 FIELDS AND ALL FOUR FIELD DATA IS REPEATED IN ALL RECORDS, I HAVE TO JUST PASS THIS DATA INTO EXISTING BLANK FIELDS OF ITAB8.

THANX

ROCKY

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
830

Hi,

Change ur code like below...

 
MOVE ITAB7-MANDT TO ITAB8-MANDT.
MOVE ITAB7-ZWERKS TO ITAB8-ZWERKS.
MOVE ITAB7-ZLDAT TO ITAB8-ZLDAT.
MOVE ITAB7-ZBLDAT TO ITAB8-ZBLDAT.
MODIFY itab8 TRANSPORTING MANDT ZWERKS ZLDAT ZBLDAT where MANDT = ' ' and  ZWERKS = ' '.

Cheers,

jose.

6 REPLIES 6
Read only

Former Member
0 Likes
830

Use Collect instead of Append.

awrd points if useful

Bhupal

Read only

Former Member
0 Likes
831

Hi,

Change ur code like below...

 
MOVE ITAB7-MANDT TO ITAB8-MANDT.
MOVE ITAB7-ZWERKS TO ITAB8-ZWERKS.
MOVE ITAB7-ZLDAT TO ITAB8-ZLDAT.
MOVE ITAB7-ZBLDAT TO ITAB8-ZBLDAT.
MODIFY itab8 TRANSPORTING MANDT ZWERKS ZLDAT ZBLDAT where MANDT = ' ' and  ZWERKS = ' '.

Cheers,

jose.

Read only

Former Member
0 Likes
830

Hi Rocky,

Take another table, say ITAB8_1 with the same structure of ITAB8 and try using the following code,

loop at itab8 where MANDT eq '' and zwerks eq ''.

MOVE ITAB7-MANDT TO ITAB8_1-MANDT.

MOVE ITAB7-ZWERKS TO ITAB8_1-ZWERKS.

MOVE ITAB7-ZLDAT TO ITAB8_1-ZLDAT.

MOVE ITAB7-ZBLDAT TO ITAB8_1-ZBLDAT.

APPEND ITAB8_1.

endloop.

clear ITAB8.

MOVE ITAB8_1 to ITAB8.

please award points if helpful.

Read only

Former Member
0 Likes
830

can u clearly ask whats the problem..

what exactly expecting from the program..

Read only

Former Member
0 Likes
830

loop at itab8 where MANDT eq '' and zwerks eq ''.

MOVE ITAB7-MANDT TO ITAB8-MANDT.

MOVE ITAB7-ZWERKS TO ITAB8-ZWERKS.

MOVE ITAB7-ZLDAT TO ITAB8-ZLDAT.

MOVE ITAB7-ZBLDAT TO ITAB8-ZBLDAT.

modify ITAB8.

endloop.

You have to use modify instead of Append.

Read only

Former Member
0 Likes
830

instaed of appned use modify statment.

modify itab8 transporting fileds mandt zwerks zldat zbldat.

this will modify the exsting intrenal table records.