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 types

Former Member
0 Likes
538

Hi experts,

I have two internal tables.

data: g_mseg type mseg.

data: t_mseg like mseg occurs 0 with header line.

I have data in g_mseg table.

How can i transfer g_mseg data into t_mseg table?

Thanks

kaki

4 REPLIES 4
Read only

Former Member
0 Likes
506

Hi

G_MSEG here is structure and T_MSEG is internal table, both having the same structure.

  You can use below statement:

  append g_mseg to t_mseg.

Kind Regards

Eswar

Read only

gopi_narendra
Active Contributor
0 Likes
506

hi kaki,

g_mseg is like a work area, its not an internal table.

t_mseg is an internal table.

Just use the statement append

append g_mseg to t_mseg.

Regards

- Gopi

Read only

Former Member
0 Likes
506

U have decalred g_mseg in this way <b>g_mseg type mseg</b>, so this is not internal table but it is a structure.

Then you can have only one record at a time in g_mseg. To append the data u can do it in thsi way.

DATA: g_mseg TYPE mseg.

DATA: t_mseg LIKE mseg OCCURS 0 WITH HEADER LINE.

SELECT SINGLE * FROM mseg INTO g_mseg

WHERE mblnr = '0049000000'.

IF sy-subrc = 0.

APPEND g_mseg TO t_mseg.

IF sy-subrc = 0.

ENDIF.

ENDIF.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

former_member404244
Active Contributor
0 Likes
506

Hi kaki,

g_mseg is a work area, not an internal table where as

t_mseg is an internal table.Bothr having same structures.

use append statemnt .

append g_mseg to t_mseg.

regards,

nagaraj