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

Write contents from internal table in dictionary table

Former Member
0 Likes
2,451

Hi all,

I would like to write the content of an internal table in a dictionary table (ztable).

I do not know how to get this. I was trying an example with sflight and zsflight.

Can some one please show me some coding?

Please give me some help.

Kind regards

Peter

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,526

Hi

DATA: ITAB TYPE TABLE OF SFLIGHT WITH HEADER LINE.

*Assign values to each column as ITAB-FIELD = VALUE. OR

SELECT * FROM SFLIGHT INTO TABLE ITAB. "Copy from Sflight into internal table

LOOP AT ITAB.

INSERT ZSFLIGHT FROM ITAB. "Copy from internal table to zsflight

ENDLOOP.

Hope this helps

Regards,

Jayanthi.K

Hi all,

I would like to write the content of an internal table in a dictionary table (ztable).

I do not know how to get this. I was trying an example with sflight and zsflight.

Can some one please show me some coding?

Please give me some help.

Kind regards

Peter

11 REPLIES 11
Read only

Former Member
0 Likes
1,526

Hi,

insert ztable from table itab.

This query works fine...

Regards,

Siddarth

Read only

Former Member
0 Likes
1,526

Tables : zsflight.

DATA : BEGIN OF ITAB OCCURS 0.

INCLUDE STRUCTURE ZSFLIGHT.

DATA END OF ITAB.

ITAB-FNAME = XXXX.

ITAB-FNAME = XXXX.

APPEND ITAB INTO ZSFLIGHT.

OR ELSE TRY THE UPDATE STATEMENT.

OR ELSE THE INSERT STATEMENT WORKS FINE.

I THINK THIS SHOULD WORK.

Read only

Former Member
0 Likes
1,526

and dont forget to do commit work after this.

кu03B1ятu03B9к

Read only

Former Member
0 Likes
1,526

Hi,

If you want to write new contents then use INSERT statement.



INSERT INTO zsflight FROM TABLE <internal table>.

If you want to modify the existing record in table then use MODIFY statement.


MODIFY zsflight FROM TABLE <internal table>

Hope this helps u.

Thanks.

Read only

rejish_balakrishnan
Contributor
0 Likes
1,526

HI,

INSERT ztable FROM TABLE itab.

But make sure that itab has a same structure of ztable.(Number of fields and type of fields).

Read only

Former Member
0 Likes
1,526

Hi Peter ,

DATA: t_sflight LIKE TABLE OF sflight.

Now populate internal table t_sflight with the required records.

INSERT sflight FROM TABLE t_sflight.

Regards

Pinaki

Read only

Former Member
0 Likes
1,527

Hi

DATA: ITAB TYPE TABLE OF SFLIGHT WITH HEADER LINE.

*Assign values to each column as ITAB-FIELD = VALUE. OR

SELECT * FROM SFLIGHT INTO TABLE ITAB. "Copy from Sflight into internal table

LOOP AT ITAB.

INSERT ZSFLIGHT FROM ITAB. "Copy from internal table to zsflight

ENDLOOP.

Hope this helps

Regards,

Jayanthi.K

Read only

Former Member
0 Likes
1,526

Hi,

refer this code.

DATA :

fs TYPE <tablename>.

( fill the field string with values required )

ex:

fs-id = 10.

fs-name = 'XYZ'.

INSERT into <tablename> values fs.

OR

U can also use internal table dirrectly.

insert <tablename> from table itab.

This works fine.

Read only

Former Member
0 Likes
1,526

Thanks alot for the help.

Kind regards

Peter

Read only

Former Member
0 Likes
1,526

Hi,

Go through this abap help.

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/frameset.htm

Hope this helps.

Regards,

Deepthi.

Read only

Former Member
0 Likes
1,526

Hi,

you may use the statement as:

insert <ztable name> from table <ITAB>.

this will update your ztable.