‎2007 Dec 23 7:30 PM
Hi any body pls explain me how to transfer data from internal table to data base table.
‎2007 Dec 24 5:24 AM
‎2007 Dec 24 4:39 AM
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
‎2007 Dec 24 5:24 AM
‎2008 Mar 06 11:07 AM
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.
‎2007 Dec 24 6:56 AM
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^
‎2007 Dec 24 9:14 AM
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