Determining the type of a field-symbol

Hi!
I want to create a logical expression that determines the type of field-symbol that was passed in to a function.
i want to do something like this:
IF imported_fieldsymbol IS OF TYPE some_type
ENDIF
how do you create such an expression in ABAP?
regards

Hi,
  You can use the RTTS - Run Time Type Service.
  Try the sample code
TYPES my_type TYPE i.
DATA: my_data   TYPE my_type,
      descr_ref TYPE ref to cl_abap_typedescr.
START-OF-SELECTION.
  descr_ref = cl_abap_typedescr=>describe_by_data( my_data ).
The hierarchy of RTTS classes are as follows,
CL_ABAP_TYPEDESCR
  |
  |--CL_ABAP_DATADESCR
  |   |
  |   |-- CL_ABAP_ELEMDESCR
  |   |--CL_ABAP_REFDESCR
  |   |--CL_ABAP_COMPLEXDESCR
  |       |
  |       |--CL_ABAP_STRUCTDESCR
  |       |--CL_ABAP_TABLEDESCR
  |
  |--CL_ABAP_OBJECTDESCR
     |
     |--CL_ABAP_CLASSDESCR
     |--CL_ABAP_INTFDESCR
Regards,
Mustajab

Similar Messages

  • Type Conflict In Field Symbol

    Hi All,
    We were doing a report to read all major infotypes and displaying the relevant data. It was working fine  until we included Personal data (Infotype 0002).
    We used a field symbol of type any and pnnnn type prelp. It was working fine. But when we included details from PA0002, it is throwing a runtime error stating type conflict between field symbol and pnnnn. (We used pnnnn[] = <f>.
    Note: We are using ECC 6.0 and the program is Unicode enabled
    Kind Regards
    Hari Sankar M

    Hi Prince,
    Yes. You need to change the declaration as follows.
    Field symbols:<wa_ext> TYPE ANY,
                          <f_zname> TYPE any.
    Data: lv_zname type sname.
    ASSIGN COMPONENT 86 OF STRUCTURE <wa_ext> TO <f_zname>.
    lv_zname = <f_zname>.
    Try the above mentioned code. I think this should work.
    Best Regards,
    Ram.

  • Class to find the components of a field-symbol

    Hi,
    Can anyone tell any class/function module to get the components of a field-symbol which is like an internal table.
    Thanks.

    Hi,
    I assume your field symbol is generic, it means was declared like
    field-symbols: <fs_tab> type any table.
    Later you assined some intrernal table to it and now you want to get components of structure of that table, right?
    You can use RTTS for this:
    "first create work area for that table
    data: wa_table type ref to data.
    field-symbols: <fs_wa> type any.
    create data wa_table like line of <fs_tab>.
    assign wa_table->* to <fs_wa>.  "<fs_wa> now work like work area for table <fs_tab>
    "now you get the components via RTTS classes
    type-pools: abap.
    data: r_struct type ref to cl_abap_structdescr,
             gt_components type abap_component_tab with header line.
    r_struct ?= cl_abap_typedescr=>DESCRIBE_BY_DATA( <fs_wa> ).
    gt_components = r_struct->GET_COMPONENTS( ). "here gt_components holds components of that table/structure
    Regards
    Marcin

  • How can i write the bellow code using field symbols

    data : it_mara type table of mara.
    select * from mara
                into it_mara.
    delete it_mara where matnr = '100-100'
                             and meins = 'KG'.
    if i do the same by using field symbols
    i am getting data into <it_mara>
    but
    delete <it_mara>  where matnr = '100-100'
                               and    meins = 'KG'.
    is showing syntax error
    how to correct the error ?

    I think, DELETE does not allows to dynamically define the logical expression for the WHERE clausule.
    Have you tried by filtering data in SELECT statement??
    Something like:
    if dataBase = 'MARA'.
    append 'MATNR <> '100-100'' to Itab_Where[].
    append 'AND MEINS <> 'KG'' to Itab_Where[].
    endIf.
    select * from (dataBase) where (Itab_Where) into table <my_table>.
    this is possible, but I don't know if this fits your requirements.

  • How can I determine the type of video out connector I need?

    Howdy,
    I have a white macbook purchased Jun/2008. I want to connect to a TV but don't know what adapter I need. How can I determine the type of video out jack my macbook has?
    System Profiler says the model identifier is "MacBook 4,1". Under Graphics/Displays the only thing it says about the "Display Connector" is that no display is connected. Too bad it doesn't tell me what type of connector it is. If I knew the name of the connector I'd probably be home free. But it seems like every macbook model has a different video connector (since the state of the art has advanced over the years) and I haven't been able to keep up with the names.
    Now, I have a 6" long adapter that will convert this connector to VGA. And searching the Apple store for VGA adapters, the existence of mine says my connector is might be one of "Mini DisplayPort", "Apple Mini DVI", "Apple DVI", or "Apple Micro-DVI". But then there is also the connector at
    http://store.apple.com/us/product/M8639G/A?mco=MTY3ODQ5OTY
    and that looks like the one I have. But unlike the other adapters, this one is just called a "VGA Display Adapter". Does the connector have a name? How can I find adapters that have that same connector?
    I know I could use the adapter I have, plus a VGA to VGA cable, to hook up to a TV. But the quality of the VGA signal is poor in the digital world. My goal is to hook up to the TV via HDMI. Is this even possible? By which I mean, will my macbook generate the signals necessary to be able to be converted to HDMI?
    Thanks for any help,
    Zebulon T

    Thanks, Ded,
    You're right, the cable that I have won't work. I't from my previous, 2004 iBook. This is pretty embarrassing... I looked at the cable but didn't bother to try plugging it in.
    Looking at the close-up picture of the Mini-DVI to VGA adapter, that does look like the right connector. So I have Mini-DVI, and the other apter you pointed to can convert this to DVI. I'll take a look to see what makes the most sense, connector wise, downstream from that.
    Thanks very much.
    Zeb T

  • How to determine the type of an existing iView

    Hi,
    While creating an iView using wizard there is a big list of type of iViews. But after creation of iView, how do I determine the type of iView. Which attribute or property of iView holds this information?
    -Lave Kulshreshtha

    You can copy and paste the existing Iview changing the name and ID if u want to replicate the same.
    Also, when you create a new iView from a template, you get a list of them e.g SAP BSP iView etc.
    Now what you see in the code link is much similar to what you see as a list of templates when u create iViews. So its pretty simple.
    I hope this helped you.

  • Run Time: type conflicts in field symbol

    In this statement i am getting run time error : assign component.
    type conflicts in field symbol
    FIELD-SYMBOLS:
        <fs_tab> TYPE ANY table,
         <wa_tab> TYPE ANY,
         <fs_field> type crmd_orderadm_h.
    DATA:      w_data    TYPE REF TO data.
    CREATE DATA w_data TYPE STANDARD TABLE OF (c_tabname) WITH NON-                     UNIQUE DEFAULT KEY.
        ASSIGN w_data->* TO <fs_tab>.
    SELECT * FROM (c_tabname)
              INTO CORRESPONDING FIELDS OF TABLE <fs_tab>
      LOOP AT <fs_tab> ASSIGNING <wa_tab>.
          DO.
            ASSIGN COMPONENT sy-index OF STRUCTURE <wa_tab> TO <fs_field>.
    *Writeing: fs_field here*
    Enddo.

    FIELD-SYMBOLS: <fs_field> type crmd_orderadm_h.
    <fs_field> type any.
    i cannot pass "
      lv_header_guid =    <fs_field>-guid.
    complete code as follows.
      LOOP AT <fs_tab> ASSIGNING <wa_tab>.
          DO.
            ASSIGN COMPONENT sy-index OF STRUCTURE <wa_tab> TO <fs_field>.
    *i am assining fs_field-guid here. Thats why i am taking this field symbol as type "crmd_orderadm_h"*
    *bold* * <fs_field>-guid.*bold**
            lv_header_guid =    <fs_field>-guid.
            iv_header_guid = lv_header_guid.
            REFRESH: lt_header_guid.
            INSERT iv_header_guid INTO TABLE lt_header_guid.
            REFRESH: im_orderadm_h,im_text.
            CALL FUNCTION 'CRM_ORDER_READ'
              EXPORTING
                it_header_guid       = lt_header_guid
              IMPORTING
                et_orderadm_h        = im_orderadm_h
                et_text              = im_text
              EXCEPTIONS
                document_not_found   = 1
                error_occurred       = 2
                document_locked      = 3
                no_change_authority  = 4
                no_display_authority = 5
                no_change_allowed    = 6
                OTHERS               = 7.
            IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
          ENDDO.

  • Determining the "type" of a SQL statement

    I'm using the Oracle thin driver with my JDBC program.
    I want to be able to accept a String containing a SQL statement from the user and execute it. If it's a select statement then present the rows returned in a JTable, otherwise retrieve the return value for the command (eg INSERT, DELETE, etc).
    Is there any "readymade" method in JDBC or Oracle driver to determine the type of a SQL statement in this sense. Or do I have to parse it myself? (Imagine having to write code to strip comments out etc!)

    There is no "readymade" method. But an easy way to check will be to check the first 6 charchters of the string.
    You could use
    newString = SQL.substring(0, 5); to obtain the first 6 characters.
    if the characters are "select"
    //do select things
    else
    // do insert/delete whatever things

  • What r the benefit of using field symbols

    hi all
    what is the benefit of using field symbols and when is  recommended to use it?
    regards

    It Just assign the values directly to fieldsymbol and no need to used append.
    It increases the performance of the program.
    also check this
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
    Reward points if useful
    Regards,
    Vimal

  • Dynamically change the type of a field

    Hello,
    After finishing reading the adobe documentation and looking at almost all the samples in the Adobe website, i still have no clues how to do the dynamic type changing in the E-Forms.
    Do you think it's possible to change dynamically the type of a field at runtime or during the generation of the pdf?
    Example:
    i send a table to the PDF with the following information:
    Table X line 1 column1 --> textfield type
    Table X line 2 column1 --> Numeric field type
    The result must be the generation of the table X with at the first line a text field and at the second line a Numeric. Of course those field will be editable.
    Possible ?? or not?
    Thx for your help,
    Pelaez Lopez Philippe

    Let me guess, you would like to work with Adobe as you would work with WD. You cannot generate forms from scratch. And that is equal to create a single field, than dynamically duplicate it, distribute it all around the paper and change the types to the right ones. This is not possible. You can only create a superbig form and use hiding.
    If you would like to see a super-big-crazy example, check form MEDRUCK delivered by SAP. This form is superbig, but your output can contain only few fields according to the print type you need.
    If you form is that complicated you cannot build it this way, then the requirement is probably not structured and goes against the meain stream (which needs the structure:))
    Otto

  • How to determine the types of interactive form fields

    Hello:
    I have written a utility that traverses through the objects in a PDF file, and finds the ones of Type "Annot", Subtype "Widget". I need to go one step down the hierarchy and determine which kind of widget (text, radio button, check mark, press button) is the one under scrutiny.
    I have looked at the innards of PDF files, and found that the widgets of type "text" are internally identified by the FT=Tx dictionary entry. So far, so good.
    Here is where the beauty and consistency stops. It turns out that all the other (non-text) types are ambiguously identified by FT=Btn dictionary entry.
    So: Every field which is not text, is a button.
    Where should I look?
    TIA,
    -RFH

    Digging a little deeper, I found that the 4 types of fields (as generated by default) have different keys, as follows:
    Text: [F, FT, MK, P, Rect, Subtype, T, Type]
    Check Box: [AP, AS, F, FT, MK, P, Rect, Subtype, T, Type]
    Radio Button: [AP, AS, BS, F, FT, Ff, MK, P, Rect, Subtype, T, Type]
    Button: [AP, DA, F, FT, Ff, MK, P, Rect, Subtype, T, Type]
    Is that the correct approach to determine the kind of fields, by querying for the keys, which somehow instantiate a fingerprint?
    TIA,
    -RFH

  • How to know or check the type of a field when processing a dynamic table?

    Dear all,
        When processing a dynamic table i have a short dump because of a convert_of_type incorrect, so i would like to check the type of field-symbol <f> before moving the data (type char) to this field-symbol <f>.
    Could you please help me how to check or get the type of field-symbol <f> (because field-symbol <f> is assigned dynamic, so this <f> can be type char, unit, or quantity, ...)?
    The source code same as below:
       ASSIGN COMPONENT lc_field OF STRUCTURE ls_data TO <f>.
       MOVE lv_field TO <f>. (Dump is here when lv_field is char type and <f> is quantity type => could i check the type of <f> if it's char type before using this instruction "MOVE ..."?)
    Thanks a lot in advance,
    Vinh Vo

    Try to use this way
    WRITE lv_field TO <f>.
    Instead of
    MOVE lv_field TO <f>.

  • Assign Type conflict with field symbols

    I have two tables tab1 & tab2, want to assign field values from tab1 to tab2 suing field symbols. Deatils are :
    TYPES: BEGIN OF ty_tab1,
        item1   TYPE char20,
        item2   TYPE char20,
        val1 type i,
        val2 type i,
    END OF ty_tab1,
    BEGIN OF ty_tab2,
        item1 TYPE char20,
        item2 TYPE char20,
    END OF ty_tab2.
    DATA: it_tab1 TYPE TABLE OF ty_tab1,
                it_tab2 TYPE TABLE OF ty_tab2.
      FIELD-SYMBOLS <fs_tab1> TYPE ty_tab1.
                     <fs_tab2t> type ty_tab2.
      LOOP AT it_tab1 assigning <fs_tab1>.
        READ TABLE it_tab2  assigning <fs_tab2> WITH KEY item1 = <fs_tab1>-item1
                                                                                    item2 = <fs_tab1>-item2.
        IF sy-subrc EQ 0.
          ASSIGN COMPONENT 'ITEM1' OF STRUCTURE <fs_tab1> TO <fs_tab2>.
         ASSIGN COMPONENT 'ITEM2' OF STRUCTURE <fs_tab1> TO <fs_tab2>.
        endif.
    endloop.
    Getting error msg
    You attempted to assign a field to a typed field symbol, but the field does not have the required type.         
    whats the reason of error.
    Edited by: Matt on May 27, 2011 8:59 AM - added  tags

    Taken from example dump
    A new value is to be assigned to the field "...", although this field is
    entirely or partly protected against changes.
    The following are protected against changes:
    - Character literals or numeric literals
    - Constants (CONSTANTS)
    - Parameters of the category IMPORTING REFERENCE for functions and
    methods
    - Untyped field symbols not yet assigned a field using ASSIGN
    - TABLES parameters if the actual parameter is protected against changes
    - USING reference parameters and CHANGING parameters for FORMs, if the
    actual parameter is protected against changes and
    - Accesses using field symbols if the field assigned using ASSIGN is
    protected (or partially protected, e.g. key components of an internal
    table with the type SORTED or HASHED TABLE) against changes
    - Accesses using references, if the field bound to the reference is
    protected (or partially protected) against changes
    - External write accesses to READ-ONLY attributes,
    - Content of a shared object area instance accessed using a shared lock
    (ATTACH_FOR_READ).
    You likely fall in one of these cases. Check each and if still unsure please share your code so we can reproduce the error.
    Regards
    Marcin

  • How to check the length of a field symbol value

    hi all,
    i have a problem with string function, i have assined  table fields to  a field symbol in a loop i want check the length of the assigned fields symbol value  in every loop . i have written like ,,,,,len = strlen( <fs>). then i am getting the length of the field label what i ahve assigned to fiels symbol not the field value lenght ,
    please advise me on this,
    thanks,
    sre

    I think you're on the right track.  This should work:
    data: len type i.
    data: begin of itab OCCURS 1,
            a type string value '1',
            b type string value '12',
            c type string value '123',
          end of itab.
    FIELD-SYMBOLS: <fs> type ANY.
    do 3 times.
      assign component sy-index of STRUCTURE itab to <fs>.
      len = strlen( <fs> ).
    enddo.

  • How to update the value inside a field symbol ?

    ASSIGN COMPONENT 'MENGE' OF STRUCTURE <fs_line> TO <fs_field>.
    <fs_field> = itab_stpo-menge.
    COLLECT <fs_line> INTO <fs_table>.
    .processing some code......
    ASSIGN COMPONENT 'MENGE' OF STRUCTURE <fs_line> TO  <fs_field>.
    <fs_field> = ( itab_stpo-menge * itab_plpo-vgw03 ).
    COLLECT <fs_line> INTO <fs_table>.
    Hi, guys,
    May i know is there a way to update the value in inside a field symbol?
    I feel hard to figure out the way to solve this situation. Kindly give me some help or perhaos tell me other altenative way to do it also can.
    Thanks in advance.
    Edited by: Jiansi Lim on Apr 25, 2008 8:09 PM

    hi check this...
    For a structured data object s, you can use the statement
    ASSIGN COMPONENT comp OF STRUCTURE s TO FS.
    Here the comp is the component name or its index number in the structure.
    Find the following sample code -
    DATA: BEGIN OF LINE,
    COL1 TYPE I VALUE '11',
    COL2 TYPE I VALUE '22',
    COL3 TYPE I VALUE '33',
    END OF LINE.
    DATA COMP(5) VALUE 'COL3'.
    FIELD-SYMBOLS: <F1>, <F2>, <F3>.
    ASSIGN LINE TO <F1>.
    ASSIGN COMP TO <F2>.
    DO 3 TIMES.
    ASSIGN COMPONENT SY-INDEX OF STRUCTURE <F1> TO <F3>.
    WRITE <F3>.
    ENDDO.
    ASSIGN COMPONENT <F2> OF STRUCTURE <F1> TO <F3>.
    WRITE / <F3>.
    The output is:
    11 22 33
    33
    I need to update one field in Internal table
    regards,
    venkat

Maybe you are looking for

  • How do I put two different apple id accounts on one computer?

    I have my account on my home computer but I have another account that I set my Ipad up with. How do I put two different accounts on to one computer?

  • Cannot opening PDF created with Adobe Acrobat 5 on Samsung Android device

    Hi I have an number of links to PDFs on my WordPress.com blog home page (www.creationtonewcreation.com). These were created in Adobe Acrobat 5, with security applied that allows viewing and printing. They open fine on my laptop (e.g. with Google Chro

  • Oracle.bali.xml.model.XmlInvalidOnCommitException!!!!!!!!

    Hi, I am getting below error when I try to drag and drop the adf-task-flow in to my .jspx page. Here the taskflow contains single page fragment. please help. ERROR: oracle.bali.xml.model.XmlInvalidOnCommitException: SEVERE: Element taskFlow not expec

  • Compile problem with javax.sql

    I have upgraded to sdk 1.4.2 and tried to compile my code. I am getting an error on import javax.sql.* where I am getting the message "Package does not exist" error. As the result of this any class that is in this package gets an error as well. I am

  • A-B Testing in iStore running 11.5.10 ?

    Hello, I would like to know if A-B testing functionality is inherent to iStore running v11.5.10. If not, does R12 have this functionality? Can v11.5.10 be upgraded with this functionality? Please advise. Thanks Linda