How to find data type of field dynamically in abap

hi all,
I am hanged up in one issue. There an internal table is filled.
theres one field ,and  i want to extract the data type of the field content.
Ex. i_tab is internal table having field var1.
      let the content of var1  have data type same as that of matnr (material no.)
so here i want to extract this data type.
thanx in advance for efficient help

hi,
Use the statemnt
DESCRIBE FIELD 
Use the edition   TYPE typ [COMPONENTS com]
More help use F1
example fropm F1 help
DATA: BEGIN OF struc1,
        comp1 TYPE c LENGTH 1,
        comp2 TYPE string,
        BEGIN OF struc2,
           comp1 TYPE c LENGTH 1,
          comp2 TYPE i,
        END OF struc2,
      END OF struc1,
      typ1  TYPE c LENGTH 1,
      comp1 TYPE i,
      typ2  TYPE c LENGTH 1,
      comp2 TYPE i.
DESCRIBE FIELD: struc1        TYPE typ1 COMPONENTS comp1,
                struc1-struc2 TYPE typ2 COMPONENTS comp2.
regards
prasanth

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

  • Error when trying to set a date type edit field

    Hi all
    I have an edit text field in a form which is bounded to a date type
    database field using dbDataSource.
    When i try to set the edit text field value with Today's date by code.
    I recieve an error message that the value which
    i'm trying to set is not legal. the  error number is [131-183].
    I use the following code to set the edit field:
    If oEditText.Value.Trim = String.Empty Then
                Dim strDate As String
                Dim sboBob As SAPbobsCOM.SBObob =
                 oCompany.GetBusinessObjec(SAPbobsCOM.BoObjectTypes.BoBridge)
                 rs = sboBob.Format_DateToString(Microsoft.VisualBasic.Today)
               strDate = rs.Fields.Item(0).Value.ToString().Trim()
    Try 
           oEditText.Value = strDate
    Catch ex As Exception
        SBO_Application.MessageBox("error setting
    current date: " & ex.Message)
    End Try
    End If
    My question is how can i set the edit field with a valid value?

    Hi!
    When writing to EditText.Value you must always use the B1 "DB-Format" as String.
    The following examples are assuming (it's a must!) that the EditText-Fields are bound to a corrosponding DataSource (Type Date, Price etc...)
    MyDateEditTxt.Value="20080207"
    MyPriceEditTxt.Value="1341.79"
    The best of it: It's Windows and SBO-GUI-Language independent.
    EditText.String must always be written with the format of the actual Language of the SBO-GUI, which can be changed by the user....
    You may also have a look at my statements regarding these problems near the end of this thread:
    [How to pass date value to an UDF;
    Cheers,
    Roland

  • How to find out the manditary fields in an IDOC

    Hi,
    How to find out the manditary fields in an IDOC.
    For example MATMAS05 .
    For this 2 segments I want to find out the manditary fields.
    E1MARA
    E1MAKTM

    Hi,
             go to transaction WE30 and give the corresponding IDoc type and enter. Then you will get all segments for that IDoc type then double click on segment. A popup box will come in that it will show a check box whether it is a mandatory segment or not. And segment editor button will give all the field details.
    Regards

  • 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 find where the screen field is stored in table

    Hi all,
    How to find where the screen field  is stored in the table .
    for some transactions if i press F1 on the field and after checking for the technical help.
    I can only find the struture for the screen field, but whereas i need table name for it.
    Can anybody help me how to find the table name where the field is stored.
    Regards,
    Madhavi

    Hi,
    Just hitting a F1 on screen field and getting structure name will not help in getting table name.
    First you need to know the flow of data in the reqd module, which will help you know all the tables in that module with there most of the fields with the data flow, now you need to work on your own to figure out that in which actual tables that value is stored.
    Hope this helps you.
    Regards,
    Tarun

  • How to find condition  type for a particular material document no.

    hiiiiii
    How to find condition type for a particular material document no.

    Hi
    Condition types are maintained at PO level
    Take the EKKO-KNUMV and pass to
    KONV-KNUMV field and take the different condition types values from KONV
    Take the Material Document No (MBLNR) and pass to MSEG table and take the EBELN field and from EKKO table take EKKO-KNUMV field and pass to KONV
    see the table T685 for different condition types.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Find data type from value

    Hi,
    I want to find data type from its value.
    Ex- If value = 1234 then its data type is numeric.
          If value = ABCD then its data type is char.
    So is there any FM which can tell the data type from its value or any way to do it.
    Moderator Message: Offering points is against forum RoE. 
    Regards,
    Ashish Gupta
    Message was edited by: Suhas Saha

    Hai.
    check this.
    the five non-numeric types (text field (C), numeric text field (N), date field (D), time field (T), and hexadecimal field (X)), there are three numeric types, used in ABAP to display and calculate numbers. Data type N is not a numeric type. Type N objects can only contain numeric characters (0...9), but are not represented internally as numbers. Typical type N fields are account numbers and zip codes.
    integers - type I
    The value range of type I numbers is -2*31 to 2*31-1 and includes only whole numbers. Non-integer results of arithmetic operations (e.g. fractions) are rounded, not truncated.
    You can use type I data for counters, numbers of items, indexes, time periods, and so on.
    Packed numbers - type P
    Type P data allows digits after the decimal point. The number of decimal places is generic, and is determined in the program. The value range of type P data depends on its size and the number of digits after the decimal point. The valid size can be any value from 1 to 16 bytes. Two decimal digits are packed into one byte, while the last byte contains one digit and the sign. Up to 14 digits are allowed after the decimal point. The initial value is zero. When working with type P data, it is a good idea to set the program attribute Fixed point arithmetic.Otherwise, type P numbers are treated as integers.
    You can use type P data for such values as distances, weights, amounts of money, and so on.
    Floating point numbers - type F
    The value range of type F numbers is 1x10*-307 to 1x10*308 for positive and negative numbers, including 0 (zero). The accuracy range is approximately 15 decimals, depending on the floating point arithmetic of the hardware platform. Since type F data is internally converted to a binary system, rounding errors can occur. Although the ABAP processor tries to minimize these effects, you should not use type F data if high accuracy is required. Instead, use type P data.
    You use type F fields when you need to cope with very large value ranges and rounding errors are not critical.
    Using I and F fields for calculations is quicker than using P fields. Arithmetic operations using I and F fields are very similar to the actual machine code operations, while P fields require more support from the software. Nevertheless, you have to use type P data to meet accuracy or value range requirements.
    C ---> character
    D ---> date
    P ---> packed
    T ---> time
    X ---> hexadecimal
    I ---> integer.
    N ---> Muneric.
    Possible ABAP/4 data types:
    C: Character.
    D: Date, format YYYYMMDD.
    F: Floating-point number in DOUBLE PRECISION (8 bytes).
    I: Integer.
    N: Numerical character string of arbitrary length.
    P: Amount or counter field (packed; implementation depends on hardware platform).
    S: Time stamp YYYYMMDDHHMMSS.
    T: Time of day HHMMSS.
    V: Character string of variable length, length is given in the first two bytes.
    X: Hexadecimal (binary) storage.
    regards.
    sowjanya.b.

  • How to find table for structure field ???

    Hi..
    i need your expert help on this.
    i am working on printing of terms of payment description. here there are explanation fields. it is coming from structure R052. and field name is TXT 02. here as per my understanding structure is coming from multiple tables so how i can find that from which table this field is coming??
    thanks
    h shah

    Dear,
    Well I cant say this is the solution for your issue, but have a look.
    http://it.toolbox.com/wiki/index.php/Find_data_in_your_SAP_system_and_know_which_tables_do_what
    DD02L - table properties
    DD02T - table texts
    DD03L - field properties
    DD03T - field texts
    How to find data related to a structure? With GREAT difficulty, but here are some ways (which will NOT work sometimes) to find specific fields if you know the structure's fieldname.
    1) First, goto SE11, and enter your structure name. Goto the field that holds your data, and double-click on the element name. Once inside the element, do a where-used list for that element, searching tables only. Then go into each table, and see if you can find the one holding your data. There may sometimes be a huge number of tables displayed, but a lot of them will be empty.
    2) Get the name of the program behind your transaction, goto SE80, and enter the program name. 99% of the time it will be part of a module-pool and bring up the pool. Goto the dictionary structures, and search each table there for the one holding your data.
    3) Open a new session with transaction ST05, select SQL Trace, click on the Trace On button, and go back to your transaction (while leaving the session with ST05 open). Submit your transaction, and go back to the ST05 session. Click on the Trace Off button, then select the List Trace button. Continue with standard selections, and a BASIC TRACE LIST will appear. search thru the tables displayed under ObjectName.
    and have a look at below.
    You do know any transaction in which (related) data is used: 1) start the transaction 2) position the cursor on the field you want to have info about 3) press F1, then F9 4) now you see the technical information of the data element, such as table name and field name. 5) if the table mentioned is what you're looking for, you're done. It is also possible that the data element is in a structure and not in a table. Now you can either analyze the structure via trx SE11, or you can double click on the 'data element' field. In the next screen, use the 'Where used' button to find the tables in which this data element is used.
    Additional tip: if you have found the table name, you can use trx SE36 to see the relationships of this table to other tables. You can use these relationships when defining queries, designing custom ABAP programs, etc. If you're lucky, one or more standard SAP logical database exist which contain the table you found in the previous steps. Proceed as follows: 1) start trx SE36 2) use the search help for the logical database name 3) enter the name of the table in the search help 4) press enter and, if you're lucky, you'll see a list of logical databases. Select one, press enter, select the radio button 'Structure' and press the view button. Now you'll see how this table is related to other tables.
    And finally, I prefer, the simpliest way to contact the ABAP consultant for help.
    Regards,
    Syed Hussain.

  • How to find in which table field "DDTEXT" with entry "xyz"

    How to find in which table field "DDTEXT" with entry "Item number in contract account document" exists.
    There are too many tables with field name "DDTEXT"

    Refer:
    Getting short text of data element

  • I have date type list field in sharepoint list and i have created one form in sharepoint webpage.

    Hi All,
    i have date type list field in sharepoint list and i have created one form in sharepoint webpage.
    Now i want to save that field from shareepoint webpage, its declared "t1.text" but its showing error.
    How can i save this field?

    Hi AnilKarthink, 
    I wrote a Technet Wiki article on saving data to the various SharePoint fields. You can view it here: http://social.technet.microsoft.com/wiki/contents/articles/21801.sharepoint-a-complete-guide-to-getting-and-setting-fields-using-c.aspx
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • Changing data types of  fields in structures

    Hello,
       Currently we are working for upgrade to ECC 6.0 .
       In some transactions we are using BAPI_MATERIAL_SAVEDATA to create material.
      We have some additional fields in MARA and MARC table , which we fill using BAPI_TE_MARA and BAPI_TE_MARC structures.
        In these structures we have different data types for fields earlier in 4.6C
    Now this function module is only working if we change  data types of  fields in these structures only to char type. It is going for dump , if we maintain any other data type.
      Could any body tell me why should we change for char data type ?
    Regards,
      SATYA

    Hi,
    Check enhancement category (Extras --> Enhancement Category) for structures before enhancement. For example, for BAPI_TE_MARA structure, enhancement category is given as character type or numeric type. That means you can add the fields of data type only C and N. No other data types are allowed. If you select as not classified then you can add any data type. This option plays important role while enhancement.
    Regards,
    Prasanth

  • How to delete data from single field in a database table?

    Hi guys,
         Plz suggest me How to delete data from single field in a database table?
    thnks,
    pavan

    hi
    in addition to abv details..chk this:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
    http://dev.mysql.com/doc/maxdb/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm
    regards,
    madhu

  • How to change data type of attribute in caf

    hi.
    this is my problem.
    i been added a attribute in an entity service called emloyee. named "Birthday", use the data type "com.sap.caf.core.date".
    when i tried modify the entity service, i hit exception about "DST Daylight Saving Time".
    because of DST, the date will add an hour such like "1957/04/01 00:00:00.0" to "1957/04/01 01:00:00.0", and com.sap.caf.core.date will throw an exception.
    is anyone had same problem like me?
    how to fixed it(if passable)?
    and, how to change data type?
    thanks.

    Hi Sruthi,
    all you need to do on this is open the report go to the parameters, select the parameter that you wish to change and click "Edit". This will allow you to change thefield to a date rather than a date time.
    Regards,
    Noel

  • How to crete data type from XSD

    Hi All,
    can anyone tell me ...how to create data type from agiven xsd.
    I need urgently....
    thanks in advance....

    import this XSD, load this in your mapping editor and then use this to crate the datatype manually.
    Or, use XML spy, load this XSD and then you should be able to see the Structure, or,
    Look into the XSD data and decipher things yourself
    Regards
    Bhavesh

Maybe you are looking for

  • System will not boot - Arrives at 'Bluetooth Setup Assistant popup &

    A Bluetooth Setup Assistant (BSA) pop-up arrived on my screen looking for bluetooth mouse (which I do not have). It is in front of the log-in screen (I can just see it behind the BSA pop-up). I cannot get rid of it. The keyboard and mouse will not wo

  • Inheritance - Cannot find Symbol

    Hello! After many hours of searching for the answer, i have decided to brave getting a grilling for asking something trivial. I'm creatating a system and so far the problem i am having is inheritance. The superclass compiles fine, no problems: packag

  • HT3180 My wireless router needed restart. And, no Apple TV signal. How do I reset the Apple TV box.

    My wireless router needed restart. And, no Apple TV signal. How do I reset the Apple TV box? no lite. nothing

  • Email via RFQ

    Hi There, I too would like to triger a mail when an RFQ is saved ,kindly let me know as to how to configure.I have maintanied Vendors Email Id in Vendor Master recorrd. 1)hw to set up the LOCL output device ?? 2)Hw to assign Business parter to Vendor

  • Target link to layer

    I put a link on a page. I would like this link to open not in the same window, not in a new window but in a layer inside this same page. How do I do this?