Dynamic type variable creation

I want to create a variable with a pre-defined TYPE, but the latter will only be known at runtime.
For instance:
Consider that I my DEFINITIONS1 include file is:
TYPES: BEGIN OF type1,
                field1 TYPE i,
                field2 TYPE i,
                field3 TYPE i,
            END OF type1,
              BEGIN OF cust_type_A,
                   INCLUDE TYPE type1.
TYPES:       erdat TYPE vbak-erdat,
              END OF cust_type_A,
             BEGIN OF cust_type_B,
                   INCLUDE TYPE type1.
TYPES:       fkdat TYPE vbrk-fkdat,
              END OF cust_type_B.
Than I have the following code (assume "letter" is a character parameter I receive, either 'A' or 'B'):
INCLUDE definitions1.
DATA: z TYPE REF to data.
FIELD-SYMBOLS: <fs> TYPE ANY.
DATA str type string.
CONCATENATE 'MY_CUST_TYPE_' letter INTO str.
CREATE DATA z TYPE (str).
*  ASSIGN z->* TO <fs>.
Why is that that the CREATE DATA z TYPE (str) statement fails ?
How, then, I create a variable/field symbol from a specific type, which will only be known at runtime ?
Thanks
Avraham

Check this code to create a dynamic type at run time using the RTTS - Run Time Type Services.
DATA: lo_struct   TYPE REF TO cl_abap_structdescr,
      lo_element  TYPE REF TO cl_abap_elemdescr,
      lo_new_type TYPE REF TO cl_abap_structdescr,
      lo_data     TYPE REF TO data,
      lt_comp     TYPE cl_abap_structdescr=>component_table,
      lt_tot_comp TYPE cl_abap_structdescr=>component_table,
      la_comp     LIKE LINE OF lt_comp.
DATA: lc_num TYPE char10.
* field symbols to access the dynamic table
FIELD-SYMBOLS: <f_line>  TYPE ANY,
               <f_field> TYPE ANY.
PARAMETERS: p_a RADIOBUTTON GROUP rd1,
            p_b RADIOBUTTON GROUP rd1.
START-OF-SELECTION.
  DO 3 TIMES.
    lc_num = sy-index.
    CONDENSE lc_num.
*   Element Description
    lo_element ?= cl_abap_elemdescr=>describe_by_name( 'INT4' ).
*   Field name
    CONCATENATE 'FIELD' lc_num INTO la_comp-name.
*   Field type
    la_comp-type = cl_abap_elemdescr=>get_p(
                      p_length   = lo_element->length
                      p_decimals = lo_element->decimals ).
*   Filling the component table
    APPEND la_comp TO lt_tot_comp.
    CLEAR: la_comp.
  ENDDO.
  IF p_a = 'X'.
*   Element Description
    lo_element ?= cl_abap_elemdescr=>describe_by_name( 'ERDAT' ).
*   Field name
    la_comp-name = 'ERDAT'.
*   Field type
    la_comp-type = cl_abap_elemdescr=>get_p(
                      p_length   = lo_element->length
                      p_decimals = lo_element->decimals ).
*   Filling the component table
    APPEND la_comp TO lt_tot_comp.
    CLEAR: la_comp.
  ELSEIF p_b = 'X'.
*   Element Description
    lo_element ?= cl_abap_elemdescr=>describe_by_name( 'FKDAT' ).
*   Field name
    la_comp-name = 'FKDAT'.
*   Field type
    la_comp-type = cl_abap_elemdescr=>get_p(
                      p_length   = lo_element->length
                      p_decimals = lo_element->decimals ).
*   Filling the component table
    APPEND la_comp TO lt_tot_comp.
    CLEAR: la_comp.
  ENDIF.
* 3. Create a New Type
  lo_new_type = cl_abap_structdescr=>create( lt_tot_comp ).
* 5. data to handle the new table type
  CREATE DATA lo_data TYPE HANDLE lo_new_type.
* 6. New internal table in the fieldsymbols
  ASSIGN lo_data->* TO <f_line>.
Regards,
Naimesh Patel

Similar Messages

  • Dynamic type variables

    I have a function module that receives a table name, in a character variable.
    How do I create a variable, within the function, of the type of the parameter-passed table ?
    I've been trying with field-symbols and create data, but without success.
    Could anyone show me an example please?
    Thanks
    Avraham

    Hi Avraham,
    maybe this helps:
    data: lt_table type ref to data.
    create data lt_table type standard table of ('SFLIGHT').
    With create data you can achieve what you need.
    Then analyze the fields in the table and use it with that information.
    here you will want to look at classes cl_abap_typedescr, cl_abap_tabledescr and cl_abap_structdescr.
    Hope that helps,
    Lutz
    Edited by: Lutz Morrien on Oct 29, 2008 11:18 AM

  • Dynamic variable creation

    i would like to know how to make use of bind variables in RPD variable creation . I tried creating in oracle10g by giving a sql query in Initiliazation block . I want to select a column based on a certain user input . For Your information i cannot use ':user' because it by default takes then current user who has logged in .

    If you are solely asking for a variable that would hold the value of username, Yes that is possible. It depends on the type of authentication you are using. Assuming you are using an LDAP server, providing the solution below:
    1) Source the list of usernames in to a external table in the database.
    2) Create an intialization block to populate that value based on user login.
    Ex: select username1 from externaltable where username1=':user' - Data Source
    variablename - Data target.
    Now you can use this in your required init block.
    Hope this answers your question.
    Please award points if helpful.
    Thanks,
    -Amith.

  • Creation of Dynamic Date Variables to be used in WebI reports

    What we are trying to achieve is to create 4 optional filters (Current Day, Current Week, Last Week, Last Month) on 4 different dates which will allow the users to use them in WebI reports.
    When using an optional SAP Customer Exit variable in BEx and creating a Universe on top, the filter becomes mandatory (i.e. the whole Universe is filtered by the SAP Exit, irrespective of whether the filter is used in the WebI report). Even if the filter is flagged as optional at the Universe level, it still behaves as mandatory.
    If each filter becomes mandatory then we'll have to create 16 different Universes (for each optional filter and date combination)! This is not feasible.
    I've seen in other posts that MDX Statements are not currently supported for Universes base on BW and SAP Exit should be utilized.
    So with the existing BO version, is it possible to create optional dynamic date variables or is that a product limitation?
    We are on XI3.1 SP3 FP3.1
    Thanks

    Hi Adam,
    In BEx, I would create this query very easily using the "Amount" key figure twice in my results and restricting each with a different SAP standard out-of-the-box delivered variable. For your reference, the variables in BEx are: 0FPER and 0FYTLFP.
    If I expose these variables in my OLE DB for OLAP query, they are not transfered into the universe, but rather act as filters on the entire universe. I've seen in documentation that only "Ready for Input" variables can be transfered as options into the universe which is not something that I have seen mentioned in this thread.
    >> In the BEx Query you have the option to either make the variable "ready for input" or not. The behavior is the same in Bex or in the Universe / Web Intelligence. "Ready for input" means the user can actually provide an input and without the flag the user can not provide an input. Yes those variables are supported in the Universe.
    Why this is a problem: I can't create separate universes based on potential variable periods that users might want to see. Additionally, many financial reports require concurrent use of these measures in the same report. Also, in reality it's not 2 variables, but dozens.
    >> Which is a decision you make already on the BEx query level. if you decide that the variable is not ready for input then the user can change the timeframe in BEx either.
    Also, I don't have a good way to mimic the standard out-of-the-box functionality given with BEx in BO. If I custom create all my variables in the universe, how do I do a lookup from the system date to the fiscal calendar that is stored on the BW server? In other words, how does BO know which date belongs in which period? (the same would be true with factory calendars for a different functional area).
    >> Variable are created in the BEx query and the Universe will leverage those.
    If you want a dynamic date range then EXIT variable as part of the BEx query - ready for input or not - is the solution.
    regards
    Ingo Hilgefort
    The only work around I can see is to require users to enter the current fiscal period and have the BO reports filter based off that user entered value. This is unfortunate as the entire purpose of SAP Exit variables is to avoid having to require user input at report time.

  • Acces dynamic configuration variable (e.g. filename) in ABAP mapping class

    Hi experts
    I am searching for a possibility to acces a dynamic configuration variable (DCV) in an ABAP mapping class. Since I could not find a solution in SDN and other sources, I hope somebody in this forum can help me.
    What I already found is the following code which can be used to set a DCV, but what I would be interested in is how to read a DCV.
    Any help is appreciated.
    Markus
    METHOD if_mapping~execute.
    DATA l_record type mpp_dynamic.
    * copy payload
    result = source.
    * add an adapter specific attribute
    l_record-namespace = 'http://sap.com/xi/XI/System/File'.
    l_record-name = 'FileName'.
    l_record-value = 'test.xml'.
    dynamic_configuration->add_record( l_record ).
    ENDMETHOD.

    Hi Markus,
    you can find everything in my blogs
    /people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping
    Regards,
    michal

  • Dynamic Connection Pool Creation Failing in a cluster

    Hi,
    I am trying to create a connection pool in a clustered environment. This connection
    pool is created lazily behind a Stateless Session Bean. We first attempt to determine
    whether, the connection pool exists using JdbcServices.poolExists(someName), and
    create it if it does not exist. A failure occurs on creation because it looks
    like the connection pool might have been created by a bean on a different weblogic
    VM instance. Is there any way to dynamically create a connection pool and make
    it visible to the whole cluster? Thanks in advance for any help. Michael Dolbear
    Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Checking existence of connection pool
    Content
    ConnectionPool requested by user guest>
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Creating connection pool ContentConnectionPoo
    l requested by user guest>
    weblogic.common.ResourceException: weblogic.management.MBeanCreationException:
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:134)
    at com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.java:
    2352)
    at com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:874)
    at weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBeanSer
    verImpl.java:181)
    at weblogic.management.internal.Helper.createMBean(Helper.java:376)
    at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
    at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
    at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.MBeanCreationException: - with nested exception:
    [javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool]
    at weblogic.management.internal.Helper.createMBean(Helper.java:383)
    at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
    at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
    at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    - with nested exception:
    [javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
            at com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:134)
            at com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.java:
    2352)
            at com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:874)
            at weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBeanSer
    verImpl.java:181)
            at weblogic.management.internal.Helper.createMBean(Helper.java:376)
            at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
            at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
            at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
            at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
            at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
            at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
            at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
            at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
            at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End  server side stack trace
    at weblogic.jdbc.common.internal.ConnectionPool.dynaStartup(ConnectionPool.java:47
    2)
    at weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.java:727
    at weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.java:709
    at com.thc.ids.inf.framework.opf.rdbms.datastore.ConnectionPoolCreator.createConne
    ctionPool(ConnectionPoolCreator.java:82)
    at com.thc.ids.inf.framework.opf.datastore.DataStoreRepository.createConnectionPoo
    lIfNonExistent(DataStoreRepository.java:211)
    at com.thc.ids.inf.util.persistence.content.ConnectionPoolInitializer.createConnec
    tionPoolIfNeeded(ConnectionPoolInitializer.java:48)
    at com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.create
    ConnectionPoolIfNeeded(Unknown Source)
    at com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.getIma
    ge(Unknown Source)
    at com.thc.ids.inf.services.business.crs.ContentRetrievalService.getImage(Unknown
    Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.thc.ids.inf.util.reflection.MethodDescription.invokeMethod(MethodDescriptio
    n.java:181)
    at com.thc.ids.inf.util.reflection.MethodInvocation.invoke(MethodInvocation.java:7
    9)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean.invoke(ServiceBean.java:
    186)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl.invoke(Ser
    viceBean_bjedmi_EOImpl.java:37)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl_WLSkel.inv
    oke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Checking existence of connection
    pool Content
    ConnectionPool requested by user guest>
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Creating connection pool ContentConnectionPoo
    l requested by user guest>
    weblogic.common.ResourceException: weblogic.management.MBeanCreationException:
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:134)
    at com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.java:
    2352)
    at com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:874)
    at weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBeanSer
    verImpl.java:181)
    at weblogic.management.internal.Helper.createMBean(Helper.java:376)
    at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
    at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
    at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.MBeanCreationException: - with nested exception:
    [javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool]
    at weblogic.management.internal.Helper.createMBean(Helper.java:383)
    at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
    at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
    at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    - with nested exception:
    [javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
            at com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:134)
            at com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.java:
    2352)
            at com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:874)
            at weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBeanSer
    verImpl.java:181)
            at weblogic.management.internal.Helper.createMBean(Helper.java:376)
            at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
            at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
            at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
            at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
            at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
            at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
            at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
            at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
            at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End  server side stack trace
    at weblogic.jdbc.common.internal.ConnectionPool.dynaStartup(ConnectionPool.java:47
    2)
    at weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.java:727
    at weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.java:709
    at com.thc.ids.inf.framework.opf.rdbms.datastore.ConnectionPoolCreator.createConne
    ctionPool(ConnectionPoolCreator.java:82)
    at com.thc.ids.inf.framework.opf.datastore.DataStoreRepository.createConnectionPoo
    lIfNonExistent(DataStoreRepository.java:211)
    at com.thc.ids.inf.util.persistence.content.ConnectionPoolInitializer.createConnec
    tionPoolIfNeeded(ConnectionPoolInitializer.java:48)
    at com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.create
    ConnectionPoolIfNeeded(Unknown Source)
    at com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.getIma
    ge(Unknown Source)
    at com.thc.ids.inf.services.business.crs.ContentRetrievalService.getImage(Unknown
    Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.thc.ids.inf.util.reflection.MethodDescription.invokeMethod(MethodDescriptio
    n.java:181)
    at com.thc.ids.inf.util.reflection.MethodInvocation.invoke(MethodInvocation.java:7
    9)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean.invoke(ServiceBean.java:
    186)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl.invoke(Ser
    viceBean_bjedmi_EOImpl.java:37)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl_WLSkel.inv
    oke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

    The only way to do it is using MBeans. You could search this newsgroup
    for "JDBCConnectionPoolMBean" to get an idea of how it could be done.
    Slava
    P.S. http://search.bea.com/weblogic/gonews
    "Mark Mortensen" <[email protected]> wrote in message
    news:[email protected]...
    >
    Slava,
    I am working with Mike on this issue and wanted to add some moreclarifications.
    We have a two server cluster where one of the EJB's on one of the Managedservers
    creates the connection pool. The problem comes in when a request comes tothe
    second server in the cluster. The connection pool is created by the firstserver
    but it is only assigned to the first server in the targets section on theconsole.
    It isn't assigned to the cluster. Is there a way to programmaticallyassign the
    pool to the cluster instead of just the server that created the pool?
    -Mark
    "Michael Dolear" <[email protected]> wrote:
    Hi Slava,
    Here is what I am doing. The code is spread across a couple of classes.
    I am using
    what was described in BEA's doc on dynamic connection pool creation.
    I didn't
    see anything about MBean apis required:
    * Dynamically create a connection pool using
    aConnectionPoolProperties.
    Please
    see ConnectionPoolCreator
    * for the required properties that must be sent in.
    * @param aConnectionPoolProperties
    public synchronized void createConnectionPoolIfNonExistent(Properties
    aConnectionPoolProperties)
    throwsPersistenceFrameworkInitializationException
    ConnectionPoolCreator tempPoolCreator;
    Pool tempPool;
    tempPoolCreator = new ConnectionPoolCreator();
    tempPool =tempPoolCreator.getConnectionPool(aConnectionPoolProperties);
    if (tempPool == null)
    tempPoolCreator.createConnectionPool(aConnectionPoolProperties);
    >>
    * Create Connection pool given the properties that I have beenconfigured
    with
    * @return Pool
    public Pool createConnectionPool(Properties aConnectionProperties)
    throwsPersistenceFrameworkInitializationException
    JdbcServices tempServices;
    try
    tempServices = this.lookupJdbcServices();
    tempServices.createPool(aConnectionProperties);
    returntempServices.getPool(aConnectionProperties.getProperty(CONNECTION_POOL_NAME)
    catch (Exception e)
    PersistenceFrameworkUtils.logException(e);
    throw newPersistenceFrameworkInitializationException(e.getMessage());
    * Answer a connectionPool or null.
    * @return Pool
    public Pool getConnectionPool(Properties aConnectionProperties)
    throwsPersistenceFrameworkInitializationException
    JdbcServices tempServices;
    try
    tempServices = this.lookupJdbcServices();
    if (tempServices.poolExists(
    aConnectionProperties.getProperty(CONNECTION_POOL_NAME)))
    return tempServices.getPool(
    aConnectionProperties.getProperty(CONNECTION_POOL_NAME));
    else
    return null;
    catch (Exception e)
    PersistenceFrameworkUtils.logException(e);
    throw
    newPersistenceFrameworkInitializationException(e.getMessage());
    "Slava Imeshev" <[email protected]> wrote:
    Hi Michael,
    Could you show us the code? Without looking at the code
    I can only say that JdbcServices.poolExists(someName)
    returns true only in case the pool is up and running.
    If the connection pool MBean was created but not assigned
    a target, subsequent tries to create it would fail.
    Regards,
    Slava Imeshev
    "Michael Dolbear" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I am trying to create a connection pool in a clustered environment.This
    connection
    pool is created lazily behind a Stateless Session Bean. We first
    attempt
    to determine
    whether, the connection pool exists usingJdbcServices.poolExists(someName), and
    create it if it does not exist. A failure occurs on creation becauseit
    looks
    like the connection pool might have been created by a bean on a
    different
    weblogic
    VM instance. Is there any way to dynamically create a connection pooland
    make
    it visible to the whole cluster? Thanks in advance for any help.
    Michael
    Dolbear
    Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Checking existence ofconnection pool
    Content
    ConnectionPool requested by user guest>
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Creating connection poolContentConnectionPoo
    l requested by user guest>
    weblogic.common.ResourceException:weblogic.management.MBeanCreationException:
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at
    com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:1
    34
    at
    com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.
    ja
    va:
    2352)
    at
    com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:
    87
    4)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBe
    an
    Ser
    verImpl.java:181)
    atweblogic.management.internal.Helper.createMBean(Helper.java:376)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.MBeanCreationException: - with nested exception:
    [javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool]
    atweblogic.management.internal.Helper.createMBean(Helper.java:383)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    - with nested exception:
    [javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at
    com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:1
    34
    at
    com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.
    ja
    va:
    2352)
    at
    com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:
    87
    4)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBe
    an
    Ser
    verImpl.java:181)
    atweblogic.management.internal.Helper.createMBean(Helper.java:376)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    at
    weblogic.jdbc.common.internal.ConnectionPool.dynaStartup(ConnectionPool.ja
    va
    :47
    2)
    at
    weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.jav
    a:
    727
    at
    weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.jav
    a:
    709
    at
    com.thc.ids.inf.framework.opf.rdbms.datastore.ConnectionPoolCreator.create
    Co
    nne
    ctionPool(ConnectionPoolCreator.java:82)
    at
    com.thc.ids.inf.framework.opf.datastore.DataStoreRepository.createConnecti
    on
    Poo
    lIfNonExistent(DataStoreRepository.java:211)
    at
    com.thc.ids.inf.util.persistence.content.ConnectionPoolInitializer.createC
    on
    nec
    tionPoolIfNeeded(ConnectionPoolInitializer.java:48)
    at
    com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.c
    re
    ate
    ConnectionPoolIfNeeded(Unknown Source)
    at
    com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.g
    et
    Ima
    ge(Unknown Source)
    at
    com.thc.ids.inf.services.business.crs.ContentRetrievalService.getImage(Unk
    no
    wn
    Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    com.thc.ids.inf.util.reflection.MethodDescription.invokeMethod(MethodDescr
    ip
    tio
    n.java:181)
    at
    com.thc.ids.inf.util.reflection.MethodInvocation.invoke(MethodInvocation.j
    av
    a:7
    9)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean.invoke(ServiceBean.
    ja
    va:
    186)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl.invok
    e(
    Ser
    viceBean_bjedmi_EOImpl.java:37)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl_WLSke
    l.
    inv
    oke(Unknown Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.ja
    va
    :93
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Checking existence ofconnection
    pool Content
    ConnectionPool requested by user guest>
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Creating connection poolContentConnectionPoo
    l requested by user guest>
    weblogic.common.ResourceException:weblogic.management.MBeanCreationException:
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at
    com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:1
    34
    at
    com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.
    ja
    va:
    2352)
    at
    com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:
    87
    4)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBe
    an
    Ser
    verImpl.java:181)
    atweblogic.management.internal.Helper.createMBean(Helper.java:376)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.MBeanCreationException: - with nested exception:
    [javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool]
    atweblogic.management.internal.Helper.createMBean(Helper.java:383)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    - with nested exception:
    [javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at
    com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:1
    34
    at
    com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.
    ja
    va:
    2352)
    at
    com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:
    87
    4)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBe
    an
    Ser
    verImpl.java:181)
    atweblogic.management.internal.Helper.createMBean(Helper.java:376)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    at
    weblogic.jdbc.common.internal.ConnectionPool.dynaStartup(ConnectionPool.ja
    va
    :47
    2)
    at
    weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.jav
    a:
    727
    at
    weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.jav
    a:
    709
    at
    com.thc.ids.inf.framework.opf.rdbms.datastore.ConnectionPoolCreator.create
    Co
    nne
    ctionPool(ConnectionPoolCreator.java:82)
    at
    com.thc.ids.inf.framework.opf.datastore.DataStoreRepository.createConnecti
    on
    Poo
    lIfNonExistent(DataStoreRepository.java:211)
    at
    com.thc.ids.inf.util.persistence.content.ConnectionPoolInitializer.createC
    on
    nec
    tionPoolIfNeeded(ConnectionPoolInitializer.java:48)
    at
    com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.c
    re
    ate
    ConnectionPoolIfNeeded(Unknown Source)
    at
    com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.g
    et
    Ima
    ge(Unknown Source)
    at
    com.thc.ids.inf.services.business.crs.ContentRetrievalService.getImage(Unk
    no
    wn
    Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    com.thc.ids.inf.util.reflection.MethodDescription.invokeMethod(MethodDescr
    ip
    tio
    n.java:181)
    at
    com.thc.ids.inf.util.reflection.MethodInvocation.invoke(MethodInvocation.j
    av
    a:7
    9)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean.invoke(ServiceBean.
    ja
    va:
    186)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl.invok
    e(
    Ser
    viceBean_bjedmi_EOImpl.java:37)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl_WLSke
    l.
    inv
    oke(Unknown Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.ja
    va
    :93
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

  • Dynamic Internal Table creation and population

    Hi gurus !
    my issue refers to the slide 10 provided in this slideshow : https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae
    My example is gonna sound dumb, but anyway: I want to dynamically select from a table into a dynamically created itab.
    Letu2019s use only EKPO, and only field MENGE.
    For this, I use Classes cl_abap_elemdescr, cl_sql_result_set and the Data Ref for table creation. But while fetching the resultset, program dumps when fields like MENGE, WRBTR are accessed. Obviously their type are not correctly taken into account by my program.
    Here it comes:
    DATA: element_ref             TYPE REF TO cl_abap_elemdescr,
          vl_fieldname               TYPE string,
                 tl_components         TYPE abap_component_tab,
                 sl_components         LIKE LINE OF tl_components_alv,
    linetype_lcl               TYPE REF TO cl_abap_structdescr,
    ty_table_type            TYPE REF TO cl_abap_tabledescr,
    g_resultset             TYPE REF TO cl_sql_result_set
    u2026
    CONCATENATE sg_columns-table_name '-' sg_columns-column_name INTO vl_fieldname.
    * sg_columns-table_name contains 'EKPO'
    * sg_columns-column_name contains 'MENGE'
    * getting the element as a component
    element_ref ?= cl_abap_elemdescr=>describe_by_name( vl_fieldname ).
    sl_components-name  = sg_columns-column_name.
    sl_components-type ?= element_ref.
    APPEND sl_components TO tl_components.
    * dynamic creation of internal table
    linetype_lcl = cl_abap_structdescr=>create( tl_components ).
    ty_table_type = cl_abap_tabledescr=>create(
                      p_line_type = linetype_lcl ).
    u2026
    * Then I will create my field symbol table and line. Code has been cut here.
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    u2026
    * Then I will execute my query. Here itu2019s: Select MENGE From EKPO Where Rownum = 1.
      g_resultset = g_stmt_ref->execute_query( stmt_str ).
    * Then structure for the Resultset is set
      CALL METHOD g_resultset->set_param_struct
        EXPORTING
          struct_ref = dy_line.
    * Fetching the lines of the resultset  => Dumpu2026
      WHILE g_resultset->next( ) > 0.
        ASSIGN dy_line->* TO <dyn_wa>.
        APPEND <dyn_wa> TO <dyn_table>.
      ENDWHILE.
    Anyone has any clue to how prevent my Dump ??
    The component for MENGE seems to be described as a P7 with 2 decimals. And the resultset wanna use a QUAN type... or something like that !

    Hello
    I have expanded your sample coding for selecting three fields out of EKPO:
    *& Report  ZUS_SDN_SQL_RESULT_SET
    *& Thread: Dynamic Internal Table creation and population
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1375510"></a>
    *& NOTE: Coding for dynamic structure / itab creation taken from:
    *& Creating Flat and Complex Internal Tables Dynamically using RTTI
    *& https://wiki.sdn.sap.com/wiki/display/Snippets/Creating+Flat+and+
    *& Complex+Internal+Tables+Dynamically+using+RTTI
    REPORT  zus_sdn_sql_result_set.
    TYPE-POOLS: abap.
    DATA:
    go_sql_stmt       TYPE REF TO cl_sql_statement,
    go_resultset      TYPE REF TO cl_sql_result_set,
    gd_sql_clause     TYPE string.
    DATA:
      gd_tabfield      TYPE string,
      go_table         TYPE REF TO cl_salv_table,
      go_sdescr_new    TYPE REF TO cl_abap_structdescr,
      go_tdescr        TYPE REF TO cl_abap_tabledescr,
      gdo_handle       TYPE REF TO data,
      gdo_record       TYPE REF TO data,
      gs_comp          TYPE abap_componentdescr,
      gt_components    TYPE abap_component_tab.
    FIELD-SYMBOLS:
      <gs_record>   TYPE ANY,
      <gt_itab>     TYPE STANDARD TABLE.
    START-OF-SELECTION.
    continued.

  • Dynamic type conflict when assigning references - Dump

    Hi All,
    I am getting the dump "Dynamic type conflict when assigning references". In my application I have used a table control inside which I have  input field, text view and text edit.
    I guess the text edit is creating the issue. The error analysis report is below :
    If anyone have any idea about the issue, please help.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_MOVE_CAST_ERROR', was not
         caught in
        procedure "IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT" "(METHOD)", nor was it
         propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        It was tried to assign a reference to a rereference variable using the
        'CAST' operation ('?=' or 'MOVE ?TO').
        However, the current content of the source variable does not fit into
        the target variable.
        source type: "\CLASS-POOL=/1WDA/L0STANDARD\CLASS=CL_TEXT_EDIT"
        target type: "\INTERFACE=/1WDA/VTABLE_CELL_EDITOR"
    Information on where terminated
        Termination occurred in the ABAP program "/1WDA/L3STANDARD==============CP" -
         in "IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT".
        The main program was "SAPMHTTP ".
        In the source code you have the termination point in line 2290
        of the (Include) program "/1WDA/L3STANDARD==============CCIMP".
        The termination is caused because exception "CX_SY_MOVE_CAST_ERROR" occurred in
        procedure "IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT" "(METHOD)", but it was
         neither handled locally nor declared
        in the RAISING clause of its signature.
        The procedure is in program "/1WDA/L3STANDARD==============CP "; its source
         code begins in line
        2034 of the (Include program "/1WDA/L3STANDARD==============CCIMP ".
    2265       if va__CONTENT_READONLY is bound and
    2266          va__CONTENT_READONLY->IFUR_NW5__CONTROL~_IID <> ifur_nw5_invisible=>_iid_invisible.
    2267         IFUR_NW5_SAPTABLECELL~HASCONTENT = abap_true.
    2268       else.
    2269         IFUR_NW5_SAPTABLECELL~HASCONTENT = abap_false.
    2270       endif.
    2271     endif.
    2272
    2273 *    >> ProvideCONTENT
    2274
    2275     IF mv_CONTENT_READONLY <> va__CONTENT_READONLY.
    2276       finalize_adapter( mv_CONTENT_READONLY ).
    2277       mv_CONTENT_READONLY ?= va__CONTENT_READONLY.
    2278     ENDIF.
    2279
    2280 *   >> property-Aggregation mv_CONTENT_EDITABLE
    2281     DATA va__CONTENT_EDITABLE TYPE REF TO /1WDA/VTABLE_CELL_EDITOR. "#EC NEEDED
    2282 *   >> UCA STANDARD|TABLE_CELL|CONTENT_EDITABLE
    2283     data adp_uielement type ref to /1WDA/VUIELEMENT. "#EC NEEDED
    2284     if mv_CONTENT_READONLY is not bound and
    2285        mv_WD_TABLE_CELL_EDITOR is bound.
    2286           va__CONTENT_EDITABLE ?= mv_CONTENT_EDITABLE.
    2287     IF va__CONTENT_EDITABLE is bound and va__CONTENT_EDITABLE->m_view_element = mv_WD_TABLE_
    2288     ELSE.
    2289
    >>>>>     va__CONTENT_EDITABLE ?= create_by_view_element(
    2291                          view_element = mv_WD_TABLE_CELL_EDITOR
    2292                          parent       = me
    2293     ).

    Hi Everyone,
    Thanks for your replies.
    We raised an OSS call for the same and got the below response.
    Dear Customer,
    I've analized your actual problem and found out that you are using a notallowed combination of text edit as cell editor within table for
    clasical Web Dynpro ABAP rendering. The text edit as cell editor work in701 releases when the lightspeed rendering is enabled. However in case
    that you want to used
    lightspeed rendering, I would suggest to upgrade on a higher
    SP level than SP4 as for technical reason we can only deliver
    corrections for Unified Rendering first from SP04.

  • Assigning value to array type variable in a loop

    Hi
    I have a scenario in which i am assigning value from a array type variable(x) to the invoke variable of a database adapter. The variable x is exact replica of the invoke variable.
    My copy operation in assign activity looks like this-
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters"/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    </copy>
    It is inside a while loop activity.
    PS *()* are square brackets
    But it is erroring out at run time.
    Does anybody has an alternate idea to assign value to an array type?.
    i have seen that while extracting value from an array type variable it works fine
    A similar kind of operation is shown below.
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters"/>
    </copy>
    Thanks
    Ayush
    Edited by: Ayush fujitsu on Aug 14, 2009 4:36 AM

    Hi Ayush
    I suppose you are getting some error like "source node returns multiple elements".
    In second case there is no problem because you are assigning *InputParameters[bpws:getVariableData('iterator')]* (+suppose InputParameters[1]+) to target. Here it works fine because you are fetching oonly 1 value from source and assigning it to the target.
    Now in first case you are saying copy InputParameters to target[1] suppose. You know that source is an array which contains multiple index so which index field from the source will be assigned to the target.
    Try your process with only 1 source value it will work but when multiple values will be there it will fail. You have to merge both the cases and it will look like
    *<copy>*
    *<from variable="Var" part="InputParameters"*
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *<to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"*
    part="InputParameters"
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *</copy>*
    And the easiest way to do this is by the transform activity as said above.
    Regards
    Suryaveer
    Edited by: Suryaveer on Aug 15, 2009 11:19 PM

  • How can I fix a xquery resulting error ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence  - got multi-item sequence

    Hello,
    How can I improve the XQuery below in order to obtain a minimised return to escape from both errors ORA-19279 and ORA-01706?
    XQUERY for $book in  fn:collection("oradb:/HR/TB_XML")//article let $cont := $book/bdy  where  $cont   [ora:contains(text(), "(near((The,power,Love),10, TRUE))") > 0] return $book
    ERROR:
    ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence
    - got multi-item sequence
    XQUERY for $book in  fn:collection("oradb:/HR/TB_XML")//article let $cont := $book/bdy  where  $cont   [ora:contains(., "(near((The,power,Love),10, TRUE))") > 0] return $book//bdy
    /*ERROR:
    ORA-01706: user function result value was too large
    Regards,
    Daiane

    below query works for 1 iteration . but for multiple sets i am getting following error .
    When you want to present repeating groups in relational format, you have to extract the sequence of items in the main XQuery expression.
    Each item is then passed to the COLUMNS clause to be further shredded into columns.
    This should work as expected :
    select x.*
    from abc t
       , xmltable(
           xmlnamespaces(
             default 'urn:swift:xsd:fin.970.2011'
           , 'urn:swift:xsd:mtmsg.2011' as "ns0"
         , '/ns0:FinMessage/ns0:Block4/Document/MT970/F61a/F61'
           passing t.col1
           columns F61ValueDate                Varchar(40) Path 'ValueDate'
                 , DebitCreditMark             Varchar(40) Path 'DebitCreditMark'
                 , Amount                      Varchar(40) Path 'Amount'
                 , TransactionType             Varchar(40) Path 'TransactionType'
                 , IdentificationCode          Varchar(40) Path 'IdentificationCode'                 
                 , ReferenceForTheAccountOwner Varchar(40) Path 'ReferenceForTheAccountOwner'
                 , SupplementaryDetails        Varchar(40) Path 'SupplementaryDetails'       
         ) x ;

  • How to convert element to mesasge type variable in BPEL

    Hi,
    I have xml message in element type variable. I want to create one variable of message type and have same elements values what element type variable has.
    I modified my xsd and created of same type like element namespace. Now when i use assign activity to copy from top root another top root. I get error Variable not initialized.
    How to correct?
    My XML message is like
    <CMISAPPL>
    <APPLICANT_FULL_NAME>Abhi</APPLICANT_FULL_NAME>
    <MANAGER_FULL_NAME>Jack</MANAGER_FULL_NAME>
    <INTERVIEWER_FULL_NAME>jack</INTERVIEWER_FULL_NAME>
    <JOB_TITLE>Test</JOB_TITLE>
    <INTERVIEW_DATE>2-Oct-2007</INTERVIEW_DATE>
    <PASSED_DAYS>5</PASSED_DAYS>
    <INT_SCH_PROFILE_VALUE>1,2,4,7</INT_SCH_PROFILE_VALUE>
    <FILE_PATH_PROFILE_VALUE/>
    <PAPERWORK_REQ_SEGMENTS_VALUE/>
    <PAPERWORK_REQ_SEGMENTS_NAME>App test</PAPERWORK_REQ_SEGMENTS_NAME>
    <VACANCY_NAME>test</VACANCY_NAME>
    <INTERVIEWER_EMAIL>t</INTERVIEWER_EMAIL>
    <INTERVIEWER_MANAGER_EMAIL>t</INTERVIEWER_MANAGER_EMAIL>
    </CMISAPPL>

    Looks like a namespace issue. There is no namespace defined in your payload.
    Marc
    http://orasoa.blogspot.com

  • Assign value to Object type variable

    CREATE OR REPLACE TYPE emp AS OBJECT (
    empid NUMBER,
    age NUMBER,
    dob date);
    CREATE OR REPLACE TYPE emp _tab AS TABLE OF emp;
    Pls hlep me assign value to the object type variable in loop..(assume there is 5 10 records in emp table)
    declare
    v_emp_tt emp _tab ;
    begin
    for i in (select empid ,age ,dob from emp ) Loop
    v_emp_tt := i.empid; --this is wrong pls help me correct it.
    end loop;
    end;
    thanks,

    I would keep the type/object naming convention distinct from the table name.
    In terms of assignment:
    CREATE OR REPLACE TYPE to_emp AS OBJECT
    (empid NUMBER,
    age NUMBER,
    dob date);
    CREATE OR REPLACE TYPE tt_emp AS TABLE OF emp;
    declare
    v_emp tt_emp;
    begin
    select to_emp_obj(emp_id, age, dob)
    bulk collect into v_emp
    from emp;
    end;

  • Unable to Create "Not Equal to" condition in Variable creation

    Hi ,
    I am getting an error while creating variable at report level,
    Well, my condition at variable creation is ----> sum(A) where [country] <> " x" ...(It is showing the results when the country is equal to x) and the converse for the same ... If I use [country] = "x" .. It is taking as country not equal to x ..
    Please suggest me on this..
    Thanks in advance ....

    Hi ,
    I am getting an error while creating variable at report level,
    Well, my condition at variable creation is ----> sum(A) where [country] <> " x" ...(It is showing the results when the country is equal to x) and the converse for the same ... If I use [country] = "x" .. It is taking as country not equal to x ..
    Please suggest me on this..
    Thanks in advance ....

  • Dynamic type conflict during the assignment of references. - Error while generating proxy in the backend

    Hi All,
    I get a short dump while generating a proxy in the backend.I give the package and the prefix and end up with a short dump.
    Does any one know why this mught come up
    "Dynamic type conflict during the assignment of references."
    background: I imported a WSDl provided by legacy into PI and created service interfaces and then trying to generate a proxy class while i get this error.
    Thanks.

    Hi Shyamsundar,
    I will explain a problem that I usually see in some developments:
    XSD originally:                                  XSD transformed:
    Root                                                     -> Root
    Tag 1 type int                                    -> Tag 1 type int
    Tag2 type string                               -> Tag2 type string
    Tag3 type  any                                  - Tag3 type  string
    Normally the tag3 should have a XML inside. Then the ABAPers have to construct the tag3 with  a CDATA structure (CDATA is used to put in an XML tag more XML tags inside like a text and no to be interpreted).
    Later in SAP PI you can extract the cdata with an XSL, you can find some examples in the SCN.
    I don’t like to convert the whole XML in only one string tag, because this makes difficult the develop for the ABAPers, although the work inside the PI is very easy because with an XSL you can extract the whole message easily. (You can find some examples in the SCN)
    Regards.

  • How to Populate a table type variable from a cursor

    Hi
    I have a stored procedure (P1) that returns a ref cursor as the output.
    Another procedure (P2) receives this ref cursor (C).
    In this procedure (P2), I want to do a Bulk Collect from this ref cursor (C) in
    a table type variable that has been declared locally in the procedure P2. I have created appropriate Object Type and Table Types at the database level.
    Please advise how to do it. I tried to do it in different ways, but was not able to do it - each time I faced incompatible data-type related issues.
    Regards
    Madhup

    What I wrote was unclear. Syntactically it is valid and does something. But consider the advantage of a decent design.
    SQL> create or replace procedure p1 (o out sys_refcursor) as
      2  begin
      3   open o for select * from emp;
      4  end p1;
      5  /
    Procedure created.
    SQL> create or replace procedure p2(i sys_refcursor) as
      2   type emp_tab is table of emp%rowtype;
      3   l_emp_tab emp_tab;
      4  begin
      5   fetch i bulk collect into l_emp_tab;
      6   close i;
      7  
      8   for i in 1..l_emp_tab.count loop
      9     NULL;
    10   end loop;
    11  end p2;
    12  /
    Procedure created.
    SQL> CREATE OR REPLACE PROCEDURE p3 IS
      2 
      3  TYPE myarray IS TABLE OF emp%ROWTYPE;
      4  l_data myarray;
      5 
      6  CURSOR r IS
      7  SELECT * FROM emp;
      8 
      9  BEGIN
    10    OPEN r;
    11    LOOP
    12      FETCH r BULK COLLECT INTO l_data;
    13 
    14      FOR j IN 1 .. l_data.COUNT
    15      LOOP
    16        NULL;
    17      END LOOP;
    18 
    19      EXIT WHEN r%NOTFOUND;
    20    END LOOP;
    21    CLOSE r;
    22  END p3;
    23  /
    Procedure created.
    SQL> set serverout on
    SQL> set timing on
    SQL> declare
      2   r sys_refcursor;
      3  begin
      4    FOR i IN 1 .. 10000 LOOP
      5      p1(r);
      6      p2(r);
      7    END LOOP;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.71
    SQL> begin
      2    FOR i IN 1 .. 10000 LOOP
      3      p3;
      4    END LOOP;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.21
    SQL> Again sorry for being less than clear.

Maybe you are looking for

  • Combination of different item category in one Order Type

    Hi experts, Would like to know is that possible one order by having combination of different type of line item category. Such as order type = ZXXX line 1 - item category = TAN line 2 - item category = TANN How to assign document pricing to document t

  • Help with Action for merging

    Hi everybody, Im dealing with a high volume images (few thousands!) and they all require the same work. What I need to do is to merge the first layer (which contains the graphics) with four different individual layers below, (which contains 4 differe

  • Passing data from one page to another page using form bean

    hi, refer to above question, i had follow the sample found at weblogic sample application ,but unfortunately when i create my own application. The following error occur: [Caught exception when evaluating expression '{actionForm.note}' with available

  • "printf" asking for input data

    Hi, my cuestion is why when I ask the user to input data in the test bench with "printf" for my TOP.c not run? NOTE: I am a new user HLS :) Regards  

  • PCI6534, Pattern Gen Loop, Dig_block_out, count var won't work

    I am trying to use the pattern generation loop and the count variable in the Dig_block_out function to control the frequency of a repeated block of output. Most values for count hang up the program, but some work fine. I need to be able to use any nu