Checking data type compatibility

Hi,
Is there a method to check if two data types are compatible with each other? I need to perform this check without any value at hand. With a value it works if I create data references and assign them to field symbols. How do I make the same more generic with just the data type and length given.
Any help would be greatly appreciated. Thanks.
regards,
nithya

I have extracted the below info from a document that i have with me. Do provide your mail-id if you need the document. I dont mind sharing...:)
Please check this for more understanding...
<b>Type Checks and Type Compatibility</b>
For historical reasons, the types of field symbols and parameters in subroutines or function modules can be defined with the STRUCTURE addition.
  If the types of field symbols are defined with FIELD-SYMBOLS <f> STRUCTURE s DEFAULT wa and they are later assigned a data object wa with ASSIGN wa TO <f> ... , in a NUP both statements are checked to see if wa is at least as long as s and wa satisfies the alignment requirements of s at runtime.
16
If parameter types in function modules or subroutines are defined with FORM form1 USING/CHANGING arg STRUCTURE s ... or FORM form2 TABLES itab_a STRUCTURE s ... and the parameters are passed actual parameters with PERFORM form1 USING/CHANGING wa or PERFORM form2 USING/CHANGING itab_b, the NUP also only checks if wa or the line type of itab_b is at least as long as s and wa or the line type of itab_b satisfies the alignment requirements of s. The same is true for function module parameters whose types are defined with STRUCTURE.
The following extra rules are checked in a UP after defining the type with STRUCTURE when assigning data objects, that is for the DEFAULT addition in the FIELD-SYMBOLS statement, for ASSIGN, and when passing actual parameters.
1. If wa or the line type of itab_b is a flat or deep structure, the length of s must be the same for the Unicode fragment views of wa or of itab_b and s.
2. If wa is a single field, only the character-types C, N, D or T are allowed and the structure s must be purely character-type.
Checking both these rules requires additional runtime. It is therefore recommended that, if possible, you type the parameters using TYPE, since the test for actual compatibility is much faster.
  If the type of an argument in a function module was defined with ... LIKE struc, where struc is a flat structure, the NUP only checks if the argument is a flat structure with the same length when the parameters are passed. In the UP, it also checks that the fragment views of the current and formal parameters are the same. For performance reasons, it is again recommended that you use TYPE to assign types.
  Furthermore, two structures of which one or both contain Includes, are only compatible if the alignment gaps caused by the Include are the same on all platforms. In the following example, struc1 and struc2 are not compatible because a further alignment gap occurs in the US before the INCLUDE:
BEGIN OF struc1, BEGIN OF struc2, BEGIN OF struc3,
a(1) TYPE X, a(1) TYPE X. b(1) TYPE X,
b(1) TYPE X, INCUDE struc3. c(1) TYPE C,
c(1) TYPE C, END OF struc2. END OF struc3.
END OF struc1.
Since the type compatibility can differ in a UP and an NUP, the type compatibility rules of the calling program are valid in an NUS for checking the parameters. This means that if an NUP calls a UP, the type compatibility is defined as in the NUP. Conversely, the Unicode check is activated if a UP calls an NUP.
Kind Regards
Eswar

Similar Messages

  • How to check data type of the field symbol at run time

    Hi,
    My code is as following:
          LOOP AT <fs> ASSIGNING <wa_covp_ext>.
            ASSIGN COMPONENT 86 OF STRUCTURE <wa_covp_ext> TO <f_zzname>.
            IF sy-subrc = 0.
              ASSIGN COMPONENT 158 OF STRUCTURE <wa_covp_ext> TO <f_pernr>.
              IF sy-subrc = 0.
                  SELECT SINGLE sname INTO <f_zzname> FROM pa0001
                                WHERE pernr = <f_pernr>
                                AND endda GE sy-datum
                                AND begda LE sy-datum.
             ENDIF.
          ENDIF.
        ENDLOOP.
    This query is giving dump when <f_zzname> is type P length 8 and decimals 2, because it tries to put PA0001-sname into it which is type C length 30. So I want to check the type of <f_zzname> before the select statement. If it is character 30, then I will write the select statement else not.
    How to check data type of the field symbol at run time? If it's not possible, then can somebody suggest a workaround? Thanks.

    check this ...
    write describe statement  ...
    field-symbols : <f_zzname> .
    data : sname like pa0001-sname,
           typ(10).
    assign sname to  <f_zzname>.
    describe  field <f_zzname> type typ.
    write : typ. <-- typ contains character type in this case ..
    U can check if typ is of character(C) if so .. write the select statement ...

  • Data Type Compatibility - Excel as a database

    Post Author: hollyschulz
    CA Forum: Data Connectivity and SQL
    Hello,
    I put together a quick excel sheet to serve as an extra database, mainly to elaborate on specific users.  I could link the "last name" fields from each table, but this doesn't work in the instance there are multiple users with the same last name.  I don't think it's very functional linking first and last name... In one table (the one I must use) there is a character field called "CODER_ID" (characters because even though most of the ID's are numeric, there are some that have a -2) The column I wish to use in the excel sheet won't link to CODER_ID - I've tried formatting the column as general, text, number, etc but I still get the error that the data types aren't compatible.. plese help!

    Post Author: hollyschulz
    CA Forum: Data Connectivity and SQL
    CRMA ID
    CAMS ID
    2810
    2805
    2944
    2944
    2266
    625
    3000
    3000
    2869
    613
    2450
    2450
    2758
    2758
    2531
    2531
    2364
    2020
    2932
    173
    2942
    2942
    641
    262
    2366
    615
    2367
    619
    2933
    820
    2962
    2962
    2935
    769
    2759
    2759
    2868
    412
    2943
    2943
    2368
    119
    2760
    2760
    2999
    2999
    2793
    2793
    743
    610
    2766
    2766
    1541
    1541
    2369
    207
    2964
    2964
    2963
    2963
    2370
    2370
    2371
    140
    742
    319
    2871
    626
    2372
    525
    2659
    2659
    2532
    2532
    2945
    2945
    1681
    1681
    801
    416
    2936
    316
    2867
    139
    521
    786
    3026
    3026
    2792
    2792
    2866
    130
    2804
    2804
    2374
    409
    2375
    2375
    2870
    622
    1963
    1577

  • Checking data type

    I know there must be an easy way to do this. Say I want to
    have a function
    to which you can pass either an integer or a point, or maybe
    a list, either
    would work. How do I determine what the data type of the data
    I've been
    given is? In other words, I'd like to be able to say:
    if data.type = #integer then <do something>
    else if data.type = #point then <do something else>
    else if data.type = #list then <do yet another thing>
    etc.

    > "ilk" is the keyword you're looking for.
    Ah, I knew it'd be something simple like that. Thanks.

  • Stupid question on checking data types

    Hi
    I want to write a function that can accept a parameter which could be an int or an int array. This is what I have so far:
    void translateParams(Object obj) {
    Class type = obj.getClass();
    if (type.isArray()){
    //do something
    Two questions - firstly am I going about this the right way (i.e. have the parameter be type "object" and then check to see what it is) or is there a better alternative. Secondly how can I do the javascript equivalent of isNumeric()??

    If you need the same method name to accept two parameter types, just overload the method:public void someMethod(int parm){
       // some code
    public void someMethod(int[] parm){
       // some code
    }If you have common functionality between the two methods, one can call the other:public void someMethod(int parm){
       // some code
    public void someMethod(int[] parm){
       for (int i =0;i<parm.length;i++){
          someMethod(parm);

  • SQL - How to check data type definition

    Is it possible to check (inside SQL statement) how particular field is defined. Is it VARCHAR2(5) or VARCHAR2(10)

    If by field you mean column, then use USER_TAB_COLUMNS, ALL_TAB_COLUMNS or DBA_TAB_COLUMNS:
    SELECT  TABLE_NAME || '.' || COLUMN_NAME || ' ' || DATA_TYPE ||
            CASE
              WHEN DATA_TYPE LIKE '%CHAR%' THEN '(' || DATA_LENGTH || ')'
              WHEN DATA_TYPE = 'NUMBER' THEN '(' || DATA_PRECISION  || ',' || DATA_SCALE || ')'
            END X
      FROM  USER_TAB_COLUMNS
      WHERE TABLE_NAME = 'EMP'
      ORDER BY COLUMN_ID
    X
    EMP.EMPNO NUMBER(4,0)
    EMP.ENAME VARCHAR2(10)
    EMP.JOB VARCHAR2(9)
    EMP.MGR NUMBER(4,0)
    EMP.HIREDATE DATE
    EMP.SAL NUMBER(7,2)
    EMP.COMM NUMBER(7,2)
    EMP.DEPTNO NUMBER(2,0)
    8 rows selected.
    SQL>   SY.

  • How to check date type is initial

    there is SQL sentence.
    DATA: BEGIN OF it OCCURS 0,
        matnr LIKE mara-matnr,
        laeda  LIKE mara-laeda,
      END OF it.
    select matnr laeda
    from mara
    where laeda <> space.
    How can I  check the  laead field is initial.
    Regards.

    Hi,
         Try this syntax
    SELECT... WHERE s IS [NOT] NULL...
    SELECT matnr laeda FROM mara INTOTABLE it_itab WHERE
    laeda IS [NOT] NULL.
    Regards
    Bala Krishna

  • Check box with Boolean data type is not behaving properly

    Hi,
    I create a sample application with one entity driven view object with two attributes. One is of String data type [Value will be Y/N] and another (transient) attribute with Boolean data type. I planned to bind this boolean data type attribute to UI. I overridded the view row impl class and included setting of boolean attribute inside the setter of String attribute. Also in the getter of boolean attribute, added code to check the string attribute and return true/false based on that. Everything is working fine in application module tester. But when i test the same in view controller project in a page, it is not working. Always Check box component is not checked eventhough when i explicitly check it.
    [NOTE: I have given the control hint of Boolean attribute as check_box. Also i don't want selected/unselected entries in the page def file. That's why followed this approach]
    Have i missed out anything? Why this behaviour.
    Thanks in advance.
    Raguraman

    what is the value that is going in when u check it.. did u debug it.. is the viewRowimps setter and getter getting called.. and is it having the right value set and got.. and ur sure that ur using selectBooleanCheckBox..
    ur binding the checkbox to the transient value right??

  • How to check the data type dynamically

    hi all
    my requirement is like this  in one screen field which is of character type user is inputing data .
    now while saving to the database i have to apply one external check for this data if it is integer type or not
    as this data on the screen is refrenced to the database so i can not change the data type on the screen itself .
    i have to check it externally from PAI ....... would any one please help on this
    Thanks and regards
    Papps

    Hi
    Thanks again you are right i missed the space one ..
    but Now another problem...
    I have tried that but in that case even user can input data by mistake like this
    123 4  but this is not an integer it should also give error as this is also not a correct integer ...
    as par asi think . we have to aain check if there is any spaces in the data provided i guess or
    is there any other procedure ?

  • Checking table columns and data type before inserting

    I have some data coming from different sources and want to insert the data from those files into multiple tables.
    Before inserting the data I like to perform a check on data type, length, null etc so that I can avoid errors at the time of insert. If there is any problem with the data then I do not want to perform the insert and report the problems.
    Thanks

    If you have 10gR2 (10.2.0.4) you could use DML_ERROR_LOGGING.
    Read about it here, see the examples: http://tkyte.blogspot.com/2005/07/how-cool-is-this.html
    In short: it avoids errors during your transactions, afterwards you know which records failed and why.
    It's more or less the same functionality:
    your goal:
    check before transactions and avoid the insert of 'bad' records. (extra code, extra maintenance, more chance of bugs)
    dml_err_logging:
    insert 'bad' records during transaction automatically into a dedicated error table including error message.
    Edited by: hoek on Mar 24, 2009 6:56 PM

  • Check data load or not in subtype of table type

    Hi friends,
    Using global collection variable vt_product_tab.
    created record tr_product_tab.
    type tt_product_tab is table of tr_product_tab index by binary integer.
    vt_product_tab tr_product_tab;
    when the package loaded first time data loded into vt_product_tab. Now I would like to write a procedute to check data loded or not into vt_product_tab.
    Venkat.

    Hi,
    have a managed bean that has a JSF binding reference (table property) for th etable. Then on the table you can call getSelecteRowKeys, which returns a rowk key set
    Frank

  • How do I do a data type check?

    Hi.
    I was trying to do a hashtotal for a table column. It is necessary that the table column only contains numeric values. Is there a way to do a data type check, before I compute the hashtotal value? Thanks.
    LOOP AT itab INTO hash_value.
      IF hash_value = NUMC. " (==> Cannot)
        hash_total = hash_total + hash_value.
      ENDIF.

    you can try this
    data : text(50),
           dtyp like DD01V-DATATYPE,
           bef(15),
           aft(15).
    data : dtype(1).
    text = '1,234.60'.
    if text co '0123456789.,'.
    write : / 'numeric'.
    endif.
    split text at '.' into bef aft.
    replace all occurrences of ',' in bef with space.
    condense bef.
    CALL FUNCTION 'NUMERIC_CHECK'
      EXPORTING
        STRING_IN        = bef
    IMPORTING
    *   STRING_OUT       =
       HTYPE            = dtyp
    if dtyp cs 'NUMC'.
    write : / 'Befor decimal Numeric'.
    else.
    write : / 'Befor decimal Character'.
    endif.
    clear dtyp.
    CALL FUNCTION 'NUMERIC_CHECK'
      EXPORTING
        STRING_IN        = aft
    IMPORTING
    *   STRING_OUT       =
       HTYPE            = dtyp
    if dtyp cs 'NUMC'.
    write : / 'After decimal Numeric'.
    else.
    write : / 'After decimal Character'.
    endif.
    regards
    shiba dutta

  • Check table in data type AFNAM (Name of Requisitioner/Requester)

    Hello,
    To satisfy a customer's requirement, I changed data type AFNAM so that it would have a search help. The search help name of this data type now points to the ZAFNAM view - this view is based on table ZQQPVS001, where I keep the valid entries for the field.
    Here.'s my problem: at least in one of the standard transactions ( ME5A - List Display of Purchase Requisitions), I can get help pressing F4 on the field but I cannot see the help button on the right side of the field. In other transactions (namely ME22n ), I can see the small round button.
    Any clues?
    Regards,
    Joã

    Hello,
    Problem solved.

  • How can take a Custom Data Type in TestStand and create a LabVIEW DataType?

    I am using LV 8.2 and TS 3.5.
    I have an existing Custom Data Type in TestStand and I want to make a LabView Type Def.  The TS DataType contains 11 elements: a Visa Resource Container of 2 elements (String, DeviceName and Number, Session), 9 Numerics and 1 String Array.  For Backwards compatability, I cannot modify the TestStand DataType.
    Thanks,
    Jean

    Hi Goldee,
    You should be able to do that. It's a two step procedure.
    1) Creates in LV a custom datatype that maps 1:1 yours TS datatype.
    2) Go in the TypePalette in the properties of yours TS Datatype and check into LV Cluster Passing Menu'. Here you can Connect a specific Field of the TS datatype to a Specific Label of the corresponding LV datatype. Once you've done it the TS datatype will result modified, I mean "starred" but the change you applied should not impact the datatype structure itself only the way you pass it to LV.
    Have a good day
    FiloP
    It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
    Richard P. Feynman

  • FieldPoint I/O Data Type versus Fieldpoint I/O Point Data Type

    I have upgrated a project from LV 8.5 version to LV 2011 the Fieldpoint Data Types are different in LV 8.5 it is FieldPoint I/O and in LV 2011 it is Fieldpoint I/O Point. I built the proyect and tried to run it, no errors were present. Now the application can't read or write to the cFP-2100 controller module. In MAX i can see the controller, the modules and the channels both under Data Neighborhood and Remote Systems.
    Setup:
    Controller and Host Drivers: Field Point 6.0.10
    Labview engine 2011
    Here's my cluster in both LV versions

    Hi ulises.uribe.
    According to the Fieldpoint driver readme, you need different versions of the driver for 8.5 to 2011 (The latest version that supports 8.5 is 6.0.8, which doesn´t support LV 2011. Could you confirm that this is the FP driver version that you were using in 8.5 (Fieldpoint 6.0.8).
    You can check if the syntax changed between 6.0.8 and 6.0.10 by creating a constant from one of the fieldpoint VI's and see if the syntax there is the same as the one in LV 8.5. Also, are the VI's that show up in the FP palette the same in both the 8.5 and 2011 versions?
    Finally, you said that you can run your application in 2011 without any errors but it can't communicate with the cFP. Does the program ever throw an error? (Like a timeout error)
    I'll check for more compatibility issues between versions once you confirm which version were you using in LV 8.5.
    Regards.
    Aldo H
    Ingenieria de Aplicaciones

Maybe you are looking for

  • Need help with power supply & graphics card upgrades

    I have a HP Pavilion p6320y that I bought 8 months ago. AMD Phenom II x4820 Quad Core processor.   I play WoW and since the last big patch, have been suffering with low fps. I updated drivers and followed all the advice given to me by Blizz and final

  • Error when using DBMS_XMLDOM package

    Hello, I have created a set of triggers that use the DBMS_XMLDOM packages. These triggers were created on a Win 2k install of 9.2.0.2.1. A brand new user was created and a specific set of permissions granted. The permissions were: GRANT CONNECT, RESO

  • Oracle Configuration Manager - EBS R12.1.1

    Hi , EBS R12.1.1, on OEL 5.4 Is there forums for Oracle Configuration Manager? I am trying to configure it, but as usual the docs is very topsiturvy. Identifying If Oracle Configuration Manager Is Already Installed or Configured Oracle Configuration

  • Validate a value against table validation value set within PL/SQL

    Hi, I am trying to import price list lines along with Pricing attribute values. I have to validate the uploaded values against the pricing attribute value set, before I import them into base tables. Value set defined is of type table validation. I wa

  • Load error 17: what does it mean, and can I save my VI?

    I can't load a VI anymore after LabVIEW crashed on me. It just gives me the following error message: "Resource not found. An error occured loading VI 'xx.vi'. LabVIEW load error code 17: Could not load VI's link information." Is there any way to salv