Loading internal table to database table
Hi all,
I have created a ztable .also i created an internal table with the same structure as ztable.I have some data in internal table.how to load these data from internal table into database table.how thre insert statement will be.
Hi,
Check whether entries are there in the internal table. Also check for the structure.
MODIFY dbtab FROM TABLE itab.
UPDATE dbtab FROM TABLE itab.
just read this.
If you just want to write (INSERT) 1.5 million rows of an internal table into a database table, use:
INSERT <table name> FROM TABLE <itab>.
Transaction Log Size could be a problem, therefore writing in packages could help, but this depends on your row size, your database configuration and on the current changes to your database. May be it runs in one package, if the rows are small (few bytes) then one package will be the fastest but you'll not much faster than with reasonable packages (3-20 MBytes). On Oracle with rollback segments you will probably have no problems at 1.5 million rows.
<b>Rewrad points</b>
Regards
Similar Messages
-
Loading XML files into Database table
Loading XML files into Database table
Hi I have some XML files say 100 files in a virtual directory created using "Create or replace directory command" and those files need to be loaded into a table having a column of XMLTYPE. 1)How to load that using Oracle provided procedures/packagesCheck out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
Ben -
Apply check tables to database tables
how to apply check tables to database tables???
plz helpHi
Check Table: means the Table that contains the Primary key in the Foreign key definition.
It has 2 important uses:
1. To validate the inputs in the foriegn key field (For Eg: MARC-MATNR) with the values existing in the check table - Primary key field (Eg: MARA-MATNR)
Here MARA is the Check table for the MARC-MATNR
2. To provide the input help(F4) for foreign key field
check table is the field level checking. we can use the Cardinality based on ur requirment.
see the example.
if ur using two tables like ekko and ekpo.
ekko tables having the fields ebeln , bukrs and lifnr.
here primery key is ebeln.
ebeln bukrs lifnr
101 1000 1000
102 1000 1000
103 2000 1001(this is entry for ekko).
we want to insert the entry based on ekko tables.so ekko table is the ckeck table.
ekpo table is the itam table.
ekpo tables having the fields ebeln , matnr , menge .
here forign key is ebeln.
ebeln matnr menge
101 m-1 10
101 m-2 2
101 m-4 18
102 m-8 7
103 m-5 8
in ekpo table we can't enter other than ekko-ebeln value.
so we can enter only based on ekko-ebeln table entries. -
Is it possible to update internal table from database table
Hello All:
I know how to update database table from internal table in one shot (batch) but is the reverse possible? Can I update some fields in an internal table from a database table in one shot (without looping) because my internal table is huge? Could you please provide me any ideas how to acheive something like this? Thanks in advance and answers will be rewarded.
thanks.
MithunHello my friend,
You can do it MAYBE , i think you can reverse the update doing a ROLLBACK, but only after you update....not after the program finishes..
To update some fields at once use:
UPDATE DBTABLE FROM TABLE IT_TABLE
Hope this helps!!
Gabriel -
Easy way to write out internal table to database table ?
hi friends,
i have a special requirement:
as i do not want to change the profile settings on an r/3 4.6c machine, i want to modify my program so it can handle even large amount of data. the plan is to fill internal table and for say every 100000 rows write those out to a table on database. how could i do this most performant ?
thanks,
clemensHi Clemens,
This solution worked for me, which was suggested by Seshu. May be you can try this,
Modify ZPPPRICE(your database table name) from table t_final(internal table name).
In my case I updated Custom table.
The internal table is of same structure as database table.
Modify command will insert the record the record if it is new, if the record is existing then it will update the record with the internal table values.
I got data from Excel file in to my internal table.
Regards,
Neelu. -
Fastest way to write out internal table to database table ?
Hi friends,
my question is, what is the fastest way to write about 1,5 mill. of rows from an internal table to a database table ?
points will be awarded immediately,
thanks for your help,
clemensHi Clemens,
If you just want to write (INSERT) 1.5 million rows of an internal table into a database table, use:
INSERT <table name> FROM TABLE <itab>.
Transaction Log Size could be a problem, therefore writing in packages could help, but this depends on your row size, your database configuration and on the current changes to your database. May be it runs in one package, if the rows are small (few bytes) then one package will be the fastest but you'll not much faster than with reasonable packages (3-20 MBytes). On Oracle with rollback segments you will probably have no problems at 1.5 million rows.
Best regards
Ralph -
REG:Internal table and Database table
Hi Xperts,
Can you tell me /give me a sample code so as to
Compare the data present in the database table and internal table.i.e
Wheher the data in the db table matches with the data in the internal table
Thanks.Hello,
First make sure that data is there in the internal table
TABLES : Declare your table example MARA, VBAK etc
TYPES: BEGIN OF ITAB1,
Declare your fields here
example
v_mat(10) type c,
v_code(5) type I,
END OF ITAB1.
IF NOT ITAB[] is INITIAL.
LOOP AT
END IF.
To compare the data with DB tables, read the database table and copy into the internal table ITAB2
Then compare the ITAB and ITAB1
IF ITAB1[] = ITAB2[]
END IF
See these links for [Creating Internal Tables|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3660358411d1829f0000e829fbfe/content.htm]
[Comparing Internal Tables|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3841358411d1829f0000e829fbfe/content.htm]
See this for more about [Processing Internal Tables|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb36ae358411d1829f0000e829fbfe/content.htm]
Declaring the internal table in ABAP objects
[Thanks|http://chandranonline.blogspot.com/]
[Chandran|http://chandranonline.blogspot.com/] -
Inserting records from internal table to database table
Hi all,
i want to insert records from internal table to zDatabase table, can u plz guide me which statement is better in performance to insert the records.
1) insert one by one record from internal table
loop at itab.
insert ztable from wa.
endloop.
2) insert total records at a time
INSERT <dbtabname> CLIENT SPECIFIED FROM TABLE itab.
or let me know if any other statement is there with high performance.
i internal table contains nearly 40000 records.
thanks.Hi,
Insert the entire table at atime rather than a record so as to increase the performance.
you can use INSERT <dbtabname> CLIENT SPECIFIED FROM TABLE itab.
or
MODIFY ZPRODUCT FROM TABLE GI_AFPO.
Regards,
Raj. -
Define hashed table using database table
Hi,
I have a database table and would want to define a hashed table using this table structure, how would I do that?
Thanks
RTHi Rob,
The syntax is as follows,
DATA ITAB TYPE HASHED TABLE OF SPFLI
WITH UNIQUE KEY CARRID CONNID.
The table object ITAB has the type hashed table, a line type corresponding to the flat structure SPFLI from the ABAP Dictionary, and a unique key with the key fields CARRID and CONNID. The internal table ITAB can be regarded as an internal template for the database table SPFLI. It is therefore particularly suitable for working with data from this database table as long as you only access it using the key. -
How to attach a text table to database table
How to attach a text table to another database table,
Ex: If we check Mara table and GoTO menu select text table it is displaying MAKT table, how to link that?create another table with foriegn key relation with the key field and in the check table give the primary key table and in the text table include sparas field.
JUAT SAME AS CREATING ANOTHER TABLE WITH FORIEGN KEY RELATION but THE ANOTHER TABLE INCLUDES SPRAS (LANGUAGE KEY)
A text table is a table that contains spoken-language descriptions of values in a check table. These descriptions are stored in multiple languages. The primary key of the text table is the same as the primary key of the check table, with the addition of a spras (language) column.
For example, the ztxt005 table has country codes in it. Country names are stored in a separate table named ztxt005t (shown in Figure 4.7) because you actually need many names for one country code. Because it stores language-specific descriptions of a generalized code, ztxt005t is called a text table.
The primary key of ztxt005t contains the same fields as the primary key of ztxt005, with the addition of a spras (language) column. The spras field contains the language code and enables this table to contain a description for multiple logon languages.
The primary key of any text table is composed of the fields mandt and spras, followed by the validation field (or fields). One or more description fields follow this primary key.
A foreign key relationship is defined on ztxt005t-land1 to check table ztxt005. The foreign key field type should be key fields of a text table. -
Portal events are not getting loaded into the Analytics database tables
Analytics database ASFACT tables (ASFACT_PAGEVIEWS,ASFACT_PORLETVIEW) are not getting populated with data.
Possible diagnosis/workarounds tried:
-Checked the analytics configuration in configuration manager, Enable Analytics Communication option checked
-Registered Portal Events during analytics installation
-Verified that UDP events are sent out from the portal: Test: OK
-Reinstalled Interaction analytics component
Any inputs highly appreciated.
Cheers,
Sandeep
In collector.log, found the exception:
08 Jul 2010 07:12:54,613 ERROR PageViewHandler - could not retrieve user: com.plumtree.analytics.collector.exception.DimensionManagerException: Could not insert dimension in the database
com.plumtree.analytics.collector.exception.DimensionManagerException: Could not insert dimension in the database
at com.plumtree.analytics.collector.cache.DimensionManager.insertDB(DimensionManager.java:271)
at com.plumtree.analytics.collector.cache.DimensionManager.manageDBImage(DimensionManager.java:139)
at com.plumtree.analytics.collector.cache.DimensionManager.handleNewDimension(DimensionManager.java:85)
at com.plumtree.analytics.collector.eventhandler.BaseEventHandler.insertDimension(BaseEventHandler.java:63)
at com.plumtree.analytics.collector.eventhandler.BaseEventHandler.getUser(BaseEventHandler.java:198)
at com.plumtree.analytics.collector.eventhandler.PageViewHandler.handle(PageViewHandler.java:71)
at com.plumtree.analytics.collector.DataResolver.handleEvent(DataResolver.java:165)
at com.plumtree.analytics.collector.DataResolver.run(DataResolver.java:126)
Caused by: org.hibernate.MappingException: Unknown entity: com.plumtree.analytics.core.persist.BaseCustomEventDimension$$BeanGeneratorByCGLIB$$6a0493c4
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:569)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1086)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:83)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
at com.plumtree.analytics.collector.cache.DimensionManager.insertDB(DimensionManager.java:266)
... 7 more
In analyticsui.log, found the exception below:
08 Jul 2010 06:50:25,910 ERROR Configuration - Could not compile the mapping document
org.hibernate.MappingException: duplicate import: com.plumtree.analytics.core.persist.BaseCustomEventFact$$BeanGeneratorByCGLIB$$6a896b0d
at org.hibernate.cfg.Mappings.addImport(Mappings.java:105)
at org.hibernate.cfg.HbmBinder.bindPersistentClassCommonValues(HbmBinder.java:541)
at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:488)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:234)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
at org.hibernate.cfg.Configuration.add(Configuration.java:362)
at org.hibernate.cfg.Configuration.addXML(Configuration.java:317)
at com.plumtree.analytics.core.HibernateUtil.loadEventMappings(HibernateUtil.java:796)
at com.plumtree.analytics.core.HibernateUtil.loadEventMappings(HibernateUtil.java:652)
at com.plumtree.analytics.core.HibernateUtil.refreshCustomEvents(HibernateUtil.java:496)
at com.plumtree.analytics.ui.common.AnalyticsInitServlet.init(AnalyticsInitServlet.java:104)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4045)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4351)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.plumtree.container.Bootstrap.start(Bootstrap.java:531)
at com.plumtree.container.Bootstrap.main(Bootstrap.java:254)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.tanukisoftware.wrapper.WrapperStartStopApp.run(WrapperStartStopApp.java:238)
at java.lang.Thread.run(Thread.java:595)
08 Jul 2010 06:50:25,915 ERROR Configuration - Could not configure datastore from XML
org.hibernate.MappingException: duplicate import: com.plumtree.analytics.core.persist.BaseCustomEventFact$$BeanGeneratorByCGLIB$$6a896b0d
at org.hibernate.cfg.Mappings.addImport(Mappings.java:105)
at org.hibernate.cfg.HbmBinder.bindPersistentClassCommonValues(HbmBinder.java:541)
at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:488)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:234)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
at org.hibernate.cfg.Configuration.add(Configuration.java:362)
at org.hibernate.cfg.Configuration.addXML(Configuration.java:317)
at com.plumtree.analytics.core.HibernateUtil.loadEventMappings(HibernateUtil.java:796)
at com.plumtree.analytics.core.HibernateUtil.loadEventMappings(HibernateUtil.java:652)
at com.plumtree.analytics.core.HibernateUtil.refreshCustomEvents(HibernateUtil.java:496)
at com.plumtree.analytics.ui.common.AnalyticsInitServlet.init(AnalyticsInitServlet.java:104)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4045)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4351)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.plumtree.container.Bootstrap.start(Bootstrap.java:531)
at com.plumtree.container.Bootstrap.main(Bootstrap.java:254)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.tanukisoftware.wrapper.WrapperStartStopApp.run(WrapperStartStopApp.java:238)
at java.lang.Thread.run(Thread.java:595)
wrapper_collector.log
INFO | jvm 1 | 2009/11/10 17:25:22 | at com.plumtree.analytics.collector.eventhandler.PortletViewHandler.handle(PortletViewHandler.java:46)
INFO | jvm 1 | 2009/11/10 17:25:22 | at com.plumtree.analytics.collector.DataResolver.handleEvent(DataResolver.java:165)
INFO | jvm 1 | 2009/11/10 17:25:22 | at com.plumtree.analytics.collector.DataResolver.run(DataResolver.java:126)
INFO | jvm 1 | 2009/11/10 17:25:22 | Caused by: java.sql.SQLException: [plumtree][Oracle JDBC Driver][Oracle]ORA-00001: unique constraint (ANALYTICSDBUSER.IX_USERBYUSERID) violated
INFO | jvm 1 | 2009/11/10 17:25:22 |
INFO | jvm 1 | 2009/11/10 17:25:22 | at com.plumtree.jdbc.base.BaseExceptions.createException(Unknown Source)Key words from the error msg suggests reinstallation of Analytics is needed to resolve this.Analytics database is failing to get updated with the correct event mapping and this is why no data is being inserted.
"Could not insert dimension in the database",
"ERROR Configuration - Could not configure datastore from XML
org.hibernate.MappingException: duplicate import: com.plumtree.analytics.core.persist.BaseCustomEventFact$$BeanGeneratorByCGLIB$$6a896b0d"
"ORA-00001: unique constraint (ANALYTICSDBUSER.IX_USERBYUSERID) violated",
"ERROR Configuration - Could not compile the mapping document -
Insert or Modify statement from internal table to database table
Hi All,
I have three tables wakh, wrf and wakp. I have an internal table with 5 columns col1, col2, col3, col4 and col5.
The value in Col1 is my article no and the articleno. is in the table wakh. The value in col2 is my ccode and it is in the table wrf. The rest three columns col3, col4 and col5 are unit, qty and price and they are in the wakp table. Now when my articleno is equal to ccode I need to update the col3, col4 and col5 values in the wakp. wakp has around 20 columns.
Can anyone of you guys please give me the code for this issue. Your help is highly appreciated and thanks for all for your time.
Cheers,
ChengHi Rob,
let me explain you the whole process what i am trying to do. I have a screen where there are 3 fields. In my first field I have a promoiton no. As soon as the user enters the promotion no. its description will be populated in my second field. If the promotion is not maintained then it will throw an error. In my third field User will upload an excel sheet which has 5 columns articleno, colorcode, salesunit, qty, mdprice. Here articleno is coming from wakh and colorcode is in wrf_charval table and the rest three fields are coming from wakp table. So for the article no. which is in col1. and for its corresponding colorcode which is in col3 i need to update col3, col4, col5 values.
With my below code I am able to upload the excel into internal table and display it. So instead of displaying I need to update in the database. Can you please let me know how I need to attach the function module within my code and update accordingly.
REPORT ZTest.
tables : wakh, wakt.
Parameter: PromoID type wakh-aktnr, PromoDec type wakt-aktkt, p_file LIKE rlgrap-filename
DEFAULT 'c:\test.xls' OBLIGATORY. " File Name
*FileName type string.
*file_nm type localfile.
TYPES: BEGIN OF t_datatab,
col1(25) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
col4(30) TYPE c,
col5(30) TYPE c,
END OF t_datatab.
DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
wa_datatab TYPE t_datatab.
Data : p_table type t_datatab occurs 0 with header line.
DATA : gd_scol TYPE i VALUE '1',
gd_srow TYPE i VALUE '2',
gd_ecol TYPE i VALUE '5',
gd_erow TYPE i VALUE '65536'.
DATA: it_tab TYPE filetable,
gd_subrc TYPE i.
field-symbols : <fs>.
AT selection-screen on PromoID.
select single * from wakh where aktnr = PromoID.
if sy-subrc EQ 0.
select aktkt from wakt into PromoDec where aktnr eq PromoID.
endselect.
else.
message A000(ZI) with 'Promotion ID is not Maintained.'.
endif.
*Title : Excel Uploading
*Selection screen definition
*SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*PARAMETERS: p_file LIKE rlgrap-filename
DEFAULT 'c:\test.xls' OBLIGATORY. " File Name
*SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
REFRESH: it_tab.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select File'
default_filename = '*.xls'
multiselection = ' '
CHANGING
file_table = it_tab
rc = gd_subrc.
LOOP AT it_tab INTO p_file.
so_fpath-sign = 'I'.
so_fpath-option = 'EQ'.
append so_fpath.
ENDLOOP.
START-OF-SELECTION.
PERFORM upload_excel_file TABLES it_datatab
USING p_file
gd_scol
gd_srow
gd_ecol
gd_erow.
END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3,
wa_datatab-col4,
wa_datatab-col5.
ENDLOOP.
*& Form UPLOAD_EXCEL_FILE
upload excel spreadsheet into internal table
-->P_TABLE Table to return excel data into
-->P_FILE file name and path
-->P_SCOL start column
-->P_SROW start row
-->P_ECOL end column
-->P_EROW end row
FORM upload_excel_file TABLES p_table
USING p_file
p_scol
p_srow
p_ecol
p_erow.
DATA : lt_intern TYPE kcde_cells OCCURS 0 WITH HEADER LINE.
Has the following format:
Row number | Colum Number | Value
i.e. 1 1 Name1
2 1 Joe
DATA : ld_index TYPE i.
Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = p_scol
i_begin_row = p_srow
i_end_col = p_ecol
i_end_row = p_erow
TABLES
intern = LT_INTERN
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
WRITE:/ 'Error Uploading file'.
EXIT.
ENDIF.
IF lt_intern[] IS INITIAL.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
WRITE:/ 'No Data Uploaded'.
EXIT.
ELSE.
SORT lt_intern BY row col.
LOOP AT lt_intern.
MOVE lt_intern-col TO ld_index.
assign component ld_index of structure
p_table to <fs>.
move : lt_intern-value to <fs>.
MOVE lt_intern-value TO p_table.
AT END OF row.
APPEND p_table.
CLEAR p_table.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM.
Thanks for your valuable time.
Cheng -
Error:loading from external table to database table
hi,
Following error comes while inserting data from external to new_ext table
what might be the reason??
error and external table creation script is as follows
regards,
Avinash
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEFETCH callout
ORA-29400: data cartridge error
KUP-04020: found record longer than buffer size supported, 524288, in
/home/oracle/rgtr1.txt
ORA-06512: at " SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1
ORA-06512: at "PRODNDBA.PROC_RGTR1", line 513
ORA-06512: at line 1
external table script is as follows:
DROP
TABLE EXT_TABLE_RGTR1 CASCADE CONSTRAINTS;
CREATE
TABLE EXT_TABLE_RGTR1
ID
VARCHAR2(10 BYTE),
PC
VARCHAR2(2 BYTE),
BU
VARCHAR2(4 BYTE),
CONSUMER_NO
VARCHAR2(12 BYTE),
CUR_READING1
NUMBER,
CUR_READING2
NUMBER,
ADJ_CONS1
NUMBER,
ADJ_CONS2
NUMBER,
TOT_EC
NUMBER,
TOT_FCA
NUMBER,
TOT_ED
NUMBER,
ADDLESS_AMT
NUMBER,
NETBILL_AMT
NUMBER,
ADJ_UNIT1
NUMBER,
ADJ_UNIT2
NUMBER,
TARIFF_CODE
NUMBER,
DUTY_CODE
NUMBER,
DISCONN_TAG
VARCHAR2(1 BYTE),
MIN_CHRG_IND
VARCHAR2(1 BYTE),
OC_CODE1
VARCHAR2(1 BYTE),
OC_CODE2
VARCHAR2(1 BYTE),
OC_AMT1
NUMBER,
OC_AMT2
NUMBER,
PREV_DPC
NUMBER,
CREDIT_AVG_BILL
NUMBER,
ADJ_TYPES
NUMBER,
ADJ_EC_FCA
NUMBER,
ADJ_ED
NUMBER,
ADJ_AMT1
NUMBER,
ADJ_AMT2
NUMBER,
ADJ_AMT3
NUMBER,
ADJ_AMT4
NUMBER,
ADJ_AMT5
NUMBER,
ADJ_AMT6
NUMBER,
ADJ_AMT7
NUMBER,
ADJ_AMT8
NUMBER,
MR_CYCLE
VARCHAR2(2 BYTE),
NOTICE
VARCHAR2(2 BYTE),
INSTAL_IND
VARCHAR2(1 BYTE),
LAST_RCPT_DT
VARCHAR2(6 BYTE),
MS1
NUMBER,
MS2
NUMBER,
ARR_PL_CR
NUMBER,
PREV_READ1
NUMBER,
PREV_READ2
NUMBER,
OLD_CONS_NUM
VARCHAR2(16 BYTE),
MTR_CODE1
VARCHAR2(2 BYTE),
MTR_CODE2
VARCHAR2(2 BYTE),
ABR_EC1
NUMBER,
ABR_FCA1
NUMBER,
REV_CAT
VARCHAR2(2 BYTE),
BILL_DT
DATE,
SD_PAID
NUMBER,
SD_ARRS
NUMBER,
SD_ADDL
NUMBER,
PR_RDNG_IND1
VARCHAR2(1 BYTE),
PR_RDNG_IND2
VARCHAR2(1 BYTE),
NAB_IND
VARCHAR2(1 BYTE),
CONN_LOAD
NUMBER,
OLDEST_OS_DT
VARCHAR2(4 BYTE),
ABR_RECAMT1
NUMBER,
METER_RENT
NUMBER,
EX_DUTY
NUMBER,
TDL_CHARGES
NUMBER,
ABR_MTH
VARCHAR2(4 BYTE),
READING_IND
VARCHAR2(1 BYTE),
FB_IND
VARCHAR2(1 BYTE),
ADJ_AMT
NUMBER,
MTR_NUM1
NUMBER,
MTR_NUM2
NUMBER,
AVG_UNITS1
NUMBER,
AVG_UNITS2
NUMBER,
MIN_BILL_AMT
NUMBER,
METER_COST_DEMANDED
NUMBER,
MF1
VARCHAR2(2 BYTE),
MF2
VARCHAR2(2 BYTE),
MR
VARCHAR2(2 BYTE),
ROUTE
VARCHAR2(4 BYTE),
SEQ
VARCHAR2(4 BYTE),
DISC_IND
VARCHAR2(1 BYTE),
FREEZE_CODE
VARCHAR2(1 BYTE),
MTH40
NUMBER,
CONCES_EC
NUMBER,
METER_COST_ARREARS
NUMBER,
METER_COST_PAID
NUMBER,
SANCTION_LOAD
NUMBER,
PENALTY_ON_CL
NUMBER,
CL_SLB
NUMBER,
UNTSLB
NUMBER,
CAPACIT_PENALTY
NUMBER,
ARREARS_OF_INT
NUMBER,
INT_ON_ARREARS
NUMBER,
FIXED_CHARGES
NUMBER,
ASSESSED_DPC
NUMBER,
FCA_UNT_OLD
NUMBER,
FCA_UNT_NEW
NUMBER,
DEFECT_RDN1
NUMBER,
DEFECT_RDN2
NUMBER,
CAP_CT_RENT
NUMBER,
CT_RENT
NUMBER,
ADV_BILL_IND
VARCHAR2(1 BYTE),
ADV_BILL_RD_IND
VARCHAR2(1 BYTE),
INST_IND
VARCHAR2(1 BYTE),
CONSCUR_STATUS
VARCHAR2(1 BYTE),
MTR_COST1
NUMBER,
MTR_COST2
NUMBER,
MTR_COST3
NUMBER,
LOOM_NOS
NUMBER,
CONS_OLD_TARIFF
NUMBER,
CONS_NEW_TARIFF
NUMBER,
PD_TD_DATE
VARCHAR2(6 BYTE),
ED5
VARCHAR2(10 BYTE),
ED6
VARCHAR2(10 BYTE),
ED8
VARCHAR2(10 BYTE),
B66_AMT1
NUMBER,
BILL_MTH
VARCHAR2(6 BYTE),
STD_MTH
NUMBER,
PREV_RD_MTH
VARCHAR2(4 BYTE),
ACCT_HD_TRF
VARCHAR2(2 BYTE),
ADM_CODE
NUMBER,
BILL_DUE_DATE
DATE,
EC_DUTY
NUMBER,
ABNOR_IND
VARCHAR2(1 BYTE),
TRF04_CONN_LOAD
NUMBER,
PROCESS_DT
DATE,
SUPPLY_DATE
VARCHAR2(6 BYTE),
BILL_DT_FROM
DATE,
RECEIPT_AMT
NUMBER,
LOCKED_CR_UNITS
NUMBER,
LOCKED_CHARGES
NUMBER,
LOCKED_ED
NUMBER,
LOCKED_FCA
NUMBER,
LOCKED_FC
NUMBER,
LOCKED_RLCHARGES
NUMBER,
LOCKED_CL
NUMBER,
LOCKED_ECEDFIX
NUMBER,
LOCKED_ACC_MONTH
NUMBER,
AVG_OLD_CONSMP
NUMBER(6),
AVG_SINCE
VARCHAR2(4 BYTE),
AVG_OCCURANCES
NUMBER(2),
AVG_MA_IND
VARCHAR2(1 BYTE),
MTR1_PHASE
NUMBER(1),
MTR_PHASE1
VARCHAR2(1 BYTE),
MTR2_PHASE
NUMBER(1),
IND_CAT
VARCHAR2(1 BYTE),
L61_TARIFF
NUMBER(2),
MTR_CHG_AMT1
NUMBER(12),
NO_OF_MONTHS
NUMBER,
MTR_CHG_AMT2
NUMBER(12),
B66_AMT
NUMBER(10),
ADJ_AMT11
NUMBER,
B66_ADJ_TYP
VARCHAR2(1 BYTE),
B60_AMT
NUMBER(10),
ADJ_AMT13
NUMBER,
B60_ADJ_TYP
VARCHAR2(1 BYTE),
CPF_NO
NUMBER(8),
ADJ1
NUMBER(9),
ADJ2
NUMBER(9),
ADJ3
NUMBER(9),
ADJ4
NUMBER(9),
ADJ5
NUMBER(9),
ADJ6
NUMBER(9),
ADJ7
NUMBER(9),
ADJ8
NUMBER(9),
ADJ11
NUMBER(9),
ADJ13
NUMBER(9),
DTC_CODE
VARCHAR2(7 BYTE),
TITLE
VARCHAR2(8 BYTE),
NAME
VARCHAR2(36 BYTE),
ADDRESS1
VARCHAR2(26 BYTE),
ADDRESS2
VARCHAR2(26 BYTE),
VILLAGE
VARCHAR2(14 BYTE),
PIN
VARCHAR2(6 BYTE),
LOCK_SINCE
VARCHAR2(4 BYTE),
FAULTY_SINCE
VARCHAR2(4 BYTE),
MTR_DIGIT1
VARCHAR2(1 BYTE),
MTR_DIGIT2
VARCHAR2(1 BYTE),
FCA_PAISE
NUMBER(9),
GTY_EXP_DT
VARCHAR2(6 BYTE),
REJ_READ_MTR1
NUMBER(6),
REJ_READ_MTR2
NUMBER(6),
REJ_ADJ_UNITS1
NUMBER(6),
REJ_CONSMP
NUMBER(6),
OWNER_CODE
NUMBER(1),
MTR_CAP_AMP
NUMBER(1),
MTR_A
VARCHAR2(1 BYTE),
MTR_C
VARCHAR2(1 BYTE),
MTR_D
VARCHAR2(1 BYTE),
MTR_E
VARCHAR2(1 BYTE),
CUT_OF_DT
DATE,
POLE
VARCHAR2(6 BYTE),
EDRATE
NUMBER(9),
AREA
VARCHAR2(1 BYTE),
MTR_BRAND1
VARCHAR2(2 BYTE),
MTR_BRAND2
VARCHAR2(2 BYTE),
LC1
NUMBER(3),
POWER_CUT_IND
VARCHAR2(1 BYTE),
SERVICE_DT
DATE,
ADJ_UNIT11
NUMBER,
ADJ_UNIT22
NUMBER,
RECEIPT_AMT1
NUMBER,
MTR1
NUMBER,
STRK_BLL_AMT
NUMBER,
DUTY_UNTS1
NUMBER,
DUTY_AMT1
NUMBER,
DUTY_UNTS2
NUMBER,
DUTY_AMT2
NUMBER,
DUTY_UNTS3
NUMBER,
DUTY_AMT3
NUMBER,
ADJ_UNIT_45
NUMBER,
ADV_BIL_EC
NUMBER,
NEW_DUTY_RATE
NUMBER,
NEW_DUTY_UNTS
NUMBER,
NEW_DUTY_AMT
NUMBER,
DPC_PAB
NUMBER,
MS9_SINCE
VARCHAR2(4 BYTE),
DISTRICT_CODE
NUMBER(2),
TAX_ON_SALE
NUMBER,
LOCKED_CHARGES_TSE
NUMBER
ORGANIZATION
EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY EXT_DIR
ACCESS PARAMETERS
( records delimited by newline
badfile
'ext.bad'
logfile 'ext.log'
fields
ID POSITION
(1-4),
PC POSITION
(7-7),
BU POSITION
(8-11),
CONSUMER_NO POSITION
(18-29 ),
CUR_READING1 POSITION
(33-41 ),
CUR_READING2 POSITION
(42-50 ),
ADJ_CONS1 POSITION
(51-59 ),
ADJ_CONS2 POSITION
(60-68 ),
TOT_EC POSITION
(69-86),
TOT_FCA POSITION
(87-104 ),
TOT_ED POSITION
(105-122 ),
ADDLESS_AMT POSITION
(123-140 ),
NETBILL_AMT POSITION
(141-158 ),
ADJ_UNIT1 POSITION
(159-167 ),
ADJ_UNIT2 POSITION
(168-176 ),
TARIFF_CODE POSITION
(177-178 ),
DUTY_CODE POSITION
(179-180 ),
DISCONN_TAG POSITION
(181-181 ),
MIN_CHRG_IND POSITION
(182-182 ),
OC_CODE1 POSITION
(183-183 ),
OC_CODE2 POSITION
(184-184 ),
OC_AMT1 POSITION
(185-202 ),
OC_AMT2 POSITION
(203-220 ),
PREV_DPC POSITION
(221-238 ),
CREDIT_AVG_BILL POSITION
(239-256 ),
ADJ_TYPES POSITION
(257-264 ),
ADJ_EC_FCA POSITION
(265-282 ),
ADJ_ED POSITION
(283-300 ),
ADJ_AMT1 POSITION
(301-318 ),
ADJ_AMT2 POSITION
(319-336 ),
ADJ_AMT3 POSITION
(337-354 ),
ADJ_AMT4 POSITION
(355-372 ),
ADJ_AMT5 POSITION
(373-390 ),
ADJ_AMT6 POSITION
(391-408 ),
ADJ_AMT7 POSITION
(409-426 ),
ADJ_AMT8 POSITION
(427-444 ),
MR_CYCLE POSITION
(445-446 ),
NOTICE POSITION
(447-448 ),
INSTAL_IND POSITION
(449-449 ),
LAST_RCPT_DT POSITION
(453-458 ),
MS1 POSITION
(459-459),
MS2 POSITION
(460-460),
ARR_PL_CR POSITION
(461-478 ),
PREV_READ1 POSITION
(479-487 ),
PREV_READ2 POSITION
(488-496 ),
OLD_CONS_NUM POSITION
(497-512 ),
MTR_CODE1 POSITION
(513-514 ),
MTR_CODE2 POSITION
(515-516 ),
ABR_EC1 POSITION
(517-534 ),
ABR_FCA1 POSITION
(535-552 ),
REV_CAT POSITION
(553-554 ),
BILL_DT POSITION
(555-560 ) DATE "DDMMYY",
SD_PAID POSITION
(561-569 ),
SD_ARRS POSITION
(570-578 ),
SD_ADDL POSITION
(579-587 ),
PR_RDNG_IND1 POSITION
(588-588 ),
PR_RDNG_IND2 POSITION
(589-589 ),
NAB_IND POSITION
(590-590 ),
CONN_LOAD POSITION
(592-600 ),
OLDEST_OS_DT POSITION
(601-604 ),
ABR_RECAMT1 POSITION
(605-622 ),
METER_RENT POSITION
(623-631 ),
EX_DUTY POSITION
(632-649 ),
TDL_CHARGES POSITION
(632-649 ),
ABR_MTH POSITION
(650-651 ),
READING_IND POSITION
(652-652 ),
FB_IND POSITION
(653-653 ),
ADJ_AMT POSITION
(654-671 ),
MTR_NUM1 POSITION
(672-681 ),
MTR_NUM2 POSITION
(682-691 ),
AVG_UNITS1 POSITION
(692-700 ),
AVG_UNITS2 POSITION
(701-709 ),
MIN_BILL_AMT POSITION
(710-727 ),
METER_COST_DEMANDED POSITION
(710-727 ),
MF1 POSITION
(728-729),
MF2 POSITION
(730-731),
MR POSITION
(732-733),
ROUTE POSITION
(734-737),
SEQ POSITION
(738-741),
DISC_IND POSITION
(742-742 ),
FREEZE_CODE POSITION
(743-743 ),
MTH40 POSITION
(744-752),
CONCES_EC POSITION
(753-770 ),
METER_COST_ARREARS POSITION
(753-770 ),
METER_COST_PAID POSITION
(771-788 ),
SANCTION_LOAD POSITION
(789-797 ),
PENALTY_ON_CL POSITION
(798-815 ),
CL_SLB POSITION
(816-817 ),
UNTSLB POSITION
(818-819 ),
CAPACIT_PENALTY POSITION
(820-837 ),
ARREARS_OF_INT POSITION
(838-855 ),
INT_ON_ARREARS POSITION
(856-873 ),
FIXED_CHARGES POSITION
(874-891 ),
ASSESSED_DPC POSITION
(892-909 ),
FCA_UNT_OLD POSITION
(910-927 ),
FCA_UNT_NEW POSITION
(928-945 ),
DEFECT_RDN1 POSITION
(982-990 ),
DEFECT_RDN2 POSITION
(991-999 ),
CAP_CT_RENT POSITION
(1000-1008 ),
CT_RENT POSITION
(1009-1017 ),
ADV_BILL_IND POSITION
(1018-1018 )
LOCATION
(EXT_DIR:'rgtr1.txt')
REJECT
LIMIT UNLIMITED
LOGGING
NOCACHE
NOPARALLEL;KUP-04020: found record longer than buffer size supported, number, in string
Cause: a record in the data source was longer than the maximum data size supported. The number reported is the maximum supported size of a record.
Action: none
Examine your bad file and log files for details of the rows which failed from insertion. -
Load XML data from UNIX Server Directly into Relational Database Tables
Is there a way I can load data from an XML File into Oracle Tables , without having the Input XML file in some Oracle Server Directory. My XML File resides on UNIX Application server. And I need to directly load the data into Database tables. Without loading them into the Database Directory.
Also I am looking for a solution that would not load my Database much and effect other running processes. Can it be done using SQL Loader ?
Oracle Database Version is : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionThanks for your reply ,
Please would you quote an Example about : 'Load the file into that table using SQL*Loader' (From UNIX Server) Or instance of some existing thread that relates to my situation.
The Size of the File would be about 3 GB. For a similar requirement one of my peers Code which used XMLTABLE and XPATH Approach consumed a lot of resources while running and caused the other Database Applications to slow down. Thus those guys have come up with an approach to :
Parse XML using a C Code using some STRING Functions => For a CSV or Fixed width .dat file and then use SQL Loader to just load the file into Tables.
This approach is efficient in terms of Resources and Time(Takes 5 mins). But I am not confident about parsing XML based on String based C Functions.
Please comment about this approach . Also if possible Suggest the best efficient way of doing this. -
Best method to update database table for 3 to 4 million rows
Hi All,
I have 3 to 4 million rows are there in my excel file and we have to load to Z-Table.
The intent is to load and keep 18 months of history in this table.
so what should be best way for huge volume of data to Z-Table from excel file.
If is from the program, is that the best way use the FM 'GUI_DOWNLOAD' and down load those entries into the internal table and directly do as below
INSERT Z_TABLE from IT_DOWNLOAD.
I think for the huge amount of data it goes to dump.
please suggest me the best possible way or any psudo code to insert those huge entries into that Z_TABLE.
Thanks in advance..Hi,
You get the dump because of uploading that much records into itnernal table from excel file...
in this case, do the follwowing.
data : w_int type i,
w_int1 type i value 1.
data itab type standard table of ALSMEX_TABLINE with header line.
do.
refresh itab.
w_int = w_int1..
w_int1 = w_int + 25000.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = <filename>
I_BEGIN_COL = 1
I_BEGIN_ROW = w_int
I_END_COL = 10
I_END_ROW = w_int1
TABLES
INTERN = itab
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if itab is not initial.
write logic to segregate the data from itab to the main internal table and then
insert records from the main internal table to database table.
else.
exit.
endif.
enddo.
Regards,
Siddarth
Maybe you are looking for
-
Unable to add new event in iCal on iphone 4s
iCal does not have the plus sign button to add a new event when I open it up. Siri cannot create a new event either. What to do?
-
How do I revert back to my original Firefox?
I downloaded the new firefox however it is not compatible with my MAC OS X Software (10.4.11). How do I revert back to my original Firefox?
-
Apex 4.2.2 PDF Printing with Apex 2.0 Listener
We recently installed Apex 4.2 with the Apex 2.0 Listener and can successfully print interactive reports and classic reports to PDF. I viewed Mark Sewtz PDF Printing with Apex 4.2.2 and saw how he is using third party tools to format reports. We ha
-
Hello. Problem statement is very simple: Firefox will not create bookmarks. New installation with Mint 17. New PC build with Asus A58M-A/USB3 mother board, AMD A4 6300 processor, 4 gig memory stick. All of the Mint and Firefox packages are up to date
-
Modifying NLS_DATE format without "Alter Session"
Different 3rd party apps require different NLS_DATE_FORMAT. How can we set different format at user / schema level, as we do not have access to application code to do 'Alter Session'? Can we use any concept in VDB? Regards Pravesh Babhoota