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

insert?

Former Member
0 Likes
914

Hi how to insert internal table data to Ztable. please can any one tell me how to do that....

Thanks in advance....

Thanks and Regards

Siri....

8 REPLIES 8
Read only

Former Member
0 Likes
894

Hi,

Check this link

<http://help.sap.com/saphelp_nw04/helpdata/en/c4/93d942f7ca45b69dfdfd424c38332e/content.htm>

Reward if helpful.

Regards

Shibin

Read only

Former Member
0 Likes
894

Hi,


loop at itab into wa.
INSERT INTO SPFLI FROM WA.
endloop.


INSERT SPFLI FROM TABLE ITAB ACCEPTING DUPLICATE KEYS.

rgds,

bharat.

Read only

Former Member
0 Likes
894

Hi,

First Loop at internal Table into work area

Then Insert into data base table By

INSERT INTO <DAtabse Table> VALUES <workarea> .

Regards

Sandipan

Read only

Former Member
0 Likes
894

Hi,

Refer this sample code.

Loop at itab into wa.

insert into ztable values wa.

clear wa.

endloop.

Reward if helpful.

Regards,

Ramya

Read only

Former Member
0 Likes
894

Hi,

INSERT for Database Tables

Inserts entries from database tables.

Syntax

INSERT <dbtab> FROM <wa>.

INSERT <dbtab> FROM TABLE <itab> [ACCEPTING DUPLICATE KEYS].

Inserts one line from the work area <wa> or several lines from the internal table <itab> into the database table <dbtab>. The ACCEPTING DUPLICATE KEYS addition prevents a runtime error from occurring if two entries have the same primary key. Instead, it merely discards the duplicate

INSERT for Field Groups

Defines the structure of field groups for extract datasets.

Syntax

INSERT <f1>... <f n> INTO <fg>.

Includes the fields <fi> in the field group <fg>, thus defining a line structure for an extract dataset.

INSERT for any Internal Table

Inserts lines from internal tables of any type.

Syntax

INSERT <line>|LINES OF <jtab> [FROM <n1>] [TO <n 2>]

INTO TABLE <itab>

[ASSIGNING <FS> | REFERENCE INTO <dref>].

Inserts a line <line> or a set of lines from the internal table <jtab> into the internal table <itab>. If <jtab> is an index table, you can use the FROM and TO additions to restrict the lines inserted. If you use ASSIGNING or INTO REFERENCE, field symbol <FS> refers to the inserted line or the relevant data reference is stored in <dref> after the statement.

INSERT for Index Tables

Inserts entries in index tables.

Syntax

INSERT <line>|LINES OF <jtab> [FROM <n1>] [TO <n 2>]

INTO <itab> [INDEX <idx>]

[ASSIGNING <FS> | REFERENCE INTO <dref>].

Inserts a line <line> or a set of lines from the internal table <jtab> into the internal table <itab>before the line with the index <idx>. If <jtab> is an index table, you can use the FROM and TO additions to restrict the lines inserted. If you omit the INDEX addition, you can only use the statement within a LOOP. A new line containing values is inserted before the current line. If you use ASSIGNING or INTO REFERENCE, field symbol <FS> refers to the inserted line or the relevant data reference is stored in <dref> after the statement.

Regards,

Priya.

Read only

Former Member
0 Likes
894

Hi

INSERT { {INTO target VALUES source }

| { target FROM source } }.

Effect

The INSERT statement inserts one or more rows specified in source in the database table specified in target. The two variants with INTO and VALUES or without INTO with FROM behave identically, with the exception that you cannot specify any internal tables in source after VALUES.

Read only

dhruv_shah3
Active Contributor
0 Likes
894

Hi,

Check this thread.

[Ztable|;

Also Check This,

[Ztable|

;

HTH

Regards,

Dhruv Shah

Read only

Former Member
0 Likes
894

Hi,

There are two ways to insert values into database table from internal table

1- inset into <database table> values <work area>.

Example:

**Inserting a new airline company in the database table SCARR.

DATA scarr_wa TYPE scarr.

scarr_wa-carrid = 'FF'.

scarr_wa-carrname = 'Funny Flyers'.

scarr_wa-currcode = 'EUR'.

scarr_wa-url = 'http://www.funnyfly.com'.

INSERT INTO scarr VALUES scarr_wa.

2- Insert <databasetable> from <wa>.

example:

data: ws_joblog type zfact_maint_jlog.

ws_joblog-template_id = '1234'.

ws_joblog-version = '1.0.0'

ws_joblog-lock_date = sy-datum.

ws_joblog-lock_time = sy-uzeit.

INSERT zfact_maint_jlog FROM ws_joblog.

and after insert statement use COMMIT WORK AND WAIT . to adjust the inserted records in data base table.

Thnaks,

Vipin