Dynamic type conversion?

Hi everyone,
I'm working in a XML method invocation engine but at this moment I'm stucked trying to solve a little problem. I've a XML file looking this way:
<method class="java.lang.Math" name="min">
<arg>
<method class="java.lang.Math" name="max">
<arg type="float">
5
</arg>
<arg type="float">
10
</arg>
</method>
</arg>
<arg type="int">
100
</arg>
</method>
It's a simple example to explain myself, that equals a java expression like "Math.min(Math.max(5.0f,10.0f),100)". As you see min call corresponds to "int Math.min(int,int)" and max to "float Math.max(float,float). When I declare max as "int Math.max(int,int)" the return type equals the paramenter type for min and everything works. But in this example max returns float and min requires int. Using reflection API when I pass an array of arguments to Method.invoke which doesn't correspont to the expected input parameters for min it fails launching an exception because it needs an array like Object[]{int,int} and receives an array looking like this Object[]{float,int}.
My question is that if we know the return type of max using java.lang.reflect.Method.getReturnTypes() and the parameter type of min using java.reflect.Method.getParameterTypes(). How can i perform a dynamic conversion form a primitive type to another if i only know the types at runtime?
And what about objects? How can I convert from, lets say, Integer to Float? Is it posible to do it dynamically using reflection API or do I have to implement long conversion tables and methods?
Thanks for your help
Pep Ribas

You've got two problems here.
The first has to due with the fact that your interpreting of the XML source using Reflection is equivalent to compiling Java source. Your sample represents the following Java source fragment:    java.lang.Math.min(java.lang.Math.max(5.0f, 10.0f), 100);If you provided that line to the Java compiler, you would get a "possible loss of precision" error at the first argument to the min() method, where the compiler is seeing a float when it wants an int. This is a "widening" cast and is not allowed without an explicit cast. Your XML code needs a token for explicit casting. Your sample could look like this:    <method class="java.lang.Math" name="min">
        <arg>
            <cast type="int">
                <method class="java.lang.Math" name="max">
                    <arg type="float">
                        5
                    </arg>
                    <arg type="float">
                        10
                    </arg>
                </method>
            </cast>
        </arg>
        <arg type="int">
            100
        </arg>
    </method>This would represent a Java source fragment that correctly compiles:    java.lang.Math.min((int)java.lang.Math.max(5.0f, 10.0f), 100);The second problem is due to the ambiguous definition of the Reflection package. Even though Reflection provides ways to invoke methods, it was designed to browse the capabilities of a class and not to act as an interpreter. There is really no way to dynamically perform an explicit-cast without implementing the patterns of the Java implicit casting mechanisms and method look-up.
You might do better to compile your XML code into Java source text, and then programmatically pass that text to the Java compiler class sun.tools.javac.Main. The compiler will then perform the needed implicit casts to best-fit the available methods. If the compiler returns errors, you can map them back to the appropriate XML tokens and report it to the user.
I hope you find this of some help.

Similar Messages

  • Xml conversion of data refs with dynamic type

    Hi Colleagues,
    I have to create an XML from a TYPE REF TO DATA, where this data is created using a dynamic internal table. By dynamic internal table i mean that the internal table is created dynamically using the class method cl_alv_table_create=>create_dynamic_table.
    Now the problem that i face is when i use the statement:
    CALL TRANSFORMATION id
          SOURCE jsag_data = im_context_b64
          RESULT XML lv_xml
          OPTIONS data_refs = 'embedded'
                  value_handling = 'move'.
    to generate the XML i get a dump of type CX_XSLT_SERIALIZATION_ERROR saying "The ABAP data cannot be serialized."
    I found a solution to avoid the dump by adding the additional option " TECHNICAL_TYPES = 'ignore' " to the  CALL TRANSFORMATION statement, like
    CALL TRANSFORMATION id
          SOURCE jsag_data = im_context_b64
          RESULT XML lv_xml
          OPTIONS data_refs = 'embedded'
                  value_handling = 'move'
                  TECHNICAL_TYPES = 'ignore'.
    But, using this addition the dynamic type ref to data part is totally ignored from the XML generation.
    If I use a specific DDIC table type to create the data, we do not face this issue and the XML is generated as desired
    Does anyone have a solution to this problem as it has become a sort of blockade for our development?
    Thanks and Cheers,
    Gaurav.

    Hello,
    I reached same problem with dynamic data references, the only solution I got is to used global DDIC types (also for table types !!) when creating data which needs to be serialized.
    The options technical_types = 'ignore' doesn't solve the problem - it just instructs the parser to skip data references without global ddic type. The options value_handling = 'move' is very helpful as XML serialization is very picky about values beeing serialized.
    Here is summary of my observations:
    - Global DDIC type has to be associated with data reference, otherwise only technical type is there and this is not supported (you can use OPTIONS TECHNICAL_TYPES = u2018IGNOREu2019 but this will just skip the data to be serialized to XML) u2026
    - The above means that if you are serializing data reference to table then you have to have also global DDIC type for the table-type !! Unfortunatelly there is no default table type available for transparent tables u2026. They are treated as structures not as table-types u2026 thus:
    - CREATE DATA lr_data TYPE <global_ddic_structure> - can be serialized
    - CREATE DATA lr_data TYPE STANDARD TABLE OF <global_ddic_structure> - cannot be serialized
    - CREATE DATA lr_data TYPE <global_ddic_table_type> - can be serialized
    - !! Unfortunatelly !! CREATE DATA lr_data TYPE <type_pool_ddic_structure/ type_pool_table_type> - also cannot be serialized u2013 this is pitty u2026 this should be supported u2026.

  • Implicit and explicit Type conversion using Type object in heap

    Hi,
    I am surprised how Implicit and explicit Type conversion works using Type object in heap. for example when implicit type conversion occur what pointer it returns to object and similarly with explicit type conversion.

    Hello,
    >> I am surprised how Implicit and explicit Type conversion works using Type object in heap.
    For Implicit conversions: Typical examples are conversions from smaller to larger integral types, and conversions from derived classes to base classes. For the first one, the reference would be different which means it would return a different pointer to
    a new object. For the reference type, it actually points to the same memory location, you could use the object.ReferenceEquals() to check it.
    For Explicit conversions (casts):Typical examples include numeric conversion to a type that has less precision or a smaller range, and conversion of a base-class instance to a derived class. For first one, it would perform the same with implicit conversions.
    While for the conversion of conversion of a base-class instance to a derived class, actually, there's no built-in way to do this conversion.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • 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 ;

  • 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.

  • The priority of different data type conversion

    Hi All,
    I want to know the priority of data type conversion rule. if in an expression, I have several kind of data type( I, P, F,N..).
    Then finaly, all the data object will convert to which data type?
    I don't know the priority of data conversion.
    E.g.   data a type i. data b type p. data c type f.
             a = b + c.
    or    data d type p, data e type f.
          if ( d > f ).
    Then who will convert to who's type?
    Thanks and Regards.
    Aaron

    For expressions, the right term in SAP is "calculation type", it's explained here : [abap help - determining the calculation type|http://help.sap.com/abapdocu_70/en/ABENARITH_TYPE.htm]. SAP takes the "biggest" type of all variables in the expression. It can be I, P or F (smallest is I, biggest is F).
    Conditions are handled differently, just using data type conversion (see link given above by Abhishek), SAP converts from smallest to biggest type (in your case, it converts P to F and compares the two F variables).

  • Need Help with data type conversion

    Hello People,
    I am new to java, i need some help with data type conversion:
    I have variable(string) storing IP Address
    IPAddr="10.10.103.10"
    I have to call a library function which passes IP Address and does something and returns me a value.
    The problem I have is that external function call in this library excepts IP Address in form of a byte array.
    Here is the syntax for the function I am calling through my program
    int createDevice (byte[] ipAddress).
    now my problem is I don't know how to convert the string  IPAddr variable into a byte[] ipAddress to pass it through method.

    Class InetAddress has a method
    byte[]      getAddress() You can create an instance using the static method getByName() providing the IP address string as argument.

  • Error Dynamic type conflict when assigning references in EHP4

    Hi Experts,
    We are facing problem while customizing application wizard in EHP4.
    Based on our requirement, we need to create one more tab named "Notes" to add instructions for applicants while applying for Job. It contains only instruction. To achieve this, we have done below set up.
    1. We have created new WD component (WD window), OTR Alias
    2. Created one more additional steps in T77RCF_RM_STEP called "Notes" and maintained step 1 information
    3. In table T77RCF_RM_SEQ, under Application wizard (employee), we have added notes in sequence 1.
    Now our new tab "Notes" is reflecting in application wizard. But while cliking on send application, we are getting error "The following error text was processed in the system GEG : Dynamic type conflict when assigning references".
    Error Details:-
    u2022     The following error text was processed in the system GEG : Dynamic type conflict when assigning references
    u2022     The error occurred on the application server sapgeg_GEG_59 and in the work process 0 .
    u2022     The termination type was: RABAX_STATE
    u2022     The ABAP call stack was:
    Can anybody guide what we are doing wrong?
    It would be great help.
    Regards,
    purnima

    Hi Rajasekhar,
         Facing the same issue, can you please let me know how you solved the above issue.
    Best Regards,
    Laxman

  • How do you turn off larger dynamic type on the iphone4 when your screen orientation is locked (vertically)?

    So I have the iphone 4 with the latests update ios7.
    So I went on settings > general > accessibility > larger type.
    And I clicked "on" for "larger dynamic type"
    Now my font is so big I can't even see apps that I have and such
    I want to turn it "off" but my screen orientation is locked! (I can't move my phone horizontally) I think if I can move my phone horizontally I'll be able to see the on/off button for larger dynamic type.
    I tried sliding the bottom upwards to turn off screen lock orientation but it's not on my screen because my font is set to a really big size that the "screen orientation lock button" didn't make it to the screen

    Turning on Dynamic type and increasing it shold not have that effect.
    Try a reset: Simultaneously hold down the Home and On buttons until the device shuts down. Ignore the off slider if it appears. Once shut down is complete, if it doesn't restart on it own, turn the device back on using the On button. In some cases it also helps to double click the Home button and close all apps BEFORE doing the reset.

  • ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence

    Hi ,
    I executed the below query in database version 11.2.0.3.0, it throws the error like "ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence"
    with PAYMENT_XML as (
          select XMLTYPE(
            '<Document>
            <pain.002.001.02>
                <GrpHdr>
                      <MsgId>CITIBANK/20091204-PSR/4274</MsgId>
                      <CreDtTm>2009-12-04T09:36:00</CreDtTm>
               </GrpHdr>
                <OrgnlGrpInfAndSts>
                <OrgnlMsgId>10002</OrgnlMsgId>
                <OrgnlMsgNmId>pain.001.001.02</OrgnlMsgNmId>
                <OrgnlNbOfTxs>20</OrgnlNbOfTxs>
                <OrgnlCtrlSum>7000</OrgnlCtrlSum>
                <GrpSts>PART</GrpSts>
                <StsRsnInf>
                  <AddtlStsRsnInf>ACK - FILE PARTIALLY SUCCESSFUL</AddtlStsRsnInf>
                </StsRsnInf>
              </OrgnlGrpInfAndSts>
              <OrgnlGrpInfAndSts>
                <OrgnlMsgId>10001</OrgnlMsgId>
                <OrgnlMsgNmId>pain.001.001.02</OrgnlMsgNmId>
                <OrgnlNbOfTxs>202</OrgnlNbOfTxs>
                <OrgnlCtrlSum>9000</OrgnlCtrlSum>
                <GrpSts>PART</GrpSts>
                <StsRsnInf>
                  <AddtlStsRsnInf>ACK - FILE PARTIALLY SUCCESSFUL</AddtlStsRsnInf>
                  <AddtlStsRsnInf>Formated</AddtlStsRsnInf>
                </StsRsnInf>
              </OrgnlGrpInfAndSts>
          </pain.002.001.02>
      </Document>') as OBJECT_VALUE1
       from dual
      select R.*
      from PAYMENT_XML,
           XMLTABLE(
           'for $COMP in $COMPANY/Document/pain.002.001.02
              for $DEPT at $DEPTIDX in $COMP/OrgnlGrpInfAndSts
               return <RESULT>
                        <NAME>{fn:data($COMP/GrpHdr/MsgId)}</NAME>
                          $DEPT/OrgnlMsgId,
                          $DEPT/OrgnlNbOfTxs,
                          $DEPT/OrgnlCtrlSum,
                          $DEPT/GrpSts,
                          $DEPT/StsRsnInf/AddtlStsRsnInf
                      </RESULT>'
           passing OBJECT_VALUE1 as "COMPANY"
           columns
             NAME            VARCHAR(10)  path 'NAME',
             OrgnlMsgId      VARCHAR2(24) path 'OrgnlMsgId',
             ORGNLNBOFTXS    VARCHAR2(24) path 'OrgnlNbOfTxs',
             ORGNLCTRLSUM    NUMBER       path 'OrgnlCtrlSum',
             GRPSTS          VARCHAR2(24) path 'GrpSts',
             ADDTLSTSRSNINF  VARCHAR2(40) path 'AddtlStsRsnInf'
         ) r
    Errors comes this part :
                <StsRsnInf>
                  <AddtlStsRsnInf>ACK - FILE PARTIALLY SUCCESSFUL</AddtlStsRsnInf>
                  <AddtlStsRsnInf>Formated</AddtlStsRsnInf>
                </StsRsnInf>
    if i put the single statement for this xml element <AddtlStsRsnInf> it works fine if more than one element comes it raised the error.
    i want the output like the below format : want to merge the element value with (, comma)  delimiter with single coloumn value
    NAME
    ORGNLMSGID
    ORGNLNBOFTXS
    ORGNLCTRLSUM
    GRPSTS
    ADDTLSTSRSNINF
    CITIBANK/2
    10002
    20
    7,000
    PART
    ACK - FILE PARTIALLY SUCCESSFUL
    CITIBANK/2
    10001
    202
    9,000
    PART
    ACK - FILE PARTIALLY SUCCESSFUL, Formated
    Thanks is advance for reply
    Thanks,
    Chidam

    Try with XQuery string-join() function :
    ADDTLSTSRSNINF  VARCHAR2(40) path 'string-join(AddtlStsRsnInf, ", ")'

  • Dynamic Type casting

    Can we dynamically type-cast an object reference passed to Object Clss to that specific class?
    Here is what I want to do.
    I am going to pass an object reference to a method, which has Object class as parameter to it, as shown below. Using getClass() or some other way, I want to dynamically typecast this reference to the original Class and call some method of this Class.
    void test (Object ref1){
    ((ref1.getClass())ref1).writeLog();
    By doing this, am I violating the basic Object Orineted rules?

    I mean, consider an hypothetical case (which is wrong
    from OO point of view) that there are suppose 10
    classes in my system. None of them related to each
    other, all are independent classes. But each one has a
    method called, writeLog(). Now I want to write one
    method which will be called by each of these classes
    (in some 11th class), which will have "Object" as a
    parameter. Now using the actual reference I want to
    call the corresponding writeLog() method.
    1 - Point out to management that the design is now officially broken.
    2 - Point out that if the design is not fixed then any solution that impliments the changes will cost more to maintain in the future and will likely lead to instabilities in the system (due to complexity.)
    3 - Implement one of the suggested solutions and make sure that you put in a lot of error checking and logging in the hacked solution.
    4 - Produce extensive documentation about the impact of changing any of the objects that you are relying on. Push it to anyone and everyone that might ever touch or even suggest changes to the code.
    Doing all of the above allows you to live stress free when the next revision breaks because someone didn't understand the implications of your hacked solution. You will be able to find the problem quickly and point out that it had nothing to do with your code but rather because someone else did not follow the complete documentation that you produced. And then when they complain that your solution was a hack you can point out that you explained that previously as well.

  • Invalid data type conversions

    what are the invalid data type conversions in ABAP ???
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Mar 10, 2012 6:01 PM

    No Amanda,
    The values that I see in message monitor are also those that comes to XSLT programs as input.
    I investigated our problem a little further myself:
    1) XI always converts messages into XML format - this everybody knows.
    2) In XI documentation it is declared that XI uses ISO 8601 for DATE type formatting. That's why you see dates in format YYYY-MM-DD in XML data in message monitoring.
    3) The appearance of those decimal values are not that obvious for me. If XI uses ABAP transformation for message content then applies the rules for converting ABAP data types into XML. For this there is a SAP document 'ABAP - XML mapping' from TechEd2004. This document seems to describe how ABAP data types are handled by XML transformation.
    Anyway, we currently need to play with decimal values in XSLT mapping programs inside XI:
    a) add leading 0 integer if source value < 1
    RFC returns 0.123 -> XI converts to XML '.123' -> XSLT mapper should return '0.123' ->SOAP response returns '0.123'
    b) add decimal point and trailing zeros
    RFC returns 0.000 -> XI converts to XML '0' -> XSLT mapper should return '0.000' ->SOAP response return '0.000'
    With dates, the problem is actually on documenting mapping rules when writing interface specifications. If you would write an EAI-solution-independent conversion rule (RFC/date->SOAP/char) for date field it could sound like: YYYYMMDD -> dd.mm.yyyy. This works semantically between these systems but would not work for XI-developer, because he get YYYY-MM-DD from the RFC.
    Additionally the decimal type conversion requirements in XSLT mapping programs probably only applies XI and are therefore not reusable in other EAI environments.
    I would be glad if somebody would still have further comments for this data type conversion issue.
    br: Kimmo

  • Dynamic Type Checking... Is this possible?

    I want to do a dynamic check for objec types in a datastructure. Something very similar to instanceof but using dynamic type parameter.
    Syntactically speaking...
    Instead of writing several methods like
    public boolean isOfTypeXYZ( )
    return ( this instanceof XYZ);
    public boolean isOfTypeABC()
       return ( this instanceof ABC);
    ...I want one single method like
    public isOfType ( Class a_type)
       return (this ***isoftype**** a_type);
    }Where isoftype can somehow dynamically figure out if the object is of given type (class)
    For those who want to know why I'd need this kind of contrived behaviour let me give a simple example (similar to my real issue).
    Suppose I have a swing GUI application which has several laid out components like Containers, JPanels, JToolBars, JMenuItems, JButtons, JToggleButtons, JRadioButtons etc.
    Now starting from the JFrame in this containment hierarchy, I want to find all instances of JButtons or say all instances of JRadioButtons or say all instances of JMenuItem or all instances of JComponents ...
    I do not want to write a special method for each possible type I might encounter.
    I want a more generic method like
    searchComponents( Class a_class) that I can invoke by just changing its argument to convey the type.
    Unfortunately getClassName() will not work as that gives the most derived type of the object. I want something very much like instanceof wherein I can check for an intermediate super class as well. (eg. All RadioButtons are AbstractButton and should return true for either type).
    I tried to search for this in the forums but couldn't find something close to this. (There are several discussions about dynamic type casting which are different).

    Is this what you want?
    searchComponents( Class a_class) {
    // browse components
    if (a_class.isInstance(component)) {
    // do something
    }

  • 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

  • WebDynpro call Returns an exception: Type conversion error

    Hi,
    I'm trying to start some of the standard SAP web dynpro .
    most of then work fine.
    some don't and i get the following error message.
    Root Cause
    The initial exception that caused the request to fail, was:
    +com.sap.aii.proxy.framework.core.DataAccessException: Type conversion error, field TAX_PER_DIEMTAX, complex type class com.sap.xss.tra.tre.model.expenses.Ptrv_Web_General_Data_Int+
    +at com.sap.aii.proxy.framework.core.JcoBaseTypeData.propagateJcoException(JcoBaseTypeData.java:130)+
    +at com.sap.aii.proxy.framework.core.JcoBaseTypeData.setElementValue(JcoBaseTypeData.java:751)+
    +at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setAttributeValue(DynamicRFCModelClass.java:482)+
    +at com.sap.tc.webdynpro.progmodel.context.GenericModelClassCopyHelper.setAttributeValue(GenericModelClassCopyHelper.java:69)+
    +at com.sap.tc.webdynpro.progmodel.context.CopyService.copyCorresponding(CopyService.java:55)+
    +... 66 more+
    See full exception chain for details.
    could anyone give me an hint.
    jco connetion are made and testet for:
    sap_r3_humanresources
    sap_r3_finacials
    sap_r3_selfservicegenerics
    sap_r3_travel
    analog the *_MetaData
    Thank in advance
    Maximilian

    Hello
    did you solve this problem? I have the same error
    Regards

Maybe you are looking for

  • Set up secondary DNS for mail?

    When I first configured my server using the advance setup, I successfully setup my DNS services using a domain name for the primary zone that is not a registered domain. I have no intention of ever using the domain name I use internally on the net. I

  • I get a message "could not initalize scratch disk full" I hae a new computer with Win 8 and I am installing PS 7

    I get a message "could not initalize scratch disk full" I have a new computer with Win 8 and I am installing PS 7. how can I fix the scratch disk problem? Thank you for the help.

  • Ext DVD or Blu Ray player suggestion

    Hello fellow Mac users...  I've joined!!! I've just purchased an iMac 27" and will have it within a week or so...  I didn't purchase the Superdrive. My question for you experts out there, I want to to be able to watch a blu-ray disc on the iMac and d

  • Blank Lines in Oracle Reports in Text Format

    Hi all, I m in a problem that , I generate an Oracle report in text format there is two additional blank lines in text format.But when I view this report in report editor there is no blank lines.There is actually only 15 lines in my report but in tex

  • Problems with a mailto link from a button

    Dear All, I am trying to create a mailto link from a button within a page which will also pass several variables. Everything is working well until it comes to generating the body of the message. I can generate content in the body but if I add a new l