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

appending fields

Former Member
0 Likes
635

Hi all,

i have two internal tables.

one table have Mandt key extra comparing to other internal table.

and both have remaining all the fields same.

Now i want to insert all the fields from the internal table which dont have mandt key to another internal table which have mandt key.

i dont want to use loop.

how can i insert the fields.???

Regards,

CSR.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
605

Example let say your internal tables has following structure:

ITAB1.

FLD01

FLD02

FLD03

ITAB2.

FLD01

FLD02

FLD03

EXTRA_FIELD. "This should be the last field in your internal table.

"in both internal table all identical fields(name, type) fields

"should be in the same order and position.

  • Moving one table contents to another.

ITAB2[] = ITAB1[].

Your contents will be copied as desired by you.

Regards,

A.Singh

5 REPLIES 5
Read only

Former Member
0 Likes
605

see the below code which is inserting data from work area to internal table .

DATA: BEGIN OF connection, 
        cityfrom TYPE spfli-cityfrom, 
        cityto   TYPE spfli-cityto, 
        distid   TYPE spfli-distid, 
        distance TYPE spfli-distance, 
      END OF connection. 

DATA connection_tab LIKE SORTED TABLE OF connection 
                    WITH UNIQUE KEY cityfrom cityto 
                                    distid distance. 

SELECT cityfrom cityto distid distance 
       FROM spfli 
       INTO connection. 
  INSERT connection INTO TABLE connection_tab. 
ENDSELECT. 

reward points if it is usefull....

Girish

Read only

Former Member
0 Likes
606

Example let say your internal tables has following structure:

ITAB1.

FLD01

FLD02

FLD03

ITAB2.

FLD01

FLD02

FLD03

EXTRA_FIELD. "This should be the last field in your internal table.

"in both internal table all identical fields(name, type) fields

"should be in the same order and position.

  • Moving one table contents to another.

ITAB2[] = ITAB1[].

Your contents will be copied as desired by you.

Regards,

A.Singh

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
605

Hi,

Try this. The mandt field should be listed atlast in the internal table.

data : begin of ty1 occurs 0,

b ,

mandt(3) ,

end of ty1.

data : begin of ty2 occurs 0,

b ,

end of ty2.

ty2-b = 'B'.

append ty2.

ty2-b = 'C'.

append ty2.

ty1[] = ty2[].

ty1-a = '300'.

modify ty1 transporting a where not b is initial.

loop at ty1.

write : / ty1.

endloop.

Read only

Former Member
0 Likes
605
Read only

0 Likes
605

This message was moderated.