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

moving data from internal table to data base table

Former Member
0 Likes
596

Hi any body pls explain me how to transfer data from internal table to data base table.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
569

Hi,

using bdc you can achieve this

Regards

5 REPLIES 5
Read only

Former Member
0 Likes
569

Hi Kaladhar,

suppose u have a DB table named ZTEST. having 3 fields ID NAME AGE.

u declare TABLES: ZTEST in your program.

ZTEST-ID = '01',

ZTEST-NAME = 'XXXX'.

ZTEST-AGE = '20'

INSERT ZTEST. " it'll insert this row into the table

if u declare a structure in DATA section. u can do it in this way:

INSERT ZTEST VALUES RECORD. "record has the same structure.

if u have an int tab , do it:

INSERT ZTEST FROM T_RECORD.

also see UPDATE, DELETE, MODIFY statements.

Reward if useful

Regards

ANUPAM

Read only

Former Member
0 Likes
570

Hi,

using bdc you can achieve this

Regards

Read only

0 Likes
569

HI ,

I am Bharat . How we can do this by bdc . If I have uploaded the data from flat file into internal table and i want to insert those into the database table .

Can u send me the code for that. It will be verymuch helpful for me ..

Thanks&Regards.

Bharat.

Read only

Former Member
0 Likes
569

hi

good

You can do this by two ways either using Insert statement or modify statement.

loop at itab into wa_itab.

*use this

in this case it will insert new record

INSERT INTO scarr VALUES wa_itab.

*or use this.

in this case it will first modify the record

*if it is exits otherwise insert a new entry

MODIFY INTO scarr VALUES wa_itab.

endloop.

Reward Points, if useful.

thanks

mrutyun^

Read only

Former Member
0 Likes
569

Hi

modifying datbase table useing internal table

advises before updating this datbase table plz lock that table to avoid incosistency

write the logic for modifying

  • Modify the database table as per new dunning procedure

MODIFY fkkvkp FROM TABLE lt_fkkvkp .

and finally unlock the table

example

*To lock table for further operations

constants: lc_tabname TYPE rstable-tabname VALUE 'FKKVKP' . "FKKVKP

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

tabname = lc_tabname

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc EQ 0.

  • To fetch all the contract accounts for customers of the segment

  • Households/SME.

PERFORM fetch_contract_accounts using lc_tabname .

ENDIF. " IF sy-subrc EQ 0.

*wrote the logic

  • Modify the database table as per new dunning procedure from internal table

MODIFY fkkvkp FROM TABLE lt_fkkvkp .

*unlock the tbale

CALL FUNCTION 'DEQUEUE_E_TABLE'

EXPORTING

TABNAME = uc_tabname .

Reward if usefull