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

how to insert data from different internal table into a data base table

Former Member
0 Likes
780

hi all,

I want to insert a particular field in an internal table to a field in a data base table.Note that the fields in the internal table and database table are not of the same name since i need to insert data from different internal tables.can some one tell me how to do this?

in short i want to do something like the foll:

INSERT INTO ZMIS_CODES-CODE VALUE '1'.

*INSERT INTO ZMIS_CODES-COL1 VALUE DATA_MTD-AUFNR .(zmis_codes is the db table and data_mtd is the int.table)

4 REPLIES 4
Read only

Sandra_Rossi
Active Contributor
0 Likes
634

Hi subhabrata bishnu choudhury,

you have no other choice than either inserting one whole record with all fields from a structured data object (what is important is the order of the fields is identical (and preferrably the data types of course), not the names), or several records (and all fields) from an internal table (same remark as for the structure).

Refer to the ABAP documentation for more information about INSERT (dbtab).

Sandra

Read only

Former Member
0 Likes
634

This message was moderated.

Read only

vikrant_guptarya
Participant
0 Likes
634

Do you have just one field in you Ztable? If yes make sure the technical attributes of the fields & matches with the field in the internal table

Read only

Former Member
0 Likes
634

REPORT ZINSERT.

tables kna1.

data: itab LIKE KNA1.

data lv_kUNAG LIKE KNA1-KUNNR.

lv_kuNAG = '0000010223'.

ITAB-kuNNR = lv_kuNAG.

ITAB-name1 = 'XYZ'.

INSERT INTO KNA1 VALUES ITAB.

IF SY-SUBRC = 0.

WRITE:/ 'SUCCESS'.

ELSE.

WRITE:/ 'FAILED'.

ENDIF.

Here lv_kunag is ref to kna1 kunnr passed in different name

In internal table .

Try and let me know if this logic dint work.