Reading a flat file into Oracle
Can someone tell me the best way to read a flat file into Oracle8i?
You can use SQL*Loader
or programmatically with UTL_FILE package.
(Please see documentation of SQL*Loader
and using predefine package UTL_FILE)
Similar Messages
-
Load flat file into oracle with SQL Loader
Hi All,
Oracle 9i
I want to load flat file into oracle with the help of sqlloader but I want to skip some columns from flat file.
Can anyone tell me how can we skip column from flat file , I can’t open flat file into excel as CSV due to large volume
Does anyone has any solution for the same.
Umesh GoelFiller can be use when we want to skip database table column or we want to put null in database table column
but if we have 10 column in flat file and we want to load 1,2,5,7 number column from flat file
then I think filler will not work
If yes then plz let me know.
thx
UG -
How to read\write text file into oracle database.
Hello,
I am having text file called getInfo in c:\temp folder. I would like to populate data from text file to data base. How to proceed. Could anybody help me out.
Thanks,
ShailuHere is a web page with easy to follow instructions regarding external files: http://www.adp-gmbh.ch/ora/misc/ext_table.html.
Now I understand what all the excitement is over external tables.
"External tables can read flat files (that follow some rules) as though they were ordinary (although read-only) Oracle tables. Therefore, it is convenient to use external tables to load flat files into the DB." -from the above link. -
Uploading Data from a Flat file into Oracle Database
Hi,
I am a novice to Java . SO, please bear with me. I have a reqiurement where I have a flat file or excel file from which I need to read the data and insert into Oracle Database. The falt file will exist on the client machine. I have been reading and I see this can be done through I/O Streams. Correct me if I am wrong. I am looking for a sample code to get started. Any Java expert has an answer for it, I will appreciate it.
ThanksTry UploadBean. It allows to upload files (from a browser) in Oracle.
http://www.javazoom.net/jzservlets/uploadbean/uploadbean.html
You will find JSP and servlet samples. -
Uploading a flat file into Oracle
Hello guys
Can somebody please help me. I've got a flat file that i want to read into oracle via UTL Package. I can read the file successfully if I manually replace the dots with underscores. But when I receive the file, before I upload it into Oracle, it comes in with dots on the file name. eg. The file looks like this: 'IS.DIM16.EFTS.GG24.INTAUD.TEST_20090219105728' then I have to manually replace the dots with underscores to make the file look like this: 'IS_DIM16_EFTS_GG24_INTAUD.TEST_20090219105728'.
I don't want to change it manually. Is there a way to replace the dots with underscores before I read the file? Or is the a way to make Oracle read the dots? I've tried uploading the file with the dots but it gives me this error:
ORA-29283: invalid file operation.
Your help would be greatly appreciated.
ThanksWhen i try this, i don't get any error. Can you be more specific ? Code , Expample , OS, version ....
DECLARE
v_handle utl_file.file_type;
BEGIN
v_handle:= utl_file.fopen ('/enspac03/output/ao/in','IS.DIM16.EFTS.GG24.INTAUD.TEST_20090219105728','r');
dbms_output.put_line ('Open');
utl_file.fclose(v_handle);
END; -
How to read a flat file into a report?
The file format is like below:
Company Code : BUKRS(header)
Posting Period :3(header)
Then The items data is started as a table format.
Line items in table format.
If anybody knows the answer please share with me.Use the GUI_UPLOAD Program to upload the file from Presentation server to SAP.
Sample code:
*& Report Z_UPLOAD_MUNCPCODE *
REPORT z_upload_muncpcode.
PARAMETERS : p_fname LIKE rlgrap-filename.
TYPES: BEGIN OF ty_munc,
land1 TYPE tzone-land1,
zone1 TYPE tzone-zone1,
vtext TYPE tzont-vtext,
END OF ty_munc.
DATA: i_munc TYPE STANDARD TABLE OF ty_munc,
i_tzone TYPE STANDARD TABLE OF tzone,
i_tzont TYPE STANDARD TABLE OF tzont,
wa_munc TYPE ty_munc,
wa_tzone TYPE tzone,
wa_tzont TYPE tzont.
CONSTANTS: c_path TYPE char20 VALUE 'C:\',
c_mask TYPE char9 VALUE ',*.*,*.*.',
c_mode TYPE char1 VALUE 'O',
c_filetype TYPE char10 VALUE 'ASC',
c_x TYPE char01 VALUE 'X'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
*-- Browse Presentation Server
PERFORM f4_presentation_file.
START-OF-SELECTION..
*-- Read presentation server file
PERFORM f1003_pre_file.
LOOP AT i_munc INTO wa_munc.
wa_tzone-mandt = wa_tzont-mandt = sy-mandt.
wa_tzone-land1 = wa_tzont-land1 = wa_munc-land1.
wa_tzone-zone1 = wa_tzont-zone1 = wa_munc-zone1.
wa_tzont-spras = sy-langu.
wa_tzont-vtext = wa_munc-vtext.
APPEND wa_tzont TO i_tzont.
APPEND wa_tzone TO i_tzone.
CLEAR: wa_munc, wa_tzont, wa_tzone.
ENDLOOP.
END-OF-SELECTION.
Modify Table TZONT
PERFORM enqueue_table USING text-001.
MODIFY tzont FROM TABLE i_tzont.
PERFORM dequeue_table USING text-001.
Modify Table TZONE
PERFORM enqueue_table USING text-002.
MODIFY tzone FROM TABLE i_tzone.
PERFORM dequeue_table USING text-002.
WRITE: 'Tables TZONE & TZONT are updated'.
*& Form f4_presentation_file
*& F4 Help for presentation server
FORM f4_presentation_file .
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = c_path
mask = c_mask
mode = c_mode
title = text-001
IMPORTING
filename = p_fname
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f4_presentation_file
*& Form f1003_pre_file
*& Upload File
FORM f1003_pre_file .
DATA: lcl_filename TYPE string.
lcl_filename = p_fname.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lcl_filename
filetype = c_filetype
has_field_separator = c_x
TABLES
data_tab = i_munc
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
ENDFORM. " f1003_pre_file
*& Form enqueue_table
*& Enqueue Table
FORM enqueue_table USING p_tabname.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = p_tabname
EXCEPTIONS
foreign_lock = 1
system_failure = 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.
ENDFORM. " enqueue_table
*& Form dequeue_table
*& Dequeue Table
FORM dequeue_table USING p_tabname.
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
tabname = p_tabname.
ENDFORM. " dequeue_table
Prakash. -
How to load 2 fields out of 3 from flat file to Oracle in one interface?
Hi,
Is there any way to selectively load flat file into oracle within one interface. For example if my flat file has this structure:
test_cid
test_ind
test_data
and my table is:
test_code ( correspond to test_cid above)
test_data (correspond to test_data above)
That can be done with two interfaces ( first to load the file into oracle staging and second to load the target oracle table from staging oracle table). Is there a way to make it in one interface?
Edited by: vzaslav on Oct 21, 2009 1:26 PMThat works for small tables. For big tables you need to accomodate for extra space as you will need to have at least twice as much space for working/integration tables and that is what we are trying to avoid.
In fact I was able to modify the LKM to load the file into oracle, however my integration step fails and I cannot make it work. To make lkm work one need to change getColList in create working table/generate ctl file steps to getSrcColList. That will create the working table based on source file structure and not on target table structure.
That doesn't work for IKM however. Any ideas would be appreciated.
Thank You. -
Hi,
I use ridc to check in file into Oracle Center Content server. There is no problem at the beginning. But after running for several days, there is following error.
I must restart my program to solve this issue.
Can anyone help me solve this problem?
Thanks,
Tony
2013-07-11 12:24:31,189 ERROR [BatchEventHandler] com.edocs.common.api.integration.contmgmt.ContentException: oracle.stellent.ridc.protocol.ProtocolEx
ception: java.io.IOException: Input terminated before being able to read line
at com.edocs.common.integration.contmgmt.UCMContentManager.saveContent(UCMContentManager.java:95)
at com.edocs.common.reporting.batch.BatchEventHandler.processBatchRequest(BatchEventHandler.java:284)
at com.edocs.common.reporting.batch.BatchEventHandler.service(BatchEventHandler.java:138)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask.executeInternal(BatchReportProcessorTask.java:156)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask.doProcessTask(BatchReportProcessorTask.java:68)
at com.edocs.pwc.tasks.CommonTask.processTask(CommonTask.java:166)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl.processTask(Unknown Source)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:85)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: oracle.stellent.ridc.protocol.ProtocolException: java.io.IOException: Input terminated before being able to read line
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:149)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:108)
at com.edocs.common.integration.contmgmt.UCMContentManager.saveContent(UCMContentManager.java:81)
... 17 more
Caused by: java.io.IOException: Input terminated before being able to read line
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.readLine(HdaBinderSerializer.java:371)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.readToEnd(HdaBinderSerializer.java:335)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.parseBinder(HdaBinderSerializer.java:165)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.parseBinder(HdaBinderSerializer.java:71)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:126)
... 19 more
2013-07-11 12:24:33,005 ERROR [BatchEventHandler] com.edocs.common.api.integration.contmgmt.ContentException: oracle.stellent.ridc.protocol.ProtocolEx
ception: java.io.IOException: Input terminated before being able to read line
at com.edocs.common.integration.contmgmt.UCMContentManager.saveContent(UCMContentManager.java:95)
at com.edocs.common.reporting.batch.BatchEventHandler.processBatchRequest(BatchEventHandler.java:284)
at com.edocs.common.reporting.batch.BatchEventHandler.service(BatchEventHandler.java:138)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask.executeInternal(BatchReportProcessorTask.java:156)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask.doProcessTask(BatchReportProcessorTask.java:68)
at com.edocs.pwc.tasks.CommonTask.processTask(CommonTask.java:166)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl.processTask(Unknown Source)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:85)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: oracle.stellent.ridc.protocol.ProtocolException: java.io.IOException: Input terminated before being able to read line
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:149)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:108)
at com.edocs.common.integration.contmgmt.UCMContentManager.saveContent(UCMContentManager.java:81)
... 17 more
Caused by: java.io.IOException: Input terminated before being able to read line
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.readLine(HdaBinderSerializer.java:371)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.readToEnd(HdaBinderSerializer.java:335)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.parseBinder(HdaBinderSerializer.java:165)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.parseBinder(HdaBinderSerializer.java:71)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:126)
... 19 more
2013-07-11 12:24:37,870 ERROR [BatchEventHandler] com.edocs.common.api.integration.contmgmt.ContentException: oracle.stellent.ridc.protocol.ProtocolEx
ception: java.io.IOException: Input terminated before being able to read line
at com.edocs.common.integration.contmgmt.UCMContentManager.saveContent(UCMContentManager.java:95)
at com.edocs.common.reporting.batch.BatchEventHandler.processBatchRequest(BatchEventHandler.java:284)
at com.edocs.common.reporting.batch.BatchEventHandler.service(BatchEventHandler.java:138)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask.executeInternal(BatchReportProcessorTask.java:156)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask.doProcessTask(BatchReportProcessorTask.java:68)
at com.edocs.pwc.tasks.CommonTask.processTask(CommonTask.java:166)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl.processTask(Unknown Source)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:85)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: oracle.stellent.ridc.protocol.ProtocolException: java.io.IOException: Input terminated before being able to read line
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:149)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:108)
at com.edocs.common.integration.contmgmt.UCMContentManager.saveContent(UCMContentManager.java:81)
... 17 more
Caused by: java.io.IOException: Input terminated before being able to read line
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.readLine(HdaBinderSerializer.java:371)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.readToEnd(HdaBinderSerializer.java:335)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.parseBinder(HdaBinderSerializer.java:165)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.parseBinder(HdaBinderSerializer.java:71)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:126)
... 19 more
2013-07-11 12:24:39,722 ERROR [BatchEventHandler] com.edocs.common.api.integration.contmgmt.ContentException: oracle.stellent.ridc.protocol.ProtocolEx
ception: java.io.IOException: Input terminated before being able to read line
at com.edocs.common.integration.contmgmt.UCMContentManager.saveContent(UCMContentManager.java:95)
at com.edocs.common.reporting.batch.BatchEventHandler.processBatchRequest(BatchEventHandler.java:284)
at com.edocs.common.reporting.batch.BatchEventHandler.service(BatchEventHandler.java:138)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask.executeInternal(BatchReportProcessorTask.java:156)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask.doProcessTask(BatchReportProcessorTask.java:68)
at com.edocs.pwc.tasks.CommonTask.processTask(CommonTask.java:166)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl.processTask(Unknown Source)
at com.edocs.common.reporting.tasks.batchprocessor.BatchReportProcessorTask_9qwgr6_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:85)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: oracle.stellent.ridc.protocol.ProtocolException: java.io.IOException: Input terminated before being able to read line
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:149)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:108)
at com.edocs.common.integration.contmgmt.UCMContentManager.saveContent(UCMContentManager.java:81)
... 17 more
Caused by: java.io.IOException: Input terminated before being able to read line
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.readLine(HdaBinderSerializer.java:371)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.readToEnd(HdaBinderSerializer.java:335)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.parseBinder(HdaBinderSerializer.java:165)
at oracle.stellent.ridc.model.serialize.HdaBinderSerializer.parseBinder(HdaBinderSerializer.java:71)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:126)
... 19 moreThe following is my testing code.
package ebilling;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;
import oracle.stellent.ridc.model.TransferFile;
import oracle.stellent.ridc.protocol.ServiceResponse;
import org.apache.commons.lang.StringUtils;
public class UCMContentManager {
* Check in a file into a Oracle WebCenter Content Server and return content id of uploaded content item in Oracle WebCenter Content Server.
* @param properties The Oracle WebCenter Content Server connection properties.
* @param contentFile This file will be checked in a Oracle WebCenter Content Server.
* @param path The location path of checked in file in Oracle WebCenter Content Server. This path includes the file name.<br>
* For example, "/folder1/folder2/file1.txt". The "file1.txt" is the file name part. <br>
* The file name will be used as dDocName in Oracle WebCenter Server. It must be unique.<br>
* @throws ContentException The exception when uploading file into Oracle WebCenter Content Server.
* @return The content id of uploaded content item in Oracle WebCenter Content Server.
public String saveContent(Properties properties, File contentFile, String path) throws ContentException{
if(path.endsWith(SLASH)) {
throw new ContentException("Require file name in Content Management Server");
if(!path.startsWith(SLASH)) {
throw new ContentException("The file store path in Content Management Server should be absolute.");
if (path.indexOf("//") != -1) {
path = path.replace("//", SLASH);
String[] paths = path.split(SLASH);
String[] parents = new String[paths.length - 1];
String itemName = paths[paths.length-1];
System.arraycopy(paths, 0, parents, 0, paths.length-1);
ServiceResponse response = null;
try {
IdcClientManager manager = new IdcClientManager();
IdcClient client = manager.createClient(properties.getProperty(URL_PROPERTY));
client.getConfig().setProperty ("http.library", "apache4");
String user = properties.getProperty(USERNAME_PROPERTY);
String pwd = properties.getProperty(PASSWORD_PROPERTY);
IdcContext connectionContext = new IdcContext(user, pwd);
pwd = null;
//create the parent folders if they don't exist
String folderGUID = makeFolders(properties, parents);
//check in the file
DataBinder requestData = client.createBinder();
requestData.putLocal("IdcService", "CHECKIN_UNIVERSAL");
requestData.putLocal("IsJava", "1");
requestData.putLocal("dDocName", itemName);
requestData.putLocal("dDocTitle", itemName);
requestData.putLocal("dDocType", "Binary");
requestData.putLocal("dSecurityGroup", "Public");
requestData.addFile("primaryFile", new TransferFile(contentFile));
response = client.sendRequest(connectionContext, requestData);
DataBinder responseData = response.getResponseAsBinder();
//String did = responseData.getLocal("dID");
String dDocname = responseData.getLocal("dDocName");
closeResponse(response);
//link the file in a folder
requestData = client.createBinder();
requestData.putLocal("IdcService", "FLD_CREATE_FILE");
requestData.putLocal("fParentGUID", folderGUID);
String fileType = "owner";
requestData.putLocal("fFileType", fileType);
requestData.putLocal("dDocName", dDocname);
response = client.sendRequest(connectionContext, requestData);
return dDocname;
} catch (Throwable e) {
throw new ContentException(e);
} finally{
closeResponse(response);
public void deleteContent(Properties properties, String contentId) throws ContentException{
List<String> didList = getDIds(properties, contentId);
contentId = contentId.toUpperCase();
ServiceResponse response = null;
try {
IdcClientManager manager = new IdcClientManager();
IdcClient client = manager.createClient(properties.getProperty(URL_PROPERTY));
client.getConfig().setProperty ("http.library", "apache4");
String user = properties.getProperty(USERNAME_PROPERTY);
String pwd = properties.getProperty(PASSWORD_PROPERTY);
IdcContext connectionContext = new IdcContext(user, pwd);
pwd = null;
DataBinder requestData = null;
for(int i=0; i<didList.size(); i++) {
String did = didList.get(i);
requestData = client.createBinder();
requestData.putLocal("IdcService", "DELETE_DOC");
requestData.putLocal("dDocName", contentId);
requestData.putLocal("dID", did);
response = client.sendRequest(connectionContext, requestData);
closeResponse(response);
//delete parent folder
// try {
// requestData = client.createBinder();
// requestData.putLocal("IdcService", "FLD_DELETE");
// requestData.putLocal("item1", "path:" + parentPath);
// requestData.putLocal("constructDialog", "1");
// response = client.sendRequest(connectionContext, requestData);
// } catch (Exception e) {
// // TODO: handle exception
} catch (Exception e) {
throw new ContentException(e);
} finally {
closeResponse(response);
public int getFileCountInFolder(Properties properties, String path) throws ContentException{
ServiceResponse response = null;
try {
IdcClientManager manager = new IdcClientManager();
IdcClient client = manager.createClient(properties.getProperty(URL_PROPERTY));
client.getConfig().setProperty ("http.library", "apache4");
String user = properties.getProperty(USERNAME_PROPERTY);
String pwd = properties.getProperty(PASSWORD_PROPERTY);
IdcContext connectionContext = new IdcContext(user, pwd);
pwd = null;
DataBinder binder = client.createBinder();
binder.putLocal("IdcService", "FLD_BROWSE");
binder.putLocal("path", path);
response = client.sendRequest(connectionContext, binder);
DataBinder result = response.getResponseAsBinder();
String num = result.getLocal("numFiles");
return Integer.parseInt(num);
catch (Exception e) {
throw new ContentException(e);
} finally {
closeResponse(response);
private String getFolderGUID(Properties properties, String path) throws ContentException {
ServiceResponse response = null;
String tmpFolderGUID = null;
try {
IdcClientManager manager = new IdcClientManager();
IdcClient client = manager.createClient(properties.getProperty(URL_PROPERTY));
client.getConfig().setProperty ("http.library", "apache4");
String user = properties.getProperty(USERNAME_PROPERTY);
String pwd = properties.getProperty(PASSWORD_PROPERTY);
IdcContext connectionContext = new IdcContext(user, pwd);
pwd = null;
DataBinder requestData = client.createBinder();
requestData.putLocal("IdcService", "FLD_INFO");
requestData.putLocal("path", path);
response = client.sendRequest(connectionContext,
requestData);
DataResultSet result = response.getResponseAsBinder().getResultSet("FolderInfo");
tmpFolderGUID = result.getRows().get(0).get("fFolderGUID")
.toString();
if(StringUtils.isBlank(tmpFolderGUID))
tmpFolderGUID = null;
} catch (Exception e) {
} finally {
closeResponse(response);
return tmpFolderGUID;
public boolean deleteFolder(Properties properties, String path) throws ContentException {
if(getFolderGUID(properties, path)==null)
return false;
int fileCount = getFileCountInFolder(properties, path);
ServiceResponse response = null;
if(fileCount==0) {
try {
IdcClientManager manager = new IdcClientManager();
IdcClient client = manager.createClient(properties.getProperty(URL_PROPERTY));
client.getConfig().setProperty ("http.library", "apache4");
String user = properties.getProperty(USERNAME_PROPERTY);
String pwd = properties.getProperty(PASSWORD_PROPERTY);
IdcContext connectionContext = new IdcContext(user, pwd);
pwd = null;
DataBinder binder = client.createBinder();
binder.putLocal("IdcService", "FLD_DELETE");
binder.putLocal("item1", "path:" + path);
binder.putLocal("constructDialog", "1");
response = client.sendRequest(connectionContext, binder);
return true;
catch (Exception e) {
throw new ContentException(e);
} finally {
closeResponse(response);
} else {
return false;
private String buildPath(String[] arr, int i) {
StringBuilder buf = new StringBuilder();
for(int j=0; j<=i; j++) {
buf.append(arr[j]);
buf.append(SLASH);
return buf.toString();
private String makeFolders(Properties properties, String[] paths) throws ContentException{
String folderGUID = "";
ServiceResponse response = null;
try {
IdcClientManager manager = new IdcClientManager();
IdcClient client = manager.createClient(properties.getProperty(URL_PROPERTY));
client.getConfig().setProperty ("http.library", "apache4");
String user = properties.getProperty(USERNAME_PROPERTY);
String pwd = properties.getProperty(PASSWORD_PROPERTY);
IdcContext connectionContext = new IdcContext(user, pwd);
pwd = null;
String parentFolderGUID = null;
for(int i=0; i<paths.length; i++) {
String fullPath = buildPath(paths, i);
DataBinder requestData = null;
parentFolderGUID = folderGUID;
folderGUID = getFolderGUID(properties, fullPath);
boolean exists = folderGUID!=null;
DataResultSet result = null;
if(!exists) {
//create new folder
try {
requestData = client.createBinder();
requestData.putLocal("IdcService", "FLD_CREATE_FOLDER");
requestData.putLocal("fParentGUID", parentFolderGUID);
requestData.putLocal("fFolderName", paths[i]);
response = client.sendRequest(connectionContext, requestData);
} finally {
closeResponse(response);
//retrieve folderGUID of new folder
folderGUID = getFolderGUID(properties, fullPath);
} catch (Throwable e) {
throw new ContentException(e);
} finally{
closeResponse(response);
return folderGUID;
public List<String> getDIds(Properties properties, String contentId) throws ContentException{
contentId = contentId.toUpperCase();
List<String> didList = new ArrayList<String>();
ServiceResponse response = null;
try {
IdcClientManager manager = new IdcClientManager();
IdcClient client = manager.createClient(properties.getProperty(URL_PROPERTY));
client.getConfig().setProperty ("http.library", "apache4");
String user = properties.getProperty(USERNAME_PROPERTY);
String pwd = properties.getProperty(PASSWORD_PROPERTY);
IdcContext connectionContext = new IdcContext(user, pwd);
pwd = null;
DataBinder requestData = null;
requestData = client.createBinder();
requestData.putLocal("IdcService", "GET_SEARCH_RESULTS");
requestData.putLocal("SortField", "dInDate");
requestData.putLocal("SortType", "DESC");
requestData.putLocal("QueryText", "dDocName <matches> `" + contentId +"`");
response = client.sendRequest(connectionContext, requestData);
DataBinder result = response.getResponseAsBinder();
DataResultSet resultSet = result.getResultSet("SearchResults");
for (DataObject dataObject : resultSet.getRows()) {
// System.out.println("ID : " + dataObject.get("dID")+" dDocName : "
// + dataObject.get("dDocName") + " Title : " + dataObject.get("dDocTitle")
// + " Author : " + dataObject.get("dDocAuthor") + " Security Group : "
// + dataObject.get("dSecurityGroup"));
String did = dataObject.get("dID");
didList.add(did);
//break;
} catch (Exception e) {
throw new ContentException(e);
} finally{
closeResponse(response);
return didList;
* Get the file content represented by contentId from a Oracle WebCenter Content Server.
* The return value is the input stream of retrieved file content.
* @param properties The Oracle WebCenter Content Server connection properties.
* @param contentId The Content ID for the content item in Oracle WebCenter Content Server.
* @throws ContentException The exception when retrieving content from Oracle WebCenter Content Server.
* @return The input stream of retrieved file content.
public InputStream retrieveContent(Properties properties, String contentId) throws ContentException{
try {
return new FileInputStream(retrieveContentFile(properties, contentId));
} catch (Throwable e) {
throw new ContentException(e);
public File retrieveContentFile(Properties properties, String contentId) throws ContentException {
contentId = contentId.toUpperCase();
ServiceResponse response = null;
try {
IdcClientManager manager = new IdcClientManager();
IdcClient client = manager.createClient(properties.getProperty(URL_PROPERTY));
client.getConfig().setProperty ("http.library", "apache4");
String user = properties.getProperty(USERNAME_PROPERTY);
String pwd = properties.getProperty(PASSWORD_PROPERTY);
IdcContext connectionContext = new IdcContext(user, pwd);
pwd = null;
DataBinder binder = client.createBinder();
binder.putLocal("IdcService", "GET_FILE");
//binder.putLocal("dID", dID);
binder.putLocal("dDocName", contentId);
binder.putLocal("RevisionSelectionMethod", "Latest");
response = client.sendRequest(connectionContext, binder);
InputStream in = null;
OutputStream out = null;
String edxhome = System.getProperty("edx.home");
File tmpParent = new File(edxhome);
tmpParent = new File(tmpParent, "Output");
tmpParent = new File(tmpParent, "tmp");
tmpParent.mkdirs();
File tmpFile = File.createTempFile("down_", "_ucm", tmpParent);
tmpFile.deleteOnExit();
try {
in = response.getResponseStream();
out = new FileOutputStream(tmpFile);
byte[] buf = new byte[1024];
int read = -1;
while((read = in.read(buf))!=-1) {
out.write(buf, 0, read);
} finally{
try {
if(in!=null)
in.close();
} catch (Exception e2) {
try {
if(out!=null)
out.close();
} catch (Exception e2) {
return tmpFile;
} catch (Throwable e) {
throw new ContentException(e);
} finally{
closeResponse(response);
private void closeResponse(ServiceResponse response) {
if(response!=null) {
try {
response.close();
} catch (Exception e) {
private static final String SLASH = "/";
private static final String URL_PROPERTY = "contentServerURL";
private static final String USERNAME_PROPERTY = "contentServerUser";
private static final String PASSWORD_PROPERTY = "contentServerPassword";
static volatile boolean flag = false;
static class UploadTask implements Runnable{
public void run() {
try {
while(!flag) {
UCMContentManager manager = new UCMContentManager();
Properties properties = new Properties();
properties.put(URL_PROPERTY, "https://slc402124:16201/cs/idcplg");
properties.put(USERNAME_PROPERTY, "weblogic");
properties.put(PASSWORD_PROPERTY, "weblogic1");
File contentFile = new File("C:/toding/mypro/UCM/test.txt");
String parentPath = "/new/test/multiThreadUpload/";
String location = makePath(parentPath);
manager.saveContent(properties, contentFile, location);
System.out.println(location);
Thread.sleep(5000);
} catch (Exception e) {
e.printStackTrace();
flag = true;
public static void main(String[] args) throws Exception{
ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 10, 60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>());
for(int i=0; i<10; i++) {
UploadTask uploadTask = new UploadTask();
executor.execute(uploadTask);
while(!flag) {
Thread.sleep(5000);
executor.shutdown();
public static String makePath(String parentPath) {
StringBuilder buf = new StringBuilder();
buf.append(parentPath);
if(!parentPath.endsWith("/")) {
buf.append("/");
Calendar rightNow = Calendar.getInstance();
String pattern = "yyyyMMdd";
SimpleDateFormat simDateForm = new SimpleDateFormat(pattern);
String dateStr = simDateForm.format((rightNow).getTime());
pattern = "HHmmssSSS";
simDateForm = new SimpleDateFormat(pattern);
String timeStr = simDateForm.format((rightNow).getTime());
buf.append(dateStr);
buf.append("/");
buf.append(timeStr);
buf.append("_");
buf.append(random.nextInt(10000));
String finalLocation = buf.toString();
return finalLocation;
private static SecureRandom random = new SecureRandom(); -
Hello All,
I have a file in application server, now I need to convert this file into IDOC format and save the records in SAP database. Can any one provide us the steps to do this. I would like to know how to create a port for file type to read the flat file.
Thank you,Hi,
Create a Z program in se38 and in that you will have to make use of OPEN DATASET, READ DATASET and CLOSE DATASET statements to read the fiel from the application server.
IDOC is just an intermediate document with some structure.
It does not have a capability to read a file by itself.
The file had to be explicitely read from the application server making use of the above statements and then pass the data to the idoc structure.
For more help do F1 on these statements.
Regards,
Ankur Parab -
OWB - Flat file to oracle table
Second message, please read.
OS- Microsoft windows 2000 5.00.2195 Service Pack 2
OWB client---9.0.3.33.0
OWB Repository--9.0.3.0.1
Database--oracle 9i Enterprise Edition 9.0.1.3.1 with the partioning option Jserver Release9.0.1.3.0
OEM--9.0.1.0.0
I have created mapping between the source(flat file)and target(oracle)using Oracle Warehouse Builder. Mapping was validated, configured and it successfully generated without errors. The ‘Deploy’ button and the ‘Run’ button are disabled. How can I run/deploy this mapping ?
The above OWB copy was downloaded from the Oracle corp website. Is this version an evaluation copy? Alternatively Is this a beta copy ?
Please help.Dear All,
I have a problem with loading flat files to oracle tables using OWB 9.2
i created a map with my flat file as a source and my oracle table as a target,and i created a connector between the target location and the flat file location.And i deployed the connector and registered the flat file location using my PC information and the path of the files on my pc.
I generated the map and saved the .ctl file and deployed the map,and hence trying to load the ctl file using the sql loader as the following:
C:\Documents and Settings\CORAL 2000>sqlldr owb_rt_rep/owb_rt_rep@ofsa
control = D:\oracle2\ofsa\owb\codegen\BM_DEBIT_CARDS_DAT_MAP.ctl
---where owb_rt_rep is my runtime repository user.
I got the following error:
SQL*Loader-350: Syntax error at line 18.
Expecting "(", found ".".
INTO TABLE "{{TRG_LOC1.Schema}}"."BM_DEBIT_CARDS_DAT"
--where trg_loc1 is my target location and bm_debit_cards_dat is my target table.
I tried to grant from the target schema the privelages to the runtime user incase its the problem,but still it didn't work.
Any ideas??
Dina Nagia
Message was edited by:
Dina Nagia -
Conversion of csv in flat file to oracle table format
hi friends
I have written a C code for conversion of flat file data to Comma seperated values
Now i have to put this .csv file into oracle tables.
Please suggest me a solution to this so that i can put this values into oracle tables
Regards,
MaheshYou can use Sql*Loader (sqlldr) :
TEST@db102 SQL> create table test (a varchar2(30), b varchar2(30), c varchar2(30));
Table created.
TEST@db102 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
$ cat test.csv
aaa,bbb,ccc
ddd,eee,fff
111,222,333
$ cat test.ctl
load data
infile 'test.csv'
replace into table test
fields terminated by ','
(a char, b char, c char)
$ sqlldr test/test control=test.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Wed Mar 8 15:42:42 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 3
$ sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 8 15:42:48 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
TEST@db102 SQL> select * from test;
A B C
aaa bbb ccc
ddd eee fff
111 222 333
TEST@db102 SQL> But probably there's no need to convert the flat file to csv... -
Error while loading flat file into DSO
Hi
I am loading data from a flat file into a DSO. My fields in the flat file are Trans_Dt, (CHAR) Particulars (CHAR), Card_Name, (CHAR) Exps_Type, (CHAR)
Debit_Amount,Credit_Amount,***._Amt,Open_Bal_Check_Acnt, (CURR)
0Currency (CHAR)
In the proposal tab apart from the above mentioned fields 3 additional fields viz, field 10, field 11, and field 12 have come. How did these 3 additional fields come when I don't have any additional fields in my flat file? I've deleted these extra 3 fields though.
When I activate the DataSource it is getting activated but then I get the message 'Data structures were changed. Start transactions before hand'. What does this message mean?
When I hit the 'Read preview data' button it doesn't show me any data and gives me the error Missing reference to currency field / unit field for the fields Debit_Amount,Credit_Amount,***._Amt,Open_Bal_Check_Acnt
How do I create a reference field to the above mentioned fields?
Earlier I didn't have the 0Currency field in the flat file. But in my DSO while creating the key figures by default the 0Currency field also got created which is quite obvious. Now while activating the transformations I was getting a message that 'No source field for the field 0Currency'. Hence I had to create a new field in my flat file called 0Currency and load it with USD in all rows.
Please help me in loading this flat file into the DSO.
Thank you.
TR.Hi guys,
Thanks a lot for your answers. with your help I could see the data in the 'Read preview data' and schedule the load. I did use all the Info objects in the info objects column of the data source to load the flat file.
The data is in PSA successfully without any issues. but when I executed the DTP it failed with errors.
Earlier there was no mapping from Currency field in source to the all the key figure fields in the target in the transformation. The mapping was only from Currency to 0CURRENCY but still the transformation got activated. As per your advise I mapped Currency field to the remaining Key Figure fields but then I am getting the error
'Source parameter CURRENCY is not being used'
Why is that so?
list of Errors after executing the DTP:
1. 'Record filtered because records with the same key contain errors'
Message:
Diagnosis: The data record was filtered out becoz data records with the same key have already been filtered out in the current step for other reasons and the current update is non-commutative (for example, MOVE). This means that data records cannot be exchanged on the basis of the semantic key.
System Response: The data record is filtered out; further processing is performed in accordance with the settings chosen for error handling.
Procedure: Check these data records and data records with the same key for errors and then update them.
Procedure for System administration
Can you please explain this error and how should I fix this error.
2. Exception input_not_numeric; see long text - ID RSTRAN
Diagnosis: An exception input_not_numeric was raised while executing function module RST_TOBJ_TO_DERIVED_TOBJ.
System Response
Processing the corresponding record has been terminated.
Procedure
To analyse the cause, set a break point in the program of the transformation at the call point of function module RST_TOBJ_TO_DERIVED_TOBJ. Simulate the data transfer process to investigate the cause.
Procedure for System Administration
What does this error mean? How do I set a breakpoint in the program to fix this error inorder to load the data?
What does Procedure for System Administration mean?
Please advise.
Thank you.
TR. -
I am trying to import BPM Project.zip file into Oracle enterpriserepository
I am trying to import BPM Project.zip file into Oracle enterpriserepository from admin tab.
I am getting the following exception. please help if any one know the solution.
Performing import...
Import Failed: Error [100]: An unknown server-side error occurred. Please record stack trace (if available) and contact technical support.
com.flashline.exception.LoggableException: trouble parsing file in import bundle: SampleWScall/activityGuide.agdl
at com.flashline.cmee.openapi.service.subsystem.impexp.XMLTranslator.decode(XMLTranslator.java:157)
at com.flashline.cmee.openapi.service.subsystem.impexp.ImportJob.doJob(ImportJob.java:74)
at com.flashline.cmee.openapi.service.subsystem.impexp.AbstractJob.perform(AbstractJob.java:75)
at com.flashline.cmee.openapi.service.subsystem.impexp.JobThread.run(JobThread.java:41)
Audit results stored in:
C:\Users\AVINAS~1.YEL\AppData\Local\Temp\import-4705112223687937017.log
Audit for [Import job.] created on [2012-09-24 11:53:59 IST].
2012-09-24 11:53:59 IST - Adding Import job with ID=[50403] to job queue.
Thanks in Advance.Hi
Why are you trying to import BPM zip file are you trying to configure the out of the box workflows?
They are something that need to be deployed from the process admin on BPM.
There would be the .exp file you would need as its BPM 10g that you would need to use. -
Load a flat file into BW-BPS using SAP GUI
Hi,
We are using BW BPS 3.5 version, i implemented how to guide " How to load a flat file into BW-BPS using SAP GUI" successfully without any errors.
I inlcuded three infoobjects in the text file costelemt, Posting period and amount. the same three infoobjects i inlcuded the file structure in the global data as specified in the how to document
The flat file format is like this
Costelmnt Postingperiod Amount
XXXXX #
XXXXX 1 100
XXXXX 2 800
XXXXX 3 700
XXXXX 4 500
XXXXX 5 300
XXXXX 6 200
XXXXX 7 270
XXXXX 8 120
XXXXX 9 145
XXXXX 10 340
XXXXX 11 147
XXXXX 12 900
I successfully loaded above flat file in to BPS cube and it dispalyed in the layout also.
But users are requesting to load flatfile in the below format
Costelmnt Annual(PP=#) Jan(PP=1) Feb(PP=2) ........................................Dec(PP=12)
XXXXX Blank 100 800 900
Is it possible to load a flat file like this
They wants load a single row instead of 13 rows for each costelement
How to do this. Please suggest me if anybody accorss this requirment.
In the infocube we have got only one Info object 0FISCPER3(Posting period) and one 0AMOUNT(Amount)
do we need 13 Infobjects for each posting period and amount.
Is there any possiblity we can implement any user exit which we use in BEX Quer's
Please share your ideas on this.
Thanks in advance
Best regards
SSHi,
There are 2 ways to do this.
One is to change the structure of the cube to have 12 key figures for the 12 posting periods.
Another way is to write an ABAP Function Module to fetch the values from each record based on the posting period and store it in the cube for the corresponding characteristic. This way, you dont have to change the structure of the cube.
If this particular cube is not used anywhere else, I would suggest to change the structure itself.
Hope this helps. -
How can I load a flat file into a ZTABLE dynamically
I need to create a program which can Load a ZTABLE from a flat file structure (delimited and fixed options required). We have many ZTables where this will be required so I was hoping to do it dynamically somehow. Otherwise I will have to create one ABAP for every ZTable we have to load.
My Inputs should be
PARAMETERS: p_ztable TYPE ddobjname, "Z Table Name
p_infile(132) LOWER CASE, "File Name
p_delim(1). "Delimiter
I know that I can read the file by using gui_upload
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = c_infile
has_field_separator = p_delim
TABLES
data_tab = indata
EXCEPTIONS
file_open_error = 1
file_read_error = 2
OTHERS = 9.
I know that I can split the contents of this file (if a delimiter is used). However I will not know the actual field names of the table until runtime as to what to fields to split it into. In the example below I have the actual table (t_rec) and each of the fields (pernr, lgart, etc) in the code but each table I
need to load will be different – it will have a different # of fields as well.
FORM read_data_pc.
LOOP AT indata.
PERFORM splitdata USING indata.
APPEND t_rec.
CLEAR t_rec.
ENDLOOP.
ENDFORM.
FORM splitdata USING p_infile.
SPLIT p_infile AT p_delim INTO
t_rec-pernr "Employee #
t_rec-lgart "Wage Type
t_rec-begda "Effective date
t_rec-endda. "End date
ENDFORM.
Once I split the data into the fields then I can just look and insert the record.
Does anyone have any ideas? Specific code examples would be great if you do. Thx!!Hi janice,,
Try this sample code where you can upload data from a flat file into the internal table.
REPORT z_test.
TABLES: mara.
FIELD-SYMBOLS : <fs> .
DATA : fldname(50) TYPE c.
DATA : col TYPE i.
DATA : cmp LIKE TABLE OF rstrucinfo WITH HEADER LINE.
DATA: progname LIKE sy-repid,
dynnum LIKE sy-dynnr.
DATA itab TYPE TABLE OF alsmex_tabline WITH HEADER LINE.
DATA: BEGIN OF ZUPLOAD1_T OCCURS 0 ,
matnr like mara-matnr,
ersda like mara-ersda,
ernam like mara-ernam,
laeda like mara-laeda,
END OF ZUPLOAD1_T.
*DATA: ZUPLOAD1_T LIKE mara OCCURS 0 WITH HEADER LINE.
DATA: wa_data LIKE TABLE OF ZUPLOAD1_T WITH HEADER LINE.
selection-screen
SELECTION-SCREEN: BEGIN OF BLOCK blk WITH FRAME TITLE text-001.SELECTION-SCREEN : SKIP 1. PARAMETERS : p_file LIKE rlgrap-filename.SELECTION-SCREEN : SKIP 1.SELECTION-SCREEN : END OF BLOCK blk
. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
F4 Value for File
CALL FUNCTION 'KD_GET_FILENAME_ON_F4' EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
static = 'X'
MASK = ' '
CHANGING file_name = p_file EXCEPTIONS mask_too_long = 1 OTHERS = 2
. IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING filename = P_FILE
i_begin_col = 1
i_begin_row = 1
i_end_col = 5
i_end_row = 12507
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.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = SY-REPID
fieldname = 'ZMARA'
tables
components = CMP.
LOOP AT itab. AT NEW row.
IF sy-tabix = 1. APPEND ZUPLOAD1_T.
ENDIF.
ENDAT.
col = itab-col.
READ TABLE cmp INDEX col.
CONCATENATE 'ZUPLOAD1_T-' cmp-compname INTO fldname.
ASSIGN (fldname) TO <fs>.
<fs> = itab-COL.
APPEND ZUPLOAD1_T. ENDLOOP.
DELETE ZUPLOAD1_T where matnr eq space.
LOOP AT ZUPLOAD1_T INTO wa_data.
insert mara from wa_data .
WRITE: / ZUPLOAD1_T-matnr, 20 ZUPLOAD1_T-ersda , 45 ZUPLOAD1_T-ernam, 55 ZUPLOAD1_T-laeda.
*HERE IAM JUST CHECKING I NEED TO UPDATE A ZTABLE
ENDLOOP.
insert ZMARA FROM table itab ACCEPTING DUPLICATE KEYS.
I have tried it for mara.Please let me know whether it was helful.
Regards,
Kannan
Maybe you are looking for
-
New GTXGe Force770 video card but Premiere pro not seeing it?
Hi - this is probably a dumb question.. but i have upgraded with a new video card which is CUDA enabled but in New Project Settings the Video render box is greyed out. What do I have to do to have Premiere & Photoshop use the maximum power of this ne
-
My iPhone won't send email messages - but it can receive them!
If, following a password change on you AOL account, you find your iPhone will no longer transmit/send out email messages, but can still receive them, it's a quirk of the system . . . but you can fix it easily. Here's the why and how: Transmit proble
-
ICal Crashes when clicking "calendar" button to show available calendars
After doing the Lion upgrade I've troupbe with iCal. iCal just opens fine - but when trying to access "calendar" button it shows no reaction at all. In some cases a popout callout appears which is empty (and does not show one single calendar out of m
-
ChaRM 4.0 NO Export Sytem
we are using ChaRM 4.0 , when i am refreshing the project cycle project administration . it's giving the following warning error . Warning: Problems occurred during synchronizat of the system landscape i have checked the logs in SLG1 transaction , it
-
What package gives access to BBC1 HD, ITV1 HD Etc.
Can any one here confirm what package I need to see BBC1 HD. I pay for the entertinment package not the HD package (£7 per month) and I have infinity broadband. I have found on BT website that as well as 18 extra channels, the entertainment pack in