How to check variable type?

Hi,
How to get variable type if I want to check variable
type.which function or class do thsi.Thanks
Mark

I believe you use the function typeof()
ie
var myString:String = "test";
trace(typeof(myString)); //should output string

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

  • How to check Variable Names

    Hi All,
    I am checking in CMOD include.  It has lot of code. Example:  When 'ZFISPER' . I think that is Variable Technical name. How to check that variable and in Which Query it is.
    Please let me know...
    Thanks in advance..
    KN

    Hello,
    You can go over into transaction code RSA1 and then on your left hand side you will be able to see lot of tabs in terms of Modeling, Administration, Transport Connection and so on.
    So go ahead and click on the tab "Transport Connection" and in the next screen you will be able to see all object types available in your environment.
    Please go ahead and open up the section "Query Elements", if you are not able to see the same, on the left under the transport connection you will see the folder "SAP Transport" and within that the option called "Object Types", just click on it once and all the object types which are available for transports will show up.
    Once you have selected Query Elements, under that you will be able to see different Query related objects and you will be having "Variable". When you drilldown on Variable folder you can double click "Select Objects" and select your appropriate variable name.
    One other way to proactively get a list of variables available in your system and to find out on which InfoObject they have been buill, please go into transaction se16 or se12 and then enter the table name RSZGLOBV.
    In this table you can get a list of all the variables along with the metadata without trying to parse through one by one variable.
    Thanks
    Dharma.

  • How to check the type of uploaded file

    Hi, experts,
    how can I check the type of the uploaded file? I am dealing with exception handling now: when user uploads a type of file which is not allowed, then error msg shows up. So first I have to retrieve the type of the uploaded file.
    Best regards,
    Fan

    Best approach would be to control the file upload program. Here in force user to chose only the kind of file supported.
    If you are using WD4A & fileupload UI element, then after user select a file to upload, before processing the file you can check the file name and get its MIME TYPE as shown below.
    example
    data type file string.
    data dot_offset type i.
    data extension type mimetypes-extension.
    data mimetype type mimetypes-type.
    file = 'Image.jpg'.
    " Find out file name extension
    find first occurrence of regex '\.[^\.]+$' in file match offset dot_offset.
    add 1 to dot_offset.
    extension = file+dot_offset.
    " Get mime type
    call function 'SDOK_MIMETYPE_GET'
      exporting
        extension = extension
    importing
        mimetype  = mimetype.
    later using if/else or CASE statement define your logic.
    Greetings
    Prashant
    P.S. Points Welcome

  • How to check browser type using java.

    Hi,
    can anybody help me to check browser type using java.
    Weather it is IE or Mozilla or Opera .
    any class in java for such operation?
    vjoy

    can anybody help me to check browser type using
    java.
    Weather it is IE or Mozilla or Opera .
    any class in java for such operation?From where do you want to perform the check? An applet, application or web application?
    Kaj

  • How to check variable if chars are inside

    Hi fellow sufferers :)
    How can I accomplish to check if a variable a$ contains only chars like (A,B,C,D,E, ....) ... I need to make sure that my variable only contains numbers ....
    Thanks in advance for your help/ideas!
    Markus

    function Is-Numeric ($Value) {
    return $Value -match "^[\d\.]+$"
    Is-Numeric 1.23
    True
    Is-Numeric 123
    True
    Is-Numeric ""
    False
    Is-Numeric "asdf123"
    False
     Source from http://stackoverflow.com/

  • How to check valuation type and batch during creating PO

    Hi All,
    can every body help me please,
    I have a material which manage by batch and valuation type.
    When user create purchase order using that kind of material I want the system checking field batch and valuation type. If they not match then system will give an error message.
    What should I do to make the system checking that fields?
    Thxs
    - ely -

    Hi Ely
    Fortunately, you do not need to do any coding or need to use exits.
    You can configure the screen layout settings as follows:
    1) SPRO->MM->Purchasing->Purchase Order-> Define screen layout at doc level
    2) Double click on the key-NBF (most probably you are using this for your PO document type. If you are using any other field layout key..make changes there)
    3) Double click on GR/IR control .
    4) Make Valuation Type & Batch fields 'Required'.
    System works intelligently here. If the material is batch managed, system expects you to enter a batch in PO. If the material has split valuation, then system also expects you to enter valuation type. FOr other materials, system does not expect you to enter batch or valuation type.
    Best regards
    Ramki

  • How to check error type in accessing web service?

    Dear all,
    I have created a form using WSDL connection to access web service in SOAP protocol.
    But I have difficulties in error handling when acccessing web service.
    I try to put a try catch block for the following statement :
    ie. xfa.connectionSet.WebServiceDC.execute(false);
    in case for any error, I can only catch message saying GeneralFault only.
    Is there any extra object in the script that I can catch to handle for different error type?
    e.g checking SOAP.? and where should I put the codes in?
    Actualy I want to detect if network connection is not ok or if it fails to find ecert which is required under https connection
    Rgds.

    Have you tried the try catch block ?
    See the error codes it responds with.
    Then look through the properties of the Exception
    try
        doInit();
    } catch(err)
        var vDebug = "";
        for (var prop in err)
           vDebug += "property: "+ prop+ " value: ["+ err[prop]+ "]\n";
        vDebug += "toString(): " + " value: [" + err.toString() + "]";
        status.rawValue = vDebug;
    function doInit()
        doWebServiceCallThatFails();
    Have fun with these articles
    http://blogs.adobe.com/formfeed/2009/06/collected_form_development_and.html
    http://blogs.adobe.com/formfeed/2009/03/handling_javascript_exceptions.html

  • 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 installation type in OBIEE

    Hi all,
    I need to upgrade OBIEE 11.1.1.5 to OBIEE 11.1.1.7. OBIEE 11.1.1.5 was installed by other person.
    In-Place upgrade is not possible in simple install.
    I need to check the installation type in OBIEE 11.1.1.5.
    Kindly guide me as soon as possible.
    Thanks in advance.

    Hi
    I referred the below document which provided the screenshot of the simple install
    http://gerardnico.com/wiki/dat/obiee/installation_11.1
    In that link as a part of simple install, he is getting the analytics port as 9704 and not as 7001 like you said below
    >>If it is 7001 it is Simple installation.
    Kindly confirm.
    Thanks
    RR

  • How to check variable if present or not ?

    I have a main form and put the :global.gdate, When I call the others form
    I want to use the :global.gdate.
    I wirte a trigger "when new form instance" for each form (except main form) so I can get :global.date.
    But I can only running this program from main form, if I am running the form without the main form, the error message :global.gdate does not exists.
    Question:
    Is it posible to check if :global.gdate is exists or not ?
    maybe somthing like :
    IF get_variable(:global.gdate) IS NULL THEN --?????????
    :global.gdate := sysdate;
    END IF;

    From Oracle documentation:
    DEFAULT_VALUE built-in
    Description
    Copies an indicated value to an indicated variable if the variable's current value is NULL. If the variable's current value is not NULL, DEFAULT_VALUE does nothing. Therefore, for text items this built-in works identically to using the COPY built-in on a NULL item. If the variable is an undefined global variable, Form Builder creates the variable.
    Syntax
    PROCEDURE DEFAULT_VALUE
    (value_string VARCHAR2,
    variable_name VARCHAR2);
    Example:
    ** Built-in:  DEFAULT_VALUE
    ** Example:   Make sure a Global variable is defined by
    **           assigning some value to it with Default_Value
    BEGIN
      ** Default the value of GLOBAL.Command_Indicator if it is
      ** NULL or does not exist.
      Default_Value('***','global.command_indicator');
      ** If the global variable equals the string we defaulted
      ** it to above, then it must have not existed before
      IF :Global.Command_Indicator = '***' THEN
        Message('You must call this screen from the Main Menu');
        RAISE Form_Trigger_Failure;
      END IF;
    END;

  • 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

  • How to check installation type of Directory server in 5.2.

    Dear All,
    I have DS 5.2 environment and here i want to know the installation method of the directory server 5.2 (i mean either it is native or ZIP ). Please revert ASAP it will be really helpful for me. Thanks!
    Karthik

    Hello,
    Try the following method:
    ldd ./ns-slapd | grep libnspr | awk '{print $3}'
    If the target file is a symbolic link, you are using a package/native install else this is a zip install.
    example:
    pc1234$ pwd
    /data/test/DS/Patch6/bin/slapd/server/64
    pc1234$ ldd ./ns-slapd | grep libnspr | awk '{print $3}'
    ../../../../lib/64/libnspr4.so
    if [ -h /data/test/DS/Patch6/bin/slapd/server/64/../../../../lib/64/libnspr4.so ]; then
    echo "Symlink. pkg"
    else
    echo "Not a symlink - zip install"
    fi
    Hope this helps
    Sylvain
    Edited by: Sylvain Duloutre on Sep 17, 2012 1:05 PM

  • How to get data type of variable in program..

    Hi ABAP Guru.
    I need to know how to get data type of variable or any structure field.. because I got short dump when use command REPLACE ALL OCCURANCE ... with variable/structure field that has data type I or P, I think it should be used with data type CHAR only, So I need to check the data type first.
    Please give me your advice
    Thank you all.
    Nattapash C.

    data : v_value type i,
             v_char(10) type c.
    v_value = 10.
    move v_value to v_char.
    REPLACE ALL OCCURRENCES of '#' from v_char....
    Best regards,
    Prashant

  • How to check for the variable passed to a function inside a component

    I'm trying to pass a variable to a function inside of a
    component in a conditional statement.
    How to check the existance of this variable inside the
    function so that I can use the right <CFarguments>:
    in aForm.cfm I have:
    <cfinvoke component="#application.cfcroot#.business.Order"
    method="selOrderItems"
    returnvariable="q_OrderItems"
    OrderItemAbbreviation="Min"></cfinvoke>
    <cfset MCompIDs = ValueList(q_OrderItems.OrderItemID)>
    <cfif listFind(MCompIDs,attributes.CompID)>
    <cfset isM = true>
    <cfelse>
    <cfset isM = false>
    </cfif>
    <cfinvoke component="#application.cfcroot#.business.Order"
    method="selOrderItems"
    returnvariable="q_OrderItems"
    OrderItemAbbreviation="SMEnroll"></cfinvoke>
    <cfset SM_CompIDs =
    ValueList(q_OrderItems.OrderItemID)>
    <cfif listFind(SM_CompIDs,attributes.CompID)>
    <cfset isSM = true>
    <cfelse>
    <cfset isSM = false>
    </cfif>
    <CFIF isSM>
    <cfset temppath = frmcreator.buildFrm(isSMFlag=isSM)>
    <CFELSE>
    <cfset temppath = frmcreator.buildFrm(isMFlag=isM)>
    </CFIF>
    On aFormComp.cfc where the function is,
    I checked the existance of isSMFlag this way and I got error
    saying that :
    Context validation error for tag CFARGUMENT.; The tag must be
    nested inside a CFFUNCTION tag.
    How can I properly check the existance of isSMFlag inside the
    function so I can use the right cfarguments?
    <CFFUNCTION NAME="buildFrm" access="public"
    returntype="String" output="No">
    <cfif StructKeyExists(arguments, "isSMFlag")>
    <CFARGUMENT NAME="isSMFlag" REQUIRED="YES"
    TYPE="NUMERIC">
    <cfelse>
    <CFARGUMENT NAME="isMFlag" REQUIRED="YES"
    TYPE="NUMERIC">
    </cfif>
    ........ etc
    </CFFUNCTION>

    <CFFUNCTION NAME="buildFrm" access="public"
    returntype="String"
    output="No">
    <cfif StructKeyExists(arguments, "isSMFlag")>
    <CFARGUMENT NAME="isSMFlag" REQUIRED="YES"
    TYPE="NUMERIC">
    <cfelse>
    <CFARGUMENT NAME="isMFlag" REQUIRED="YES"
    TYPE="NUMERIC">
    </cfif>
    ........ etc
    </CFFUNCTION>
    NOT this way, that is for sure.
    The <cfargument ...> tag is for defining the arguments
    a function
    accepts either optional or not, but they are not required.
    Give this a
    try to see the differences.
    test.cfc
    <cfcomponent>
    <cffunction name="a">
    <cfdump var="#arguments#">
    </cffunction>
    <cffunction name="b">
    <cfargument name="foo">
    <cfargument name="bar">
    <cfdump var="#arguments#>
    </cffunction>
    </cfcomponent>
    test.cfm
    <cfset something = createObject("component","test")>
    <cfoutput>
    #something.a("blue","green")#
    #something.b("blue","green")#
    </cfoutput>
    Not tested or debugged so watch out for typos.

Maybe you are looking for