Class methods to upload database tables

Hi,
Are there any class methods that can be used to upload database tables? I am aware that using GUI_UPLOAD method we can dynamically upload data from any flat file to a corresponding table. However can I take this process to the next level and upload the data from the internal table to a databse table at the run time?
Any thoughts or inputs shall be helpful?
Thanks in advance,
VG

HI
Actualaly I am not sure is there any class or methods are available for update the database tables from internal tables.
But we can try in a custom class and method for this purpuse using TYPE ANY and TYPE TABLE.
Regards,
R.Ranjtih,

Similar Messages

  • 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

  • How to use LSMW to upload database table directly from flat file extract

    Hi Guru's,
    I am new to LSMW tool. I have searched the fourm before posting this thread for my issue but i didn't find any good posts for the same.
    my requirement is : I will have a flat ( tab -delimited ) or Excel file with number of records downloaded using the databrowser for some of standard tables from one SAP systesm  . I wanted to upload the records using the LSMW  to the same tables  in some other SAP systesm . Please help me to How to upload the same using the LSMW.
    Thanks & Regards,
    Praveen.

    Hi Praveen,
    There is a risk trying to migrate data directly into standard tables because this can generate database inconsistences or wrong inserted data according to what is customized in the target system. I do not recommend migrate like this. 
    With LSMW you use objects like direct input programs, idocs, bapis and recorded batch input. Try to create a project and use an standard object for your data. Also, check in SXDA transaction (Goto-->DX programs) if there is a standard program for your data.
    Anyway, if you want to upload data directly to tables, read below thread:
    ["UPLOAD  CSV  FILE";
    [how to upload .csv file into a custom table;
    Regards,
    Roger

  • Generating database tables from Java classes

    Hi,
    I've encountered a number of tools which will create Java classes from database tables (e.g. JDeveloper has this functionality, Abator provides this for iBATIS, etc...).
    However, I've not been able to locate any tools that perform the opposite job - i.e. given a Java class, it generates a database table (or, presumably, some SQL).
    It's been suggested to me that Hibernate might provide this sort of capability, but if anybody has any experience of doing this, in any tool, I'd be interested to hear about it.
    Thanks,
    Alistair.

    Many thanks for the pointers.
    duffymo: I've taken a look at Middlegen (http://boss.bekk.no/boss/middlegen/index.html) but it seems that the first step is to specify the database schema, whereas I'm looking to generate the schema from existing code. Or have I missed something?
    Alistair.

  • In webdynpro ,Passing field symbols as values to class methods

    Hi
    Please tell me the ways of accessing database in webdynpro abap(not directly). I am calling Class method for accessing database. As currently I am directly accessing database in my webdynpro application. I have created a class and method for the same.
    In my method I want to use select statement which will return table with values to webdynpro application. So for select statement(Calling Method) I need to use my field symbol values as where in clause .
    Could anyone please help with example code?
    Thanks,
    Ujjwal

    data: in_line type ref to data.
    CREATE DATA in_line LIKE LINE OF <dyn_tab>.
      ASSIGN in_line->* TO <dyn_wa>.
    You can create a data reference and assign it to a field symbol and change the values. direclty passing field symbols is not possible.
    Abhi

  • GTC Error While Provisioning to Oracle Database Tables

    I'm trying to setup GTC connector to provisioning/reconcile users into database tables, but during the provisionig gtc fails. check the lines above to see the error
    ERROR,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/sendData encounter some problems: Attribute: matricula does not exist in the specified parent table/view: xladm.usuarios_view
    com.thortech.xl.gc.exception.DBException: Attribute: matricula does not exist in the specified parent table/view: xladm.usuarios_view
    matricula is the primary key
    I'm using OIM 9102 with bundle patch 12 appled. connector version is 9105. Oracle database version is 11.1.0.7. My platform is Windows 2003.
    database table's ddl
    create table usuarios (
    matricula varchar2(10) primary key,
    nome varchar2(80),
    status varchar2(20),
    ultima_atualizacao date,
    senha varchar2(20));
    create view usuarios_view as select * from usuarios;
    GTC Connector Setup
    Provide Basic Information View
    Name INFO
    Reconciliation
    Transport Provider Database Application Tables Reconciliation
    Format Provider Database Application Tables Reconciliation
    Trusted Source Reconciliation No
    Provisioning
    Transport Provider Database Application Tables Provisioning
    Format Provider Database Application Tables Provisioning
    Specify Parameter Values Change
    Database Driver oracle.jdbc.driver.OracleDriver
    Database URL jdbc:oracle:thin:@localhost:1521:orcl
    Database User ID xladm
    Database Password ********
    Customized Query
    Use Native Query No
    Connection Properties
    Parent Table/View Name usuarios_view
    Child Table/View Names
    Unique Attribute matricula
    Timestamp Attribute ultima_atualizacao
    Database Date format
    Status Attribute status
    Status Lookup Code Lookup.InfoGolden.Status
    Is Primary Key Auto Incremented No
    Target Date Format yyyy-MM-dd hh:mm:ss.fffffffff
    Batch Size All
    Stop Reconciliation Threshold None
    Stop Threshold Minimum Records None
    Source Date Format yyyy/MM/dd hh:mm:ss z
    Reconcile Deletion of Multivalued Attribute Data Yes
    Reconciliation Type Full
    error log
    Running GENERICADAPTER
    Target Class = com.thortech.xl.gc.runtime.GCAdapterLibrary
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBReconFormatProvider/formatData entered.
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize entered.
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: driver - Value: oracle.jdbc.driver.OracleDriver
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: url - Value: jdbc:oracle:thin:@localhost:1521:orcl
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: username - Value: xladm
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: password - Value: *******
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: parentContainerName - Value: usuarios_view
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBReconTransportProvider/convertCSVToArraylist entered.
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBReconTransportProvider/convertCSVToArraylist - Data: Run Time Parameters - Value: []
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: childContainerTableNames - Value: []
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: parentContainerUniqueKey - Value: matricula
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: statusField - Value: status
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: statusFieldLookup - Value: Lookup.InfoGolden.Status
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize left.
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/initialize - Data: dbDateFormat - Value:
    DEBUG,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/sendData entered.
    INFO,07 Nov 2010 20:18:37,086,[OIMCP.DATC],Within PROV_OPERATION_ADDUSER::statusField=status
    DEBUG,07 Nov 2010 20:18:37,117,[OIMCP.DATC],Class/Method: DBFacade/getConnectionProp entered.
    DEBUG,07 Nov 2010 20:18:37,117,[OIMCP.DATC],Class/Method: DBFacade/setUpSSLPropertiesForDB2 entered.
    DEBUG,07 Nov 2010 20:18:37,117,[OIMCP.DATC],ExitingMethodDebug
    INFO,07 Nov 2010 20:18:37,148,[OIMCP.DATC],dbType:::: = Oracle
    DEBUG,07 Nov 2010 20:18:37,148,[OIMCP.DATC],Class/Method: DBFacade/getMatchingSchemaName - Data: found matching schema - Value: XLADM
    DEBUG,07 Nov 2010 20:18:37,148,[OIMCP.DATC],Class/Method: DBFacade/getMatchingTableName - Data: found exact matching schema:- - Value: XLADM
    DEBUG,07 Nov 2010 20:18:37,227,[OIMCP.DATC],Class/Method: DBFacade/getMatchingTableName - Data: found matching tables - Value: USUARIOS_VIEW
    DEBUG,07 Nov 2010 20:18:37,227,[OIMCP.DATC],Class/Method: DBFacade/getMatchingTableName - Data: found exact matching table:- - Value: USUARIOS_VIEW
    INFO,07 Nov 2010 20:18:37,258,[OIMCP.DATC],dbType:::: = Oracle
    DEBUG,07 Nov 2010 20:18:37,273,[OIMCP.DATC],Class/Method: DBFacade/getMatchingSchemaName - Data: found matching schema - Value: XLADM
    DEBUG,07 Nov 2010 20:18:37,273,[OIMCP.DATC],Class/Method: DBFacade/getMatchingTableName - Data: found exact matching schema:- - Value: XLADM
    DEBUG,07 Nov 2010 20:18:37,336,[OIMCP.DATC],Class/Method: DBFacade/getMatchingTableName - Data: found matching tables - Value: USUARIOS_VIEW
    DEBUG,07 Nov 2010 20:18:37,336,[OIMCP.DATC],Class/Method: DBFacade/getMatchingTableName - Data: found exact matching table:- - Value: USUARIOS_VIEW
    INFO,07 Nov 2010 20:18:37,445,[OIMCP.DATC],dbType:::: = Oracle
    INFO,07 Nov 2010 20:18:37,445,[OIMCP.DATC],dbType:::: = Oracle
    DEBUG,07 Nov 2010 20:18:37,445,[OIMCP.DATC],Class/Method: DBFacade/getMatchingSchemaName - Data: found matching schema - Value: XLADM
    DEBUG,07 Nov 2010 20:18:37,445,[OIMCP.DATC],Class/Method: DBFacade/getMatchingTableName - Data: found exact matching schema:- - Value: XLADM
    DEBUG,07 Nov 2010 20:18:37,523,[OIMCP.DATC],Class/Method: DBFacade/getMatchingTableName - Data: found matching tables - Value: USUARIOS_VIEW
    DEBUG,07 Nov 2010 20:18:37,523,[OIMCP.DATC],Class/Method: DBFacade/getMatchingTableName - Data: found exact matching table:- - Value: USUARIOS_VIEW
    DEBUG,07 Nov 2010 20:18:38,367,[OIMCP.DATC],Class/Method: DBFacade/getPrimaryKeys - Data: Primary Keys - Value: []
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Name: - Value: MATRICULA
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Dataype integer value: - Value: 12
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Size: - Value: 10
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Table Name: - Value: USUARIOS_VIEW
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getClumns - Data: Column Datatype Name: - Value: VARCHAR2
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Database Type Name: - Value: Oracle
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Name: - Value: NOME
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Dataype integer value: - Value: 12
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Size: - Value: 80
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Table Name: - Value: USUARIOS_VIEW
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getClumns - Data: Column Datatype Name: - Value: VARCHAR2
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Database Type Name: - Value: Oracle
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Name: - Value: STATUS
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Dataype integer value: - Value: 12
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Size: - Value: 20
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Table Name: - Value: USUARIOS_VIEW
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getClumns - Data: Column Datatype Name: - Value: VARCHAR2
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Database Type Name: - Value: Oracle
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Name: - Value: ULTIMA_ATUALIZACAO
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Dataype integer value: - Value: 93
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Size: - Value: 7
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Table Name: - Value: USUARIOS_VIEW
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getClumns - Data: Column Datatype Name: - Value: DATE
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Database Type Name: - Value: Oracle
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Name: - Value: SENHA
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Dataype integer value: - Value: 12
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Column Size: - Value: 20
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Table Name: - Value: USUARIOS_VIEW
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getClumns - Data: Column Datatype Name: - Value: VARCHAR2
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getColumns - Data: Database Type Name: - Value: Oracle
    DEBUG,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBFacade/getClumns - Data: Columns: - Value: [com.thortech.xl.gc.impl.common.Column@187f99a, com.thortech.xl.gc.impl.common.Column@1428b7, com.thortech.xl.gc.impl.common.Column@17d39b5, com.thortech.xl.gc.impl.common.Column@57cf27, com.thortech.xl.gc.impl.common.Column@e1319f]
    ERROR,07 Nov 2010 20:18:38,383,[OIMCP.DATC],Class/Method: DBProvisioningTransportProvider/sendData encounter some problems: Attribute: matricula does not exist in the specified parent table/view: xladm.usuarios_view
    com.thortech.xl.gc.exception.DBException: Attribute: matricula does not exist in the specified parent table/view: xladm.usuarios_view
         at com.thortech.xl.gc.impl.common.DBFacade.validateAttrExistence(Unknown Source)
         at com.thortech.xl.gc.impl.common.DBFacade.getSchema(Unknown Source)
         at com.thortech.xl.gc.impl.prov.DBProvisioningTransportProvider.getSchema(Unknown Source)
         at com.thortech.xl.gc.impl.prov.DBProvisioningTransportProvider.sendData(Unknown Source)
         at com.thortech.xl.gc.runtime.GCAdapterLibrary.executeFunctionality(Unknown Source)
         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:597)
         at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpINFO_GTC.GENERICADAPTER(adpINFO_GTC.java:125)
         at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpINFO_GTC.implementation(adpINFO_GTC.java:70)
         at com.thortech.xl.client.events.tcBaseEvent.run(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.runEvent(Unknown Source)
         at com.thortech.xl.dataobj.tcScheduleItem.runMilestoneEvent(Unknown Source)
         at com.thortech.xl.dataobj.tcScheduleItem.eventPostInsert(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
         at com.thortech.xl.ejb.beansimpl.tcProvisioningOperationsBean.retryTasks(Unknown Source)
         at com.thortech.xl.ejb.beans.tcProvisioningOperationsSession.retryTasks(Unknown Source)
         at com.thortech.xl.ejb.beans.tcProvisioningOperations_b03yxm_EOImpl.retryTasks(tcProvisioningOperations_b03yxm_EOImpl.java:2719)
         at Thor.API.Operations.tcProvisioningOperationsClient.retryTasks(Unknown Source)
         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:597)
         at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.security.Security.runAs(Security.java:41)
         at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Source)
         at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
         at $Proxy93.retryTasks(Unknown Source)
         at com.thortech.xl.webclient.actions.ResourceProfileProvisioningTasksAction.retryTasks(Unknown Source)
         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:597)
         at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
         at com.thortech.xl.webclient.actions.tcLookupDispatchAction.execute(Unknown Source)
         at com.thortech.xl.webclient.actions.tcActionBase.execute(Unknown Source)
         at com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at com.thortech.xl.webclient.security.CSRFFilter.doFilter(Unknown Source)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at com.thortech.xl.webclient.security.SecurityFilter.doFilter(Unknown Source)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)

    What I usually do in situations like this is that I connect to the database using a sql client and the same connection information as I specified to OIM and see if the attribute is present.
    Perhaps you got the wrong db name? Or schema name?
    Everything looks good so most probably there simply is some little typo somewhere.
    Hope this helps
    /Martin

  • Upload Binary table to DMS

    Hi,
    Can anyone help me in uploading Binary table to DMS.
    Currently i am using BAPI 'BAPI_DOCUMENT_CRETE2' for creating DMS document but through this BAPI i can only upload documents from my presentation server.
    I will be having a PDF in binary table in my program and i want to upload that PDF to DMS.
    I am looking for a BAPI or Class method to upload the document to DMS from my binary table.
    can anyone help me?
    regards,
    Amit

    hello amit ..
    you can use CVAPI_DOC_CHECKIN to check-in data from internat table to DIR.
    Eg call as below :
    CALL FUNCTION 'CVAPI_DOC_CHECKIN'
                EXPORTING
                  PF_DOKAR           = DOKAR
                  PF_DOKNR           = DOKNR
                  PF_DOKVR           = DOKVR
                  PF_DOKTL           = DOKTL
                  PS_API_CONTROL     = ls_api_control
                  PF_CONTENT_PROVIDE = _*'TBL'*_
                IMPORTING
                  PSX_MESSAGE        = L_MESSAGE
                TABLES
                  PT_FILES_X         = lt_files_tab
                  PT_CONTENT         = LT_CONTENT.
    LT_FILES_TAB-APPNR = 1
    LT_FILES_TAB-DAPPL = TXT
    LT_FILES_TAB-FILENAME = test
    LT_FILES_TAB-STORAGE_CATEGORY = Y02L
    _LT_CONTENT_
    APPNR          ZAEHL          ORLN                                 ORBKL          ORBLK
    1     0001     000000007650     2550     <HEX_values>
    1     0002     000000007650     2550     <HEX_values>
    1     0003     000000007650     2550     0ABCDEF123456789
    Rgds,
    Shivanand

  • How to Transfer Database Table Field to Data Type in XI

    Dear All,
    Dear All,
    I am working on scenario to transfer data(Database Table) from Non SAP System to SAP system through XI.
    While Defining "Data Type" in XI i want to create Data Type as of Database table in my(Oracle Database).There is any direct method to import Database Table field into "Data Type" in XI.
    thanks,
    RP

    Hi;
    Edit plus is a tool using which you can edit your file and make changes to it.
    You can download it from net ,just search for it on google.
    this will help you to get in the field names of the table by editing the file .
    Mudit

  • Fileaccess.HttpUploadBean not uploading file in DataBase Table

    Hi,
    I am using fileaccess.HttpUploadBean to upload the txt file in the specified database table.i have followed all the guidelines given in Oracle JSP Tag Libraries and Utilities Reference Guide. But i am not be able to upload the file into Database Table
    I have created a table
    CREATE TABLE FLK_CLOB_TEST (
    FILE_ID NUMBER (5),
    FILE_DATA CLOB,
    FILE_NAME VARCHAR2 (50),
    FILE_PREFIX VARCHAR2 (50) ) ;
    uploadfile.jsp
    <html><body>
    <form name = "formname" action="beanUploadDataBase.jsp" method=POST ENCTYPE="multipart/form-data" />
    <br>MailID: <INPUT TYPE="text" NAME="strMailId" />
    <br> File to upload: <INPUT TYPE="FILE" NAME="File" SIZE="50" MAXLENGTH="120" >
    <br><INPUT TYPE="Submit" NAME="Submit" VALUE="Send" >
    <INPUT type="reset" name="reset" value = "Cancel">
    </form>
    </body></html>
    beanUploadDataBase.jsp , which is having upload code.
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page language="java"
    import="java.util.*,java.io.*,java.sql.*, oracle.jsp.webutil.fileaccess.*" %>
    <html><body>
    <Form name="upForm" method ="post" > <!--action ="beanUploadExample.jsp" >-->
    <%
    Connection conn;
    FlkOracleDBCon objDBHelper;
    objDBHelper = FlkOracleDBCon.getInstance();
    String userdir = "test";
    String strFlag = "";
    String strFileName ="";
    String strDirName ="";
    String strAbsoluteName ="";
    //MultipartRequest multi = null;
    String _PageMode = "";//"CREATE";
    %>
    <jsp:useBean id="upbean"
    class="oracle.jsp.webutil.fileaccess.HttpUploadBean" >
    <jsp:setProperty name="upbean" property="destination" value="<%=userdir%>"/>
    </jsp:useBean>
    <%
    try{
    conn = objDBHelper.getConnection();
    out.println("Connection Value is :"+conn);
    if (conn !=null)
    // upbean.setDestination("test");
    upbean.setDestinationType("database");
    upbean.setConnection(conn);
    upbean.setOverwrite(false);
    upbean.setFileType("character");
    upbean.setTable("FLK_CLOB_TEST");
    upbean.setPrefixColumn("File_Prefix");
    upbean.setFileNameColumn("File_Name");
    upbean.setDataColumn("File_Data");
    //upbean.setBaseDir(application, request);
    String str = upbean.getDestination();
    out.println("The value of Destination is "+str) ;
    upbean.upload(request);
    String filename = upbean.getFileNameColumn();
    String strTable = upbean.getTable();
    String strPrefix = upbean.getPrefixColumn();
    String name = "";
    conn.commit();
    out.println("filename-----:::::: "+filename+":::");
    out.println("File Prefix-----:::::: "+strPrefix+":::");
    out.println("DataBase Table Name-----:::::: "+strTable+":::");
    Enumeration fileNames = upbean.getFileNames();
    while (fileNames.hasMoreElements()) {
    strFlag = "true";
    strFileName = (String)fileNames.nextElement();
    out.println("strFileName File Name Is:::::"+strFileName);
    strAbsoluteName = strFileName.substring(4,strFileName.length());
    catch(IOException ex)
    out.println("IOException is =="+ex.toString());
    catch(SQLException ex)
    out.println("IOException is =="+ex.toString());
    catch(Exception ex)
    out.println("IOException is =="+ex.toString());
    %>
    This is not uploading file or any other information into database table called FLK_CLOB_TEST.
    Please help me on this.

    I get the same error when i try to load the same data but from Oracle Table
    11872     12108     RUN-050406     11/14/2011 4:38:44 PM     Data flow <DF_TB_Generalità> received a bad system message. Message text from the child process is
    11872     12108     RUN-050406     11/14/2011 4:38:44 PM     
    <￀ ==========================================================
    when i load data from SAP extractors or SAP tables i don't have problem.
    Regards
    Bilal

  • Download and upload ABAP database table to presentation server and R/3

    Hi experts,
    I want to download ABAP database table (Ztable) to presentation server and again want to upload this to another R/3 server but i dont want to use any transport request. is there any possible sollution for this.
    Thanks in advance

    Hi,
    Look at this code hope this will help you to solve your problem
    REPORT y_test_559.
    Program for
    1. Downloading Data of any DB table to a tab delimited ASCII file
    2. Checking if a tab delimited ASCII file has the structure of a
       DB table and showing its contents
    3. Uploading a tab delimited ASCII file to a DB table with the same
       structure
    4. Showing the data of any DB table
    ======================================================================
    ======================================================================
    DATA DECLARATIONS
    ======================================================================
    TYPES : data_object  TYPE REF TO data.
    DATA  : itab TYPE REF TO data .
    TYPE-POOLS : slis .
    DATA  : it_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv
            WITH HEADER LINE .
    DATA : it_fieldcatalog TYPE lvc_t_fcat .
    DATA : wa_fieldcatalog TYPE lvc_s_fcat .
    DATA : i_structure_name LIKE dd02l-tabname .
    DATA : i_callback_program LIKE sy-repid .
    DATA  : dyn_line TYPE data_object .
    FIELD-SYMBOLS : <fs_itab> TYPE  STANDARD  TABLE .
    DATA : table_name_is_valid TYPE c .
    DATA : dynamic_it_instantiated TYPE c .
    CONSTANTS buttonselected TYPE c VALUE 'X' .
    ======================================================================
    SELECTION SCREEN DEFAULT
    ======================================================================
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_tabl.
    PARAMETERS : tabl_nam LIKE rsrd1-tbma_val
                 MATCHCODE OBJECT dd_dbtb_16 OBLIGATORY .
                                   "Search for Database Tables is dd_dbtb_16
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_file.
    PARAMETERS : file_nam LIKE rlgrap-filename .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_down.
    PARAMETERS : p_downld RADIOBUTTON GROUP grp1
                 USER-COMMAND m_ucomm .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_chkf.
    PARAMETERS : p_chkfil RADIOBUTTON GROUP grp1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_upld.
    PARAMETERS : p_upload RADIOBUTTON GROUP grp1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_show.
    PARAMETERS : p_show_t RADIOBUTTON GROUP grp1 ."show table data
    SELECTION-SCREEN END OF LINE.
    ======================================================================
    AT SELECTION SCREEN OUTPUT
    ======================================================================
    AT SELECTION-SCREEN OUTPUT .
      PERFORM check_filename .
    ======================================================================
    AT SELECTION SCREEN ON VALUE REQUEST FOR FILENAME
    ======================================================================
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_nam .
      PERFORM f4_for_filename .
    ======================================================================
    Initialization .
    ======================================================================
    INITIALIZATION .
      t_tabl = 'Table Name' .
      t_file = 'File Name' .
      t_down = 'Download Table' .
      t_chkf = 'Check File to Upload' .
      t_upld = 'Upload File' .
      t_show = 'Show Table Contents' .
    ======================================================================
    START OF SELECTION
    ======================================================================
    START-OF-SELECTION .
      PERFORM check_table_name_is_valid .
    ======================================================================
    END OF SELECTION
    ======================================================================
    END-OF-SELECTION .
      IF table_name_is_valid EQ ' ' .
        MESSAGE i398(00) WITH 'INVALID TABLE NAME' .
      ELSE .
        PERFORM instantiate_dynamic_internal_t  .
        CHECK  dynamic_it_instantiated = 'X' .
        CASE buttonselected .
          WHEN p_downld .
            PERFORM select_and_download .
          WHEN p_chkfil .
            PERFORM check_file_to_upload .
          WHEN p_upload .
            PERFORM upload_from_file .
          WHEN p_show_t .
            PERFORM show_contents .
        ENDCASE .
      ENDIF .
    *&      Form  CHECK_TABLE_NAME_IS_VALID
          text
    -->  p1        text
    <--  p2        text
    FORM check_table_name_is_valid.
      DATA l_count TYPE i .
      TABLES dd02l .
      CLEAR table_name_is_valid .
      SELECT COUNT(*) INTO l_count FROM tadir
      WHERE  pgmid = 'R3TR'
      AND    object = 'TABL'
      AND    obj_name = tabl_nam .
      IF l_count EQ 1 .
        CLEAR dd02l .
        SELECT SINGLE * FROM dd02l WHERE tabname  = tabl_nam .
        IF sy-subrc EQ 0.
          IF dd02l-tabclass = 'TRANSP' .
            table_name_is_valid = 'X' .
          ENDIF .
        ENDIF.
      ENDIF .
    ENDFORM.                    " CHECK_TABLE_NAME_IS_VALID
    *&      Form  SELECT_AND_DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM select_and_download.
      CLEAR : <fs_itab> .
      SELECT * FROM (tabl_nam)
      INTO CORRESPONDING FIELDS OF TABLE <fs_itab>   .
      PERFORM check_filename.
      CALL FUNCTION 'WS_DOWNLOAD'
        EXPORTING
          filename                = file_nam
          filetype                = 'DAT'
        TABLES
          data_tab                = <fs_itab>
        EXCEPTIONS
          file_open_error         = 1
          file_write_error        = 2
          invalid_filesize        = 3
          invalid_type            = 4
          no_batch                = 5
          unknown_error           = 6
          invalid_table_width     = 7
          gui_refuse_filetransfer = 8
          customer_error          = 9
          OTHERS                  = 10.
      IF sy-subrc EQ 0.
        MESSAGE i398(00) WITH 'Table' tabl_nam
                              'successfully downloaded to '
                              file_nam .
      ENDIF.
    ENDFORM.                    " SELECT_AND_DOWNLOAD
    *&      Form  UPLOAD_FROM_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM upload_from_file.
      DATA : ans TYPE c .
      DATA : lines_of_itab TYPE i .
      DATA : l_subrc TYPE i .
      CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
        EXPORTING
          textline1 = 'Are you sure you wish to upload'
          textline2 = 'data from ASCII File to DB table '
          titel     = 'Confirmation of Data Upload'
        IMPORTING
          answer    = ans.
      IF ans = 'J' .
        PERFORM check_filename.
        CLEAR l_subrc .
        CALL FUNCTION 'WS_UPLOAD'
          EXPORTING
            filename                = file_nam
            filetype                = 'DAT'
          TABLES
            data_tab                = <fs_itab>
          EXCEPTIONS
            conversion_error        = 1
            file_open_error         = 2
            file_read_error         = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            OTHERS                  = 10.
        l_subrc = l_subrc  + sy-subrc .
        IF sy-subrc EQ 0.
          DESCRIBE TABLE <fs_itab> LINES lines_of_itab .
          IF lines_of_itab GT 0 .
            DELETE (tabl_nam) FROM TABLE <fs_itab> .
            COMMIT WORK .
            INSERT (tabl_nam) FROM TABLE <fs_itab> .
            l_subrc = l_subrc  + sy-subrc .
          ENDIF .
        ENDIF.
        IF  l_subrc EQ 0  .
          MESSAGE i398(00) WITH lines_of_itab
                               'Record(s) inserted in table'
                                tabl_nam .
        ELSE .
          MESSAGE i398(00) WITH
                          'Errors occurred No Records inserted in table'
                           tabl_nam .
        ENDIF .
      ENDIF .
    ENDFORM.                    " UPLOAD_FROM_FILE
    *&      Form  F4_FOR_FILENAME
          text
    -->  p1        text
    <--  p2        text
    FORM f4_for_filename.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = 'C:\'
          mask             = ',.,..'
          mode             = '0'
        IMPORTING
          filename         = file_nam
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
    ENDFORM.                    " F4_FOR_FILENAME
    *&      Form  CHECK_FILENAME
          text
    -->  p1        text
    <--  p2        text
    FORM check_filename.
      IF file_nam IS INITIAL
      AND NOT ( tabl_nam IS INITIAL  )
      AND p_show_t NE buttonselected.
        CONCATENATE 'C:\' tabl_nam  '.TXT'  INTO file_nam.
      ENDIF .
    ENDFORM.                    " CHECK_FILENAME
    *&      Form  INSTANTIATE_DYNAMIC_INTERNAL_T
          text
    -->  p1        text
    <--  p2        text
    FORM instantiate_dynamic_internal_t.
      CLEAR dynamic_it_instantiated .
    -----> Step 1 - Finding Field Names and ALV GRID Fieldcatalog
      i_structure_name =  tabl_nam .
      CLEAR it_fieldcat[] .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = i_structure_name
        CHANGING
          ct_fieldcat            = it_fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc EQ 0.
    -----> Step 2 - Creating Field Catalog of the Object
                                                  cl_alv_table_create
        LOOP AT it_fieldcat .
          CLEAR wa_fieldcatalog .
          MOVE-CORRESPONDING it_fieldcat TO  wa_fieldcatalog .
          wa_fieldcatalog-ref_field = it_fieldcat-fieldname .
          wa_fieldcatalog-ref_table = tabl_nam .
          APPEND  wa_fieldcatalog  TO it_fieldcatalog .
        ENDLOOP .
    -----> Step 3 - Creating Internal Table Dynamicaly
        CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog = it_fieldcatalog
          IMPORTING
            ep_table        = itab.
        ASSIGN itab->* TO <fs_itab> .
        dynamic_it_instantiated = 'X' .
      ENDIF.
    ENDFORM.                    " INSTANTIATE_DYNAMIC_INTERNAL_T
    *&      Form  SHOW_CONTENTS
          text
    -->  p1        text
    <--  p2        text
    FORM show_contents.
      CLEAR : <fs_itab> .
      SELECT * FROM (tabl_nam)
      INTO CORRESPONDING FIELDS OF TABLE <fs_itab>   .
      i_callback_program = sy-repid .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = i_callback_program
          it_fieldcat        = it_fieldcat[]
        TABLES
          t_outtab           = <fs_itab>
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    ENDFORM.                    " SHOW_CONTENTS
    *&      Form  CHECK_FILE_TO_UPLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM check_file_to_upload.
      PERFORM check_filename.
    CLEAR l_subrc .
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
          filename                = file_nam
          filetype                = 'DAT'
        TABLES
          data_tab                = <fs_itab>
        EXCEPTIONS
          conversion_error        = 1
          file_open_error         = 2
          file_read_error         = 3
          invalid_type            = 4
          no_batch                = 5
          unknown_error           = 6
          invalid_table_width     = 7
          gui_refuse_filetransfer = 8
          customer_error          = 9
          OTHERS                  = 10.
    l_subrc = l_subrc  + SY-SUBRC .
      IF sy-subrc EQ 0.
        i_callback_program = sy-repid .
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program = i_callback_program
            it_fieldcat        = it_fieldcat[]
          TABLES
            t_outtab           = <fs_itab>
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
      ENDIF .
    ENDFORM.                    " CHECK_FILE_TO_UPLOAD
    Thanks,
    Pramod

  • Program to upload csv file to internal table and insert into database table

    Hi I'm writing a program where I need to upload a csv file into an internal table using gui_upload, but i also need this program to insert the data into my custom database table using the split command.  Anybody have any samples to help, its urgent!

    Hi,
    Check this table may be it will give u an hint...
    REPORT z_table_upload LINE-SIZE 255.
    Data
    DATA: it_dd03p TYPE TABLE OF dd03p,
          is_dd03p TYPE dd03p.
    DATA: it_rdata  TYPE TABLE OF text1024,
          is_rdata  TYPE text1024.
    DATA: it_fields TYPE TABLE OF fieldname.
    DATA: it_file  TYPE REF TO data,
          is_file  TYPE REF TO data.
    DATA: w_error  TYPE text132.
    Macros
    DEFINE write_error.
      concatenate 'Error: table'
                  p_table
                  &1
                  &2
             into w_error
             separated by space.
      condense w_error.
      write: / w_error.
      stop.
    END-OF-DEFINITION.
    Field symbols
    FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
                   <data>  TYPE ANY,
                   <fs>    TYPE ANY.
    Selection screen
    SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
    PARAMETERS: p_file  TYPE localfile DEFAULT 'C:\temp\' OBLIGATORY,
                p_separ TYPE c DEFAULT ';' OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK b01.
    SELECTION-SCREEN: BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
    PARAMETERS: p_table TYPE tabname OBLIGATORY
                                     MEMORY ID dtb
                                     MATCHCODE OBJECT dd_dbtb_16.
    SELECTION-SCREEN: END OF BLOCK b02.
    SELECTION-SCREEN: BEGIN OF BLOCK b03 WITH FRAME TITLE text-b03.
    PARAMETERS: p_create TYPE c AS CHECKBOX.
    SELECTION-SCREEN: END OF BLOCK b03,
                      SKIP.
    SELECTION-SCREEN: BEGIN OF BLOCK b04 WITH FRAME TITLE text-b04.
    PARAMETERS: p_nodb RADIOBUTTON GROUP g1 DEFAULT 'X'
                                   USER-COMMAND rg1,
                p_save RADIOBUTTON GROUP g1,
                p_dele RADIOBUTTON GROUP g1.
    SELECTION-SCREEN: SKIP.
    PARAMETERS: p_test TYPE c AS CHECKBOX,
                p_list TYPE c AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN: END OF BLOCK b04.
    At selection screen
    AT SELECTION-SCREEN.
      IF sy-ucomm = 'RG1'.
        IF p_nodb IS INITIAL.
          p_test = 'X'.
        ENDIF.
      ENDIF.
    At selection screen
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                field_name = 'P_FILE'
           IMPORTING
                file_name  = p_file.
    Start of selection
    START-OF-SELECTION.
      PERFORM f_table_definition USING p_table.
      PERFORM f_upload_data USING p_file.
      PERFORM f_prepare_table USING p_table.
      PERFORM f_process_data.
      IF p_nodb IS INITIAL.
        PERFORM f_modify_table.
      ENDIF.
      IF p_list = 'X'.
        PERFORM f_list_records.
      ENDIF.
    End of selection
    END-OF-SELECTION.
          FORM f_table_definition                                       *
    -->  VALUE(IN_TABLE)                                               *
    FORM f_table_definition USING value(in_table).
      DATA: l_tname TYPE tabname,
            l_state TYPE ddgotstate,
            l_dd02v TYPE dd02v.
      l_tname = in_table.
      CALL FUNCTION 'DDIF_TABL_GET'
           EXPORTING
                name          = l_tname
           IMPORTING
                gotstate      = l_state
                dd02v_wa      = l_dd02v
           TABLES
                dd03p_tab     = it_dd03p
           EXCEPTIONS
                illegal_input = 1
                OTHERS        = 2.
      IF l_state NE 'A'.
        write_error 'does not exist or is not active' space.
      ENDIF.
      IF l_dd02v-tabclass NE 'TRANSP' AND
         l_dd02v-tabclass NE 'CLUSTER'.
        write_error 'is type' l_dd02v-tabclass.
      ENDIF.
    ENDFORM.
          FORM f_prepare_table                                          *
    -->  VALUE(IN_TABLE)                                               *
    FORM f_prepare_table USING value(in_table).
      DATA: l_tname TYPE tabname,
            lt_ftab TYPE lvc_t_fcat.
      l_tname = in_table.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
           EXPORTING
                i_structure_name = l_tname
           CHANGING
                ct_fieldcat      = lt_ftab
           EXCEPTIONS
                OTHERS           = 1.
      IF sy-subrc NE 0.
        WRITE: / 'Error while building field catalog'.
        STOP.
      ENDIF.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = lt_ftab
        IMPORTING
          ep_table        = it_file.
      ASSIGN it_file->* TO <table>.
      CREATE DATA is_file LIKE LINE OF <table>.
      ASSIGN is_file->* TO <data>.
    ENDFORM.
          FORM f_upload_data                                            *
    -->  VALUE(IN_FILE)                                                *
    FORM f_upload_data USING value(in_file).
      DATA: l_file    TYPE string,
            l_ltext   TYPE string.
      DATA: l_lengt   TYPE i,
            l_field   TYPE fieldname.
      DATA: l_missk   TYPE c.
      l_file = in_file.
      l_lengt = strlen( in_file ).
      FORMAT INTENSIFIED ON.
      WRITE: / 'Reading file', in_file(l_lengt).
      CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
                filename = l_file
                filetype = 'ASC'
           TABLES
                data_tab = it_rdata
           EXCEPTIONS
                OTHERS   = 1.
      IF sy-subrc <> 0.
        WRITE: /3 'Error uploading', l_file.
        STOP.
      ENDIF.
    File not empty
      DESCRIBE TABLE it_rdata LINES sy-tmaxl.
      IF sy-tmaxl = 0.
        WRITE: /3 'File', l_file, 'is empty'.
        STOP.
      ELSE.
        WRITE: '-', sy-tmaxl, 'rows read'.
      ENDIF.
    File header on first row
      READ TABLE it_rdata INTO is_rdata INDEX 1.
      l_ltext = is_rdata.
      WHILE l_ltext CS p_separ.
        SPLIT l_ltext AT p_separ INTO l_field l_ltext.
        APPEND l_field TO it_fields.
      ENDWHILE.
      IF sy-subrc = 0.
        l_field = l_ltext.
        APPEND l_field TO it_fields.
      ENDIF.
    Check all key fields are present
      SKIP.
      FORMAT RESET.
      FORMAT COLOR COL_HEADING.
      WRITE: /3 'Key fields'.
      FORMAT RESET.
      LOOP AT it_dd03p INTO is_dd03p WHERE NOT keyflag IS initial.
        WRITE: /3 is_dd03p-fieldname.
        READ TABLE it_fields WITH KEY table_line = is_dd03p-fieldname
                             TRANSPORTING NO FIELDS.
        IF sy-subrc = 0.
          FORMAT COLOR COL_POSITIVE.
          WRITE: 'ok'.
          FORMAT RESET.
        ELSEIF is_dd03p-datatype NE 'CLNT'.
          FORMAT COLOR COL_NEGATIVE.
          WRITE: 'error'.
          FORMAT RESET.
          l_missk = 'X'.
        ENDIF.
      ENDLOOP.
    Log other fields
      SKIP.
      FORMAT COLOR COL_HEADING.
      WRITE: /3 'Other fields'.
      FORMAT RESET.
      LOOP AT it_dd03p INTO is_dd03p WHERE keyflag IS initial.
        WRITE: /3 is_dd03p-fieldname.
        READ TABLE it_fields WITH KEY table_line = is_dd03p-fieldname
                             TRANSPORTING NO FIELDS.
        IF sy-subrc = 0.
          WRITE: 'X'.
        ENDIF.
      ENDLOOP.
    Missing key field
      IF l_missk = 'X'.
        SKIP.
        WRITE: /3 'Missing key fields - no further processing'.
        STOP.
      ENDIF.
    ENDFORM.
          FORM f_process_data                                           *
    FORM f_process_data.
      DATA: l_ltext TYPE string,
            l_stext TYPE text40,
            l_field TYPE fieldname,
            l_datat TYPE c.
      LOOP AT it_rdata INTO is_rdata FROM 2.
        l_ltext = is_rdata.
        LOOP AT it_fields INTO l_field.
          ASSIGN COMPONENT l_field OF STRUCTURE <data> TO <fs>.
          IF sy-subrc = 0.
          Field value comes from file, determine conversion
            DESCRIBE FIELD <fs> TYPE l_datat.
            CASE l_datat.
              WHEN 'N'.
                SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
                WRITE l_stext TO <fs> RIGHT-JUSTIFIED.
                OVERLAY <fs> WITH '0000000000000000'.           "max 16
              WHEN 'P'.
                SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
                TRANSLATE l_stext USING ',.'.
                <fs> = l_stext.
              WHEN 'F'.
                SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
                TRANSLATE l_stext USING ',.'.
                <fs> = l_stext.
              WHEN 'D'.
                SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
                TRANSLATE l_stext USING '/.-.'.
                CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
                     EXPORTING
                          date_external = l_stext
                     IMPORTING
                          date_internal = <fs>
                     EXCEPTIONS
                          OTHERS        = 1.
              WHEN 'T'.
                CALL FUNCTION 'CONVERT_TIME_INPUT'
                     EXPORTING
                          input  = l_stext
                     IMPORTING
                          output = <fs>
                     EXCEPTIONS
                          OTHERS = 1.
              WHEN OTHERS.
                SPLIT l_ltext AT p_separ INTO <fs> l_ltext.
            ENDCASE.
          ELSE.
            SHIFT l_ltext UP TO p_separ.
            SHIFT l_ltext.
          ENDIF.
        ENDLOOP.
        IF NOT <data> IS INITIAL.
          LOOP AT it_dd03p INTO is_dd03p WHERE datatype = 'CLNT'.
          This field is mandant
            ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
                                                          TO <fs>.
            <fs> = sy-mandt.
          ENDLOOP.
          IF p_create = 'X'.
            IF is_dd03p-rollname = 'ERDAT'.
              ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
                                                            TO <fs>.
              <fs> = sy-datum.
            ENDIF.
            IF is_dd03p-rollname = 'ERZET'.
              ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
                                                            TO <fs>.
              <fs> = sy-uzeit.
            ENDIF.
            IF is_dd03p-rollname = 'ERNAM'.
              ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
                                                            TO <fs>.
              <fs> = sy-uname.
            ENDIF.
          ENDIF.
          IF is_dd03p-rollname = 'AEDAT'.
            ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
                                                          TO <fs>.
            <fs> = sy-datum.
          ENDIF.
          IF is_dd03p-rollname = 'AETIM'.
            ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
                                                          TO <fs>.
            <fs> = sy-uzeit.
          ENDIF.
          IF is_dd03p-rollname = 'AENAM'.
            ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
                                                          TO <fs>.
            <fs> = sy-uname.
          ENDIF.
          APPEND <data> TO <table>.
        ENDIF.
      ENDLOOP.
    ENDFORM.
          FORM f_modify_table                                           *
    FORM f_modify_table.
      SKIP.
      IF p_save = 'X'.
        MODIFY (p_table) FROM TABLE <table>.
      ELSEIF p_dele = 'X'.
        DELETE (p_table) FROM TABLE <table>.
      ELSE.
        EXIT.
      ENDIF.
      IF sy-subrc EQ 0.
        FORMAT COLOR COL_POSITIVE.
        IF p_save = 'X'.
          WRITE: /3 'Modify table OK'.
        ELSE.
          WRITE: /3 'Delete table OK'.
        ENDIF.
        FORMAT RESET.
        IF p_test IS INITIAL.
          COMMIT WORK.
        ELSE.
          ROLLBACK WORK.
          WRITE: '- test only, no update'.
        ENDIF.
      ELSE.
        FORMAT COLOR COL_NEGATIVE.
        WRITE: /3 'Error while modifying table'.
        FORMAT RESET.
      ENDIF.
    ENDFORM.
          FORM f_list_records                                           *
    FORM f_list_records.
      DATA: l_tleng TYPE i,
            l_lasti TYPE i,
            l_offst TYPE i.
    Output width
      l_tleng = 1.
      LOOP AT it_dd03p INTO is_dd03p.
        l_tleng = l_tleng + is_dd03p-outputlen.
        IF l_tleng LT sy-linsz.
          l_lasti = sy-tabix.
          l_tleng = l_tleng + 1.
        ELSE.
          l_tleng = l_tleng - is_dd03p-outputlen.
          EXIT.
        ENDIF.
      ENDLOOP.
    Output header
      SKIP.
      FORMAT COLOR COL_HEADING.
      WRITE: /3 'Contents'.
      FORMAT RESET.
      ULINE AT /3(l_tleng).
    Output records
      LOOP AT <table> ASSIGNING <data>.
        LOOP AT it_dd03p INTO is_dd03p FROM 1 TO l_lasti.
          IF is_dd03p-position = 1.
            WRITE: /3 sy-vline.
            l_offst = 3.
          ENDIF.
          ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data> TO <fs>.
          l_offst = l_offst + 1.
          IF is_dd03p-decimals LE 2.
            WRITE: AT l_offst <fs>.
          ELSE.
            WRITE: AT l_offst <fs> DECIMALS 3.
          ENDIF.
          l_offst = l_offst + is_dd03p-outputlen.
          WRITE: AT l_offst sy-vline.
        ENDLOOP.
      ENDLOOP.
    Ouptut end
      ULINE AT /3(l_tleng).
    ENDFORM.
    Regards,
    Joy.

  • Updating database table using ALV Grid class CL_ALV_CHANGED_DATA_PROTOCOL

    Hi,
    I am trying to use class CL_ALV_CHANGED_DATA_PROTOCOL to update a database table from an ALV grid.
    I have used program BCALV_EDIT_04 as an example.
    I am able to successfully processed inserted or deleted lines using the attributes
    MT_DELETED_ROWS
    MT_INSERTED_ROWS
    but I also want to process modified lines.
    I was just wondering whether anyone out there has some example code for this.
    I can see that there are the following attributes available
    MT_MOD_CELLS
    MP_MOD_ROWS.
    I would ideally like to use MP_MOD_ROWS rather than  MT_MOD_CELLS but it is not clear to me what type MP_MOD_ROWS is.
    If anyone has any example code for this sort of thing, please let me know.
    Thanks,
    Ruby

    hi Ruby,
    Yes we can use that *data reference variable *.
    It is a variable( something comparable to a pointer ) that points to a int table( table with changed contents )
    which ll be created at run-time based on the data type ot the internal table that we pass to the parameter it_outtab of method set_table_for_first_display ...
    assign er_data_changed->mp_mod_rows->* to a field-symbol and use it...
    Check the below code for example -> method refresh_changed_data
    screen flow logic.
    PROCESS BEFORE OUTPUT.
      MODULE pbo.
    PROCESS AFTER INPUT.
      MODULE pai.
    main program.
    *       CLASS lcl_event_responder DEFINITION                           *
    CLASS lcl_event_responder DEFINITION.
      PUBLIC SECTION.
        DATA  : ls_changed_cell TYPE  lvc_s_modi,
                lv_language     TYPE  spras..
        METHODS refresh_changed_data  FOR EVENT data_changed
                                      OF cl_gui_alv_grid
                                      IMPORTING er_data_changed
                                                e_ucomm.
    ENDCLASS.                    "event_responder DEFINITION
    TYPES tt_makt TYPE STANDARD TABLE OF makt.
    DATA: go_handler         TYPE REF TO lcl_event_responder,
          go_grid            TYPE REF TO cl_gui_alv_grid,
          gt_fieldcat        TYPE lvc_t_fcat,
          gv_language        TYPE spras VALUE 'E',
          gt_outtab          TYPE tt_makt,
          gs_tableline       TYPE LINE OF tt_makt.
    FIELD-SYMBOLS : <changed_rows> TYPE tt_makt.
    CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'BASIC'.
      PERFORM create_and_init_alv CHANGING gt_outtab[]
                                           gt_fieldcat.
    ENDMODULE.                    "pbo OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      LEAVE PROGRAM.
    ENDMODULE.                    "pai INPUT
    FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
                                      pt_fieldcat TYPE lvc_t_fcat.
      CHECK go_grid IS NOT BOUND.
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = cl_gui_container=>default_screen.
      PERFORM build_display_table.
      PERFORM build_fieldcat CHANGING pt_fieldcat.
      go_grid->set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                      it_outtab            = pt_outtab ).
      go_grid->set_ready_for_input( 1 ).
    * raises the 'data_changed' event when we select another cell/any action after changing the data
      go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter ).
      CREATE OBJECT go_handler.
      SET HANDLER go_handler->refresh_changed_data FOR go_grid.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    FORM build_display_table.
      FREE gt_outtab.
      SELECT * FROM makt UP TO 20 ROWS INTO TABLE gt_outtab WHERE spras EQ gv_language.
    ENDFORM.                               "build_display_table
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'MAKT'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
        ls_fcat-edit       = abap_true.
        MODIFY pt_fieldcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                               "build_fieldcat
    *       CLASS event_responder IMPLEMENTATION                          *
    CLASS lcl_event_responder IMPLEMENTATION.
      METHOD refresh_changed_data.
        ASSIGN er_data_changed->mp_mod_rows->* TO <changed_rows>.
        LOOP AT <changed_rows> INTO gs_tableline.
          BREAK-POINT.
        ENDLOOP.
      ENDMETHOD.                    "click
    ENDCLASS.                    "event_responder IMPLEMENTATION
    Cheers,
    Jose.

  • How to generate the java classes of the database tables

    Hi,
    I am using Sun One 4 update1 CE for generate java classes of tables from an Oracle database. I have got the database schema file. However, when I right clicked on the database schema file, there is no selection for "Generate Java...".
    Besides, when I was trying to use database Schema template from the project tab in the explore window by double click on the project, after following all the procedures of inputing the database url, driver, uername, password, and select the table to generate, the following exception came out:
    Tue Jan 28 16:22:28 PST 2003: java.lang.NullPointerException: Posted StackTrace
    Annotation: Exception occurred in Request Processor
    org.openide.util.RequestProcessor$Holder: Posted StackTrace(task org.netbeans.core.ModuleActions$1@e4b7d3 [-31035, 1, -1])
    at org.openide.util.RequestProcessor$Holder.fillInStackTrace(RequestProcessor.java:300)
    at java.lang.Throwable.<init>(Throwable.java:195)
    at java.lang.Exception.<init>(Exception.java:41)
    at org.openide.util.RequestProcessor$Holder.<init>(RequestProcessor.java:280)
    at org.openide.util.RequestProcessor$Task.createHolder(RequestProcessor.java:333)
    at org.openide.util.RequestProcessor.post(RequestProcessor.java:100)
    at org.openide.util.RequestProcessor.post(RequestProcessor.java:73)
    at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:123)
    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:324)
    at org.openide.explorer.view.TreeView.invokeAction(TreeView.java:878)
    at org.openide.explorer.view.TreeView$PopupSupport.mouseClicked(TreeView.java:958)
    at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:208)
    at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:207)
    at java.awt.Component.processMouseEvent(Component.java:5096)
    at java.awt.Component.processEvent(Component.java:4890)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3174)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    at java.awt.Container.dispatchEventImpl(Container.java:1609)
    at java.awt.Window.dispatchEventImpl(Window.java:1585)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    Tue Jan 28 16:22:28 PST 2003: java.lang.NullPointerException: <no message>
    java.lang.NullPointerException
    at org.netbeans.modules.projects.ProjectDataObject.add(ProjectDataObject.java:204)
    at org.netbeans.modules.projects.AddNewAction.performAction(AddNewAction.java:88)
    at org.openide.util.actions.NodeAction.actionPerformed(NodeAction.java:167)
    at org.netbeans.core.ModuleActions$1.run(ModuleActions.java:105)
    at org.openide.util.Task.run(Task.java:152)
    [catch] at org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:622)
    Any suggestions to the solution of these problems are greatly appreciated. Thanks.
    Yi-Xiong

    you also could use this to generate java beans out of database tables:
         * Convert SQL type code to corresponding Java class.
         * @param sqlType One of java.sql.Types.xxx.
         * @return Class that corresponds to the given type.
        public static Class toClass(int sqlType) {
            Class result = null;
            switch (sqlType) {
            case Types.BIGINT :
            case Types.INTEGER :
            case Types.SMALLINT :
            case Types.TINYINT :
                result = Integer.class;
                break;
            case Types.BIT :
            case Types.BOOLEAN :
                result = Boolean.class;
                break;
            case Types.CHAR :
                result = Character.class;
                break;
            case Types.DATE :
            case Types.TIMESTAMP :
                result = java.util.Date.class;
                break;
            case Types.DECIMAL :
            case Types.DOUBLE :
            case Types.FLOAT :
                result = BigDecimal.class;
                break;
            case Types.NULL :
                result = null;
                break;
            case Types.LONGVARCHAR :
            case Types.VARCHAR :
            default :
                result = String.class;
                break;
            return result;
        }//toClass()
         * Create a Java bean (source file) to map a database table. The class name is the table name, the bean
         * properties are the table columns. Each column will result in a property with a corresponding set() and
         * get() method.
         * @param connection Database connection to load table from.
         * @param tableName Name of table to create the bean for.
         * @param packageName Name of package for Java class.
         * @param className Name of Java class to create.
         * @param superClass Optional name of super class.
         * @return Java source of container class.
         * @throws SQLException, IOException
         * @see <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html">Data Access Object </a>
        public static String getTableBean(Connection connection, String tableName, String packageName, String className, String superClass)
                throws SQLException, IOException {
            String result = null;
            if (connection != null && tableName != null) {
                //read table columns:
                DatabaseMetaData dmd = connection.getMetaData();
                ResultSet resultSet = dmd.getColumns(null, "%", tableName, null);
                Properties props = new Properties();
                if (resultSet != null) {
                    while (resultSet.next()) { //for each table
                        String name = resultSet.getString("COLUMN_NAME");
                        int type = resultSet.getInt("DATA_TYPE");
                        props.setProperty(name, ""+type);
                    }//next table
                }//else: resultSet unavailable
                Set imports = new HashSet();
                StringBuffer sb1 = new StringBuffer(); //fields
                StringBuffer sb2 = new StringBuffer(); //methods
                StringBuffer sb3 = new StringBuffer(); //toString()
                Enumeration enum = props.keys();
                while (enum.hasMoreElements()) {
                    String columnName = (String) enum.nextElement();
                    //change first character of column name to lower case:
                    String fieldName = columnName.substring(0, 1).toLowerCase() + columnName.substring(1);
                    //datat type:
                    String stype = props.getProperty(columnName, ""+Types.VARCHAR);
                    int type = (new Integer(stype)).intValue();
                    Class javaClass = toClass(type);
                    String typeName = "String"; //default
                    if (javaClass != null) {
                        String javaClassName = javaClass.getName();
                        int lastDot = javaClassName.lastIndexOf('.');
                        if (lastDot >= 0) {
                            typeName = javaClassName.substring(lastDot + 1);
                        if (!javaClassName.startsWith("java.lang.")) {
                            imports.add(javaClassName);
                    //field:
                    sb1.append("    /** ");
                    sb1.append(columnName);
                    sb1.append(" */\n");
                    sb1.append("    private ");
                    sb1.append(typeName);
                    sb1.append(" ");
                    sb1.append(fieldName);
                    sb1.append(" = null;\n");
                    //toString() method:
                    sb3.append("        sb.append(\",");
                    sb3.append(fieldName);
                    sb3.append("=\");\n");
                    sb3.append("        sb.append(");
                    sb3.append(fieldName);
                    sb3.append(");\n");
                    //set method:
                    sb2.append("    /**\n");
                    sb2.append("     * Set ");
                    sb2.append(columnName);
                    sb2.append(".\n     *\n     * @param value ");
                    sb2.append(columnName);
                    sb2.append(" to set.\n");
                    sb2.append("     */\n");
                    sb2.append("    public void set");
                    sb2.append(columnName);
                    sb2.append("(");
                    sb2.append(typeName);
                    sb2.append(" value) {\n        ");
                    sb2.append(fieldName);
                    sb2.append(" = value;\n    }\n\n");
                    //get method:
                    sb2.append("    /**\n");
                    sb2.append("     * Get ");
                    sb2.append(columnName);
                    sb2.append(".\n     *\n     * @return ");
                    sb2.append(columnName);
                    sb2.append(".\n     */\n");
                    sb2.append("    public ");
                    sb2.append(typeName);
                    sb2.append(" get");
                    sb2.append(columnName);
                    sb2.append("() {\n");
                    sb2.append("        return ");
                    sb2.append(fieldName);
                    sb2.append(";\n    }\n\n");
                }//next column
                //build class source code:
                StringBuffer sb = new StringBuffer();
                sb.append("/* $Header: /data/iComps/icf/prg/java/src/de/icomps/sql/JDBCUtils.java 9     24.10.03 14:25 Hilpert $ */\n");
                sb.append("package ");
                sb.append(packageName);
                sb.append(";\n\n");
                //import statements:
                Iterator iterator = imports.iterator();
                while (iterator.hasNext()) {
                    String jcn = (String) iterator.next();
                    sb.append("import ");
                    sb.append(jcn);
                    sb.append(";\n");
                if (imports.size() > 0) {
                    sb.append("\n");
                //class:
                sb.append("/**\n");
                sb.append(" * Container class to store data of one record (row) of table '"+tableName+"'.\n");
                sb.append(" *\n");
                sb.append(" * @version $Revision: 9 $ ($Date: 24.10.03 14:25 $)\n");
                sb.append(" * @author $Author: Hilpert $\n");
                sb.append(" */\n");
                sb.append("public class ");
                sb.append(className);
                if (superClass != null) {
                    sb.append(" extends ");
                    sb.append(superClass);
                sb.append(" {\n\n");
                //fields:
                sb.append(sb1.toString());
                //methods:
                sb.append("\n\n");
                sb.append(sb2.toString()); //methods
                //overwrite toString() method:
                sb.append("    /**\n");
                sb.append("     * Overwrite super.\n");
                sb.append("     *\n     * @return String representation of the object.\n");
                sb.append("     */\n");
                sb.append("    public String toString() {\n");
                sb.append("        StringBuffer sb = new StringBuffer(super.toString());\n\n");
                sb.append(sb3.toString());
                sb.append("\n        return sb.toString();\n");
                sb.append("    }\n\n");
                sb.append("}//"+className);
                result = sb.toString();
            }//else: input unavailable
            return result;
        }//getTableBean()

  • Uploading excel data to database table

    Dear Experts,
                         I have an Excel file which was downloaded from SQL database, now I need to export this data into my 'ztable', for this first I created an internal table of ztable structure and tried to upload into this table through ''TEXT_CONVERT_XLS_TO_SAP".
    But I was unable to get data into the internal table(incompatible type), so now I created an internal table of character type fileds now I able to get data to this internal table, but to put this internal table data to actual database table it gives error, here the actual problem is the fields of internal table are getting concated with blank spaces(observed through debug), I unable to condense these blanks also, (I have created an Excel of my own and put data into it and uploaded that data there is no problem working fine but this problem occurs only for the excel downloaded from SQL db)
                       The problem occurs for quantity and currency fields(I tried through standard FMs also to convert data types ), Could plz suggest something..........
                                                                                    Thank you
                                                                                    Regards
                                                                                    Srinivas

    Hi,
    To upload excel sheet into database table, define a types which is of same as table fields.
    and try it with the function module  TEXT_CONVERT_XLS_TO_SAP
    Here is a sample code:
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
            EXPORTING
             I_FIELD_SEPERATOR          ='X'   
              i_tab_raw_data             = fs_truxs( TYPE of  truxs_t_text_data.)
              i_filename                 = '<FILE-PATH>'
          tables
              i_tab_converted_data       = <Internal Table>
           EXCEPTIONS
             CONVERSION_FAILED          = 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.
    LOOP AT <internal-table> INTO field string.
    INSERT <DATABASE- TABLE> FROM <field string>.
    ENDLOOP.
    Hope this solves the issue.
    Regards,
    Rajani

  • Webdynpro abap-method for saving updated values in new database table

    Hi Experts,
    I am creating an ALV  application in weddynpro abap where i have given update button to update fields & save button to save values in mastertable,but whenever i am updating & saving ,it will overwrit previous values. For this,I need  to create a separate method to save the updated values of the fields in a new database table.
    Looking forward for solutions.
    Thank You!

    becuase of the below statement u r getting the error
    insert into ZTAB_CS_ISSSAL values Item_Dates.
    u declared the field Item_Dates as Stru_Issuesal-DATES
    and u were trying to inesrting the record in the table ZTAB_CS_ISSSAL with the field Item_Dates
    the error is related to the compatible.
    so declare work area for updating the table should be of type ZTAB_CS_ISSSAL.

Maybe you are looking for