Field name referenced by field symbol

Hi,
I would like to get the field name referenced by a field symbol at rutime. In the code below, besides the type and length of the field, I also would like to get the field names 'AA', 'BB' and 'CC' .
Can you please tell me how I can get this information?
DATA: BEGIN OF g_test,
       aa(10)    TYPE c,
       bb        TYPE i,
       cc(20)    TYPE c,
     END OF g_test.
DATA: l_type(20),
      l_len   TYPE i.
FIELD-SYMBOLS <fs>.
START-OF-SELECTION.
  DO 3 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE g_test TO <fs>.
    DESCRIBE FIELD <fs> TYPE l_type OUTPUT-LENGTH l_len.
    WRITE: /5 sy-index, l_type, l_len.
Would like output as:
   1  AA    C 10   instead of  1    C 10
   2  BB    I 11    instead of  2   I 11
   3  CC    C 20   instead of  3    C  20
  ENDDO.
Regards,
Rao A

Hi,
Using your sample structure you can do it using such a code:
DATA: BEGIN OF G_TEST,
        AA(10) TYPE C,
        BB     TYPE I,
        CC(20) TYPE C,
      END OF G_TEST.
TYPE-POOLS: ABAP.
DATA: COMP TYPE LINE OF ABAP_COMPDESCR_TAB.
DATA: STRUCT_REF TYPE REF TO CL_ABAP_STRUCTDESCR.
  STRUCT_REF ?= CL_ABAP_STRUCTDESCR=>DESCRIBE_BY_DATA( G_TEST ).
  LOOP AT STRUCT_REF->COMPONENTS INTO COMP.
    WRITE:/ COMP-NAME, COMP-TYPE_KIND, COMP-LENGTH, COMP-DECIMALS.
  ENDLOOP.
Krzys

Similar Messages

  • Field Name  of the field on the Selectiion Screen

    Hi,
    I am executing report program and we get a Selection Screen .The question is  can we catch the field names of the fields on the selection screen dynamically.
    We can find the field name by pressing F1 and looking into the Technical Information of that perticular field.
    But can we fetch the field name dynamically.
    Any pointers/information in this regard will be highly helpful.
    Thanks & regards,
    Abhijeet

    Hello Abhijeet,
    Here's what I think you're looking for -
    tables spfli.
    parameters     : p_test   like spfli-carrid.
    select-options : s_carrid for  spfli-connid.
    DATA:
      descr_ref TYPE ref to cl_abap_elemdescr.
    START-OF-SELECTION.
      descr_ref ?= cl_abap_typedescr=>describe_by_data( p_test ).
      WRITE: / 'Typename     :', descr_ref->absolute_name.
      WRITE: / 'Kind         :', descr_ref->type_kind.
      WRITE: / 'Length       :', descr_ref->length.
      WRITE: / 'Decimals     :', descr_ref->decimals.
      WRITE: / 'Output Length:', descr_ref->output_length.
      WRITE: / 'Help ID      :', descr_ref->help_id.
    Kind------> data type (C , I , etc.,)
    Help ID---> data element (usually).
    There are other classes in ABAP of the form CLABAPDESCR which can provide you with other information. These classes all belong to what is called RTTI (Run Time Type Identification). However, these are available only from 46c. You can explore the other classes, as I think they would be very interesting and useful in the future.
    Regards,
    Anand Mandalika.

  • How to extract field name, length, descrip & field type out of repository

    How can I  extract field name, length, descrip & field type out of repository?  Or is it possible?

    Hi Victor,
    To get any info about any field you should know the code of that field that we specify in console while  creating field.
    Using this code you will get property whatever you defined in consloe.
    RepositorySchemaEx repositoryschema= MetadataManager.getInstance().getRepositorySchema(usrCtx);
    where usrctx is usersession context that you create to access yr repository
    FieldProperties fProp = repositoryschema.getField(tableName,fieldCode);
    where tablename is tablecode in which field belong
    field code is code of field that you define in console for that field
    if you check with frop then it will show  the general properties like type etc.
    suppose yr field of type text field then you can acces all properties that is coomon as well that is respective to text type field.
    FixedWidthTextFieldProperties textField = ( FixedWidthTextFieldProperties) fProp
    if you have other field type then that use thta properties . you will get in java api docs on help.sap.com whatever the properties MDM supporting.
    Hope ot helps  you get the solution
    thanks,
    sudhanshu

  • Field name retrieval from field symbols after assigning to field in a struc

    We have an internal table of about 100 columns. First 7 of them have key values and other fields are data fields. Out of remaining 93 fields, any 2 to 3 fields have data stored in it in each record. Using field symbols in a loop (93 fixed iterations), we are identifying which fields has a data in it. Once we identify the field, how do we retrieve the name of the field / column of the table. We are performing further processing based on name of the field.
    Any ideas how to get the name of the column assigned to field symbols?
    sample raw code piece is as below:
    clear n.
    Do 93 times.
      n = n + 1.
      assign component n of structure itab to <fs>.
      if not <fs> is initial.
       Get name of the field in cfname.
        perform process_record using cfname.
      endif.
    enddo.
    Thanks.
    Regards.

    Hi,
    Try this..use the function module GET_COMPONENT_LIST to get the fields of the internal table and store it in an internal table ITAB_COMP..
    Then use READ TABLE ITAB_COMP INDEX sy-index..
    You can get the field name from the work area..
    Thanks,
    Naren

  • How to view field name for a field in Oracle form?

    I was told you can do this but I forgot how.
    If you want to build a report, but don't know what the field name is in Oracle, you can open up the Oracle form and find the screen with that field name and do a trick that tells you the Oracle field name. Any help?

    Try this....
    REPORT ZZDYNAMIC_FIELD.
    DATA: BEGIN OF it1 OCCURS 0,
    printer(10) TYPE c,
    paper1(20) TYPE c,
    paper2(20) TYPE c,
    paper3(20) TYPE c,
    END OF it1.
    DATA: descr_ref TYPE REF TO cl_abap_tabledescr,
          i         TYPE i.
    FIELD-SYMBOLS:
      <key_comp_wa> TYPE abap_keydescr,
      <field>       TYPE ANY.
    it1-printer = 'MUC123'.
    it1-paper1 = 'KBLOGO'.
    it1-paper2 = 'BLANK'.
    it1-paper3 = 'DINA5'.
    APPEND it1.
    it1-printer = 'MUC123'.
    it1-paper3 = 'KBLOGO'.
    it1-paper2 = 'BLANK'.
    it1-paper1 = 'DINA5'.
    APPEND it1.
    TRY.
        descr_ref ?= cl_abap_typedescr=>describe_by_data( it1[] ).
      CATCH cx_root.
    ENDTRY.
    LOOP AT it1.
      i = 0.
      WHILE 1 = 1.
        i = i + 1.
        ASSIGN COMPONENT i OF STRUCTURE it1 TO <field>.
        if <field> is not assigned.
          EXIT.
        endif..
        IF <field> IS ASSIGNED AND <field> EQ 'KBLOGO'.
          READ TABLE descr_ref->key INDEX i ASSIGNING <key_comp_wa>.
          WRITE <key_comp_wa>-name.
          exit.
        ENDIF.
      ENDWHILE.

  • Please validate giving field names to the field (built in data type) in TMG

    I have added fields with built in types….And I added header text ( heading of each field ) in Table maintenance generator   by se11 -&#61664; table maintenance generator  &#61664; delete &#61664; create new one TMG &#61664; then go to se11 &#61664; utilities &#61664; create entries &#61664; status &#61664; Screen number  &#61664; layout &#61664; in screen painter &#61664; give desired field for that particular field

    I have added fields to ztable with built in types….And I added header text ( heading of each of my field ) in Table maintenance generator by following procedure
    go to se11 -> utilities->table maintenance generator  -> delete -> create new one TMG ->
    then go to se11 -> utilities -> create entries -> status -> Screen number  -> layout -> in screen painter -> give desired field for that particular field.
    Am I right ? Please validate my procedure of giving field names to appear in Table maintenance generator.

  • Can you make an enter event in topmostsubform that gets the field name of any field thats entered

    Looking for some help.
    I have a modified Enter Event I'm trying to use. What my expected results are: When you click on a field on the PDF, it would open up a certain webpage or file depending on what field is entered. I currently have:
    if (xfa.host.name == "Acrobat") {
              app.launchURL("www.cnn5.com" + "/" + event.target.documentFileName + "&" + this.name, true);
    else {
              xfa.host.gotoURL("www.cnn5.com");
    In this example, i'm using a bogus address obviously. "event.target.documentFileName" gives me the PDF name which is what I want, but I need to scrub off the ".pdf" at the end of it. I know I can use this in every field that I want it in, but I'm looking to see if I can get this code in just the topmostsubform only due to having hundreds of forms I might be using this form and to save time.
    When this is used in the topmostsubform, it gives me the URL: "www.cnn5.com/PDFname.pdf&TopmostSubform" no matter what field i click into. Is there something i can change this.name to? Any help would be greatly appreciated.
    Also, i'll need to have this event to be able to use multiple times, because currently in the topmostsubform, it only activates on the first field that I enter and doesn't activate on fields after that. Suggestions please? Thank you

    Hi,
    Are you using event propagation?  If you are try
      xfa.event.target.name
    Otherwise have a look at this  http://blogs.adobe.com/formfeed/2009/03/xfa_30_event_propagation.html
    Regards
    Bruce

  • Structure field names at run time.

    Hi Experts ,
    i am not sure whether this is right question or not. i have on structure say X with fields name and age. is there any way to represent this field with the help of another variable at runtime.
    ex : Can i represent X-name as X-i where 'I' is s a string and will hold 'NAME' as a value.
    can this be achievable. kindly give reply.
    Thanks in advance.

    types:begin of ty_x,
          name type c,
          end of ty_x.
    data:wa type ty_x.
    data:v type string.
    field-symbols:<fs> type any.
    data:field(4) type c.
    start-of-selection.
    field = 'NAME'.
    concatenate 'WA-' field into v.
    assign (v) to <fs>.
    <fs> = 'A'.
    write wa-name.

  • Address Book field names changing for "imported" data

    I'm migrating from a thousand year old Palm Pilot that has served me so well to an iPhone. So it's time to get my contacts into OSX Address Book.
    I have tried moving the data a couple of ways - exporting vCards and text files from the Palm Desktop software.
    I did extensive editing of the text file in MS Excel to get the data into good order.
    I have set up a template in the Address Book preferences to create fields that I want/need. Some are generic default field names, some have custom names. eg. I want to see a field called "Bus. Phone" not one called "work". Call me picky.
    I get the same basic result no matter if I import the vCard file or a text file - The names of the fields just show up with very generic names in the imported data. I should note that creating a NEW record seems to use the field names that I have specified in the preferences.
    Also, when importing the text file, Address Book asks me to assign the field names for certain fields (while it seems smart enough to know what labels to use for other fields all on it's own). However, the Field Names available in the drop down menu ARE NOT the ones that I have set up in the prefs. I seem limited to the generic default field names only.
    Can anybody tell me how to get the field names to be what I want them to be for address data that is being imported like this?
    Thanks for any suggestions - this has been driving me crazy as it would seem to me to be a pretty basic process. (I mean, the Address Book has this import functionality and custom field name functionality built in so it should work right?!)
    Allen

    No sooner do I ask than I notice that other people have asked the same question. In one of the reply's I saw mention of a product called "Abee".
    I tracked it down and it did the job for me! Custom Field names live on!
    It's at:
    http://www.sillybit.com/abee/

  • How to get value of a Field if field name given in a String ?

    Hello,
    I've a String variable which contains a value such as X.Y.Z. The last one (Z) is a primitive type, others (X and Y) are my own classes.
    class C1
    C2 X;
    class C2
    C3 Y;
    class C3
    int Z;
    C1 var = new C1();
    When I encounter X.Y.Z in the String, I want to replace it with its value of var.X.Y.Z. How can I do ?
    thanks in advance....

    Thanks,
    But, X.Y.Z is a Field name not known during compilation, just know at runtime.
    The following working codes return the Field names(including sub-Fields in sub-classes) and their values in a Map:
    void getFieldValues(Object object, StringBuffer fieldName, Map oMap)
    throws java.lang.IllegalAccessException
      Field[] fields = object.getClass().getDeclaredFields();
      String  tmpString;
         for (int i = 0; i < fields.length; i++)
           if (!fields.getType().isPrimitive()) { tmpString = fieldName.toString();
    fieldName.append(fields[i].getName() + ".");
    getFieldValues(fields[i].get(object),fieldName,oMap);
    fieldName = new StringBuffer(tmpString);
    else oMap.put(fieldName.toString() + fields[i].getName(), fields[i].get(object));

  • What is the table name and field name for Street 2, street3 in Vendor mast.

    Hi,
    I have a BDC code for Vendor master. I just need to insert the fields street 2, street3, stree4 and street5 in the code. Can I insert it in the code directly without re-recording? If yes then what would be the table and field names for the fields mentioned above.
    Thanks & Regards,
    Sriram

    Hi Sriram,
       Its a Configuration Setting to bring the Check box ask your SD consultant, else directly insert this try, change your internal table filed here,
      PERFORM bdc_dynpro USING 'SAPMF02K'    '0100'.
      PERFORM: bdc_field USING 'RF02K-BUKRS' indata-bukrs,
               bdc_field USING 'RF02K-EKORG' indata-ekorg,
               bdc_field USING 'RF02K-KTOKK' indata-ktokk,
               bdc_field USING 'USE_ZAV'     'X',------------------------>this part is check box
               bdc_field USING 'BDC_OKCODE'  '/00'.
    for street just try this without re-recording,
    PERFORM bdc_field  USING 'ADDR1_DATA-NAME1'       indata-name1.
      PERFORM bdc_field  USING 'ADDR1_DATA-NAME2'       indata-name2.
      PERFORM bdc_field  USING 'ADDR1_DATA-SORT1'       indata-sortl.
      PERFORM bdc_field  USING 'ADDR1_DATA-STREET'      indata-stras.
      PERFORM bdc_field  USING 'ADDR1_DATA-POST_CODE1'  indata-pstlz.
      PERFORM bdc_field  USING 'ADDR1_DATA-CITY1'       indata-ort01.
      PERFORM bdc_field  USING 'ADDR1_DATA-COUNTRY'     indata-land1.
      PERFORM bdc_field  USING 'ADDR1_DATA-REGION'      V_regio.
      PERFORM bdc_field  USING 'ADDR1_DATA-PO_BOX'      indata-pfach.
      PERFORM bdc_field  USING 'ADDR1_DATA-STR_SUPPL2'  indata-suppl2.
      PERFORM bdc_field  USING 'ADDR1_DATA-TAXJURCODE'  indata-txjcd.

  • How to find field name for BDC

    Hi,
    to find out the field name for BDC ,
    1. press F1 for that field
    2. click technical info
    3. use SCRREN FIELD name given in Field desc for batch input.
    NOw what to do if SCREEN field name in "Field desc for batch input." is not given...Even During BDC recording if we input values in those fields,values are saved in appropritae tables but not inn BDC recording fields

    Hi again,
    1. ABSOLUTELY Sure.
    2. Container (Container Control)
       is nothing but an EMPTY control
       to place controls inside it.
        eg. Its a FRAME
        inside which, there are contros!
    3. Container does not have any INPUT VALUE !
    regards,
    amit m.

  • Display Technical Field Names within a Transaction Screen

    Hi All,
    Someone once showed me how to do this and for the life of me I cannot figure out how to do it in ECC 6.0.
    I would like to display the technical field names of all fields in a transaction.  It is important to note that I am not looking for the <b>F1...Technical Details</b> solution.  I am well aware that the technical field name can be retrieved by this method.  I am really looking to see all the technical names of the fields in a particular transaction without a lot of clicking and searching.
    When I saw this before you could quickly change from technical field names to short field names and vise versa. 
    I know this could also be accomplished in SE11 or SE16 - but that is not exactly what I am looking for.
    Can anyone help??

    Hi Christopher,
    you know that Rollin Stones thing?
    You can't always get what you want.
    There is no such functionality for standard transactions.
    Regards,
    Clemens

  • Screen field name

    Hi friend,
    In MB01, after giving the PO number and when the 'Adopt+Details' button is pressed, a new screen opens, in which there is a field 'Reference Doc'.
    My doubts on this field are as follows:
    1.  How to find out the screen field name for that field.
    2.  How to give a if condition for that field.
    Pls guide me.
    Regards,
    Mark K

    Hi Friends,
    Through F1, I am getting the field details as following :
       Program name   = SAPMM07M
       Screen no.     = 0210
       Screen field   = MSEG-LFBNR
       The value displayed in the field is '501809447'.
    Now I want to pass this field value to a variable.  How could I do this.
    Can you pls guide me.
    Regards,

  • Need description & table name of following field

    Hi,
    I came across following fields, but not aware of decription & table name.
    KSCHL
    VKORGAU
    VKORG
    PSTYV
    DATAB
    DATBI
    please any one can give me description or field name of above fields.
    Regards,

    KSCHL - Condition Type
    Data Type  CHAR       Character String
    Length     4          Decimal Places   0
    VKORG - Sales Organization
    Data Type  CHAR       Character String
    Length     4          Decimal Places   0
    PSTYV  - Sales document item category
    Data Type  CHAR       Character String
    Length     4          Decimal Places   0
    DATUM  - Valid-From Date
    Data Type  DATS       Date field (YYYYMMDD) stored
    Length     8          Decimal Places   0
    DATUM  - Valid to Date
    Data Type  DATS       Date field (YYYYMMDD) stored
    Length     8          Decimal Places   0
    You can check more information about them at SE11 placing them at the Table Field.
    There you can see the "Where used" key that will show you where they are used (probably many tables...)
    Good Luck !
    Plauto
    Edited by: Plauto Abreu on Feb 25, 2011 9:23 PM

Maybe you are looking for

  • Error by inserting data into a field of datatype LONG

    Hi, When inserting data into a field of datatype long in oracle8 database via SQL Plus or SQL worksheet there occurs the following error message: "field in data file exceeds the maximum length". If I access to the database from a selve written progra

  • Issue with ALSA softvol and reloading sound card module

    I'm using a Chaintech AV710 card with the snd_ice1724 module as a driver. The core issue is that sometimes when this module is loaded during startup (or every time after a suspend), it will play nothing but very loud static. To fix this, I simply rel

  • Help with my iPhone 4 Please

    Helo

  • Request for advice configuring/mounting XRAID

    I'm asking for some advice about configuring Xserve RAID. I am not an IT person, but just a researcher and have found myself in charge of some computing resources. We have an Xserve RAID - 14 drive, each set of 7 on RAID5 - connected through fibre sw

  • Help me! can not ping through hostname

    Hello i am using Solaris 8. I can ping and reach the other host by IP only, I can not reach the other host by the DNS name. How can i overcome this problem. shall i do any configuration .Help me to resolve the problem. Thanks in advance, balachandar.