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

Question regarding populating Internal table values

Former Member
0 Likes
298

Hello,

I have 2 internal tables as mentioned below

Table I

F1 F2

VBELN XXXX

AEDAT 01/01/2005

F1 & F2 are fields of Table I

Table II

VBELN AEDAT

Is it possible to populate the values of Table I to

Table II based the field names which is one of the values in Table I ?. These 2 tables doesn't have the same fields.

After copying the values in Table II should be

Table II

VBELN AEDAT

XXXX 01/01/2005

Thanks in advance,

Jay

1 ACCEPTED SOLUTION
Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
271

Hi Jay

As far as I understood, you can achieve this using field symbols. Look at the following sample code. There I assume your internal tables <i>table_1</i> and <i>table_2</i> having their header lines.

<u>E.g.</u>


FIELD-SYMBOLS <f> .

LOOP AT table_1 .
  
  ASSIGN COMPONENT (table_1-f1) 
         OF STRUCTURE table_2 
         TO <f> .
  IF sy-subrc = 0 .
    <f> = table_1-f2 .
  ENDIF .

ENDLOOP .

APPEND table_2 .
UNASSIGN <f> .

Hope this much helps...

Kind Regards

*--Serdar

ssimsekler@yahoo.com

1 REPLY 1
Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
272

Hi Jay

As far as I understood, you can achieve this using field symbols. Look at the following sample code. There I assume your internal tables <i>table_1</i> and <i>table_2</i> having their header lines.

<u>E.g.</u>


FIELD-SYMBOLS <f> .

LOOP AT table_1 .
  
  ASSIGN COMPONENT (table_1-f1) 
         OF STRUCTURE table_2 
         TO <f> .
  IF sy-subrc = 0 .
    <f> = table_1-f2 .
  ENDIF .

ENDLOOP .

APPEND table_2 .
UNASSIGN <f> .

Hope this much helps...

Kind Regards

*--Serdar

ssimsekler@yahoo.com