Build field catalog for dynamic data objects

Hi
Could you please tell me how to build a field catalog (ooops alv)  for an internal table which is a dynamic data object.
  TYPES: BEGIN OF t_addsubty,
         subty TYPE subty,
         pernr TYPE persno,
         END OF t_addsubty.
  TYPES: ty_addsubty type t_addsubty occurs 1.
i have data object using these
        CREATE DATA dref3 TYPE (g_type1).
        ASSIGN dref3->* TO <fs_dp>.
where g_type1 refers a data type which i defined in the program. g_type1 = ty_addsubty. 
now <fs_dp> refers to an internal table.
now i want to build a field catalog for this internal table.
In my program <fs_dp> structure is not always the same. i.e now it is ty_addsubty but for some other conditions the structure is different.
please help me out.
regards
badri

Here some piece of code, which shows how it works:
<SNIP>
type-pools:
     abap.
DATA:
  lr_tabledescr          TYPE REF TO cl_abap_tabledescr,
  lr_structdescr     TYPE REF TO cl_abap_structdescr.
field-symbols:
  <lw_component>     type abap_compdescr_tab.
TYPES:
     BEGIN OF t_addsubty,
          subty TYPE subty,
          pernr TYPE persno,
     END OF t_addsubty.
TYPES:
     ty_addsubty type t_addsubty occurs 1.
CREATE DATA dref3 TYPE (g_type1).
ASSIGN dref3->* TO <fs_dp>.
lr_tabledescr ?= cl_abap_tabledescr=>describe_by_data( <fs_dp> ).
assert condition lr_tabledescr is bound.
lr_structdescr ?= lr_tabledescr->get_table_line_type( ).
loop at lr_structdescr->components assigning <lw_component>.
*     do whatever you want with the information about
*     the components of the structure
endloop.
</SNIP>
Do not forget to reward points...

Similar Messages

  • Building Field-Catalog for dynamic internal tables

    Hi All,
    I  created a dynamic internal table(<fs_final>,<fs_final_line>)  and populated data into it.Now I want to provide field catalog to these dynamic internal table.
    Can anyone suggest me the how to create a field catalog for existing dynamic internal table.Thanks in advance.
    Regards,
    Chakradhar.
    Moderator message - Please use proper subject line in future.
    Message was edited by: Suhas Saha

    Use this code to get all components of internal table.
    Then build fieldcatlog.
    DATA: tab_return type abap_compdescr_tab,
              components like line of tab_return.
    perform get_int_table_fields using    <fs_it> changing  tab_return.
    loop at tab_return into components.
      wa_fldcat-fieldname  = components-name.               "Field Name
      wa_fldcat-scrtext_m  = components-name.              "Column Heading
      wa_fldcat-inttype    = components-type_kind.     "Data Type
      wa_fldcat-intlen      = components-length.          "Data Lenght
      wa_fldcat-decimals = components-decimals.     "Data Decimal Places
    append wa_fldcat to it_fldcat.
    endloop.
    form get_int_table_fields  using    t_data type any table
                                changing t_return type abap_compdescr_tab.
       data:
       oref_table type ref to cl_abap_tabledescr,
       oref_struc type ref to cl_abap_structdescr,
       oref_error type ref to cx_root,
       text type string.
    *Get the description of data object type
       try.
           oref_table ?=
           cl_abap_tabledescr=>describe_by_data( t_data ).
         catch cx_root into oref_error.
           text = oref_error->get_text( ).
           write: / text.
           exit.
       endtry.
    *Get the line type
       try.
           oref_struc ?= oref_table->get_table_line_type( ).
         catch cx_root into oref_error.
           text = oref_error->get_text( ).
           write: / text.
           exit.
       endtry.
       append lines of oref_struc->components to t_return.
    endform.
    Regards
    Sreekanth

  • Use of field TEXT_FIELDNAME in Field Catalog for ALV

    Hi Experts,
    Could any one pls  tell me the relevance (purpose) of the field TEXT_FIELDNAME in Field catalog for an ALV ?
    How is it different from the fields such as seltext_l, seltext_m, seltext_s ? When is it necessary to assign a value to this field ?
    Thanks & Regards
    Abhijith

    Hi Abhijit
    Refer to the following
    <b>TEXT_FIELDNAME :</b>     Field name of internal table field. You can use this field to define a reference to a field that is used as the description for the current field. If a subtotal is calculated for the current field, the ALV Grid Control displays the descriptions in the field assigned.
    Example: Your output table contains one column for material numbers and one column for the description of what these numbers mean (such as clockwork). If you calculate subtotals for the material numbers, only these numbers are usually displayed as the subtotals text. Based on the link to TXT_FIELD , you can refer to the corresponding column with the material description. This description is then used as the subtotals text.
    <b>SELTEXT_L :</b>      Long key word (40 chars long). Determines the text to be used in the column selection for the column. A value should be assigned to this field if it does not have a Data Dictionary reference.
    <b>SELTEXT_M   :</b>        Medium key word (20 chars long). Determines the text to be used in the column selection for the column. A value should be assigned to this field if it does not have a Data Dictionary reference.
    <b>SELTEXT_S :</b>     Short key word (10 chars long). Determines the text to be used in the column selection for the column. A value should be assigned to this field if it does not have a Data Dictionary reference.
    Award points if found useful.
    Regards
    Inder

  • Need Help in Field Symbol for Dynamically passing  table field value

    Hi All,
    In my internal table I am having data.
    I am dynamically forming table field name and substitute for the another table field name to pass DATA.
    but I am getting the Variable name insted of Value ie Data.
    I am using Field Symbol for this.
    data:
    Field-symbols <TS> type any.
    field1 type string.
    LOOP AT TABLEFIELDS INTO WA_TABLEFIELDS.
                READ TABLE  TEST  WITH KEY NAME = WA_TABLEFIELDS-FIELDNAME.
                IF SY-SUBRC = 0.
                  CONCATENATE 'WA_' WA_TABLEFIELDS-TABNAME '-' WA_TABLEFIELDS-FIELDNAME INTO  Field1.
                  Assign Field1 to <TS>.
                    ALL_VAL-VALUE = <TS>
    "After substituting the <TS>  into ALL_VAL-VALUE  field I need a DATA to be passed but the variable name is appending"*    
             APPEND ALL_VAL.
                ENDIF.
              ENDLOOP.
    kindly how to pass the value into the table.
    Thanks in advance.
    San

    Hi,
    pls assign a break point in
    CONCATENATE 'WA_' WA_TABLEFIELDS-TABNAME '-' WA_TABLEFIELDS-FIELDNAME INTO Field1.
    Assign Field1 to <TS>.
    ALL_VAL-VALUE = <TS>
       " Put a break point here and check for the value in <TS>.
    if <TS> contains value then create a work area for ALL_VAL AND PASS the Field-Symbol to that and then  append thw wa into the table...
    Hope this works out!!
    thanks

  • Add a custom table for field selection while creating field catalog for LIS

    Hi,
    I have a requirement to add a Custom table to be available for field selection while creating a field catalog for LIS. Its required as there are many custom fields to be used for field catalog creation and adding them in one of the existing tables listed is not a feasible option for us. Please let me knw if its possible..?? If yes how to get it done..??
    Regards,
    Akash Sinha

    hi,
    You need to add your field in the Data Dictionary first. For example, if
    you want the new field in the Order Item field catalog do the following.
    Look at structure MCVBAPUSR (SE11). If you already have a user structure
    appended to this structure then you can add your new field to your existing
    structure. If there is no structure already appended to MCVBAPUSR then you
    must create a new structure with your field in it and then append the new
    structure to this one.
    If you look at structure MCVBAP you will see the data appended to the end
    of it.
    Now you should see it in the field catalog.
    regards,
    balajia

  • ALV display using dynamic field catalog and dynamic internal table

    hi ,
    please guide me for ALV display using dynamic field catalog and dynamic internal table.
    Thank you.

    Hi Rahul,
    maybe thread dynamic program for alv is helpful for you. More information about the [SAP List Viewer (ALV)|http://help.sap.com/saphelp_nw70/helpdata/EN/5e/88d440e14f8431e10000000a1550b0/frameset.htm]. Also have a look into the example programs SALV_DEMO_TABLE*.
    Regards Rudi

  • Please tell me how to adjust field width for alv data .

    Hi,
          Please tell me how to adjust field width for alv data . Also i want to remove zeros after decimal coming in field.
    Regards,
    Ranu

    Hello Ranu,
    You need to set OUTPUTLEN field from field catalog table for every column.
    DATA lt_fieldcat TYPE lvc_t_fcat
    DATA lw_fcat type lvc_s_fcat .
    lw_fcat-fieldname = 'BNAME' .
    lw_fcat-inttype = 'C' .
    lw_fcat-outputlen = '12' .  -----> for e.g. set width of column BNAME
    lw_fcat-coltext = 'User Name' .
    lw_fcat-seltext = 'User Name' .
    APPEND lw_fcat to lt_fieldcat .
    Hope this resolves your issue!
    Thanks,
    Augustin.

  • Newly-added field  missing in the field catalog  for NR00

    I  am about to creat condition record for condition type NR00 free goods . I need to make some customizing to meet our requirement .So  I changed  the field catalog for the condition table by adding a new field BWAST  (purchasing document type) . After that I am going to creat a new condition table 501 with this newly-added field ,but I can't find the field in the right part for field catalog .
    Can you give me some advice ?   Thank you in advance.

    I 've got the answers ,  
    Note 21040 - Allowed Fields not appearing for condition table
    thaks

  • What makes a field eligible for selecting data in a subreport?

    Hello,
    I have posted the following question to [StackOverflow|http://stackoverflow.com/questions/4366702/what-makes-a-field-eligible-for-selecting-data-in-a-subreport], but it has so far generated no replies. I decided to cross-post it here to see if I could get a better result.
    The TL;DR of it is that I have a field which I should be able to link in my Subreport, but it does not appear, and I was wondering what I need to do to make it appear.
    I have a Crystal Report I'm trying to recreate from scratch after an update from VS2008 to VS2010 caused it to implode horribly.
    I've gotten most of the way through, but I'm at a stage where I'm linking a field in the Main Report to a corresponding field in the Subreport.
    I have set up a bunch of Database fields in the Subreport, I've added the table I want, TableA, I've linked it up as everything was linked in the original report, with TableA at the head of the linking chain, so that all the rows I want can be derived from the result of that first query ( Actually, all of the links from the original Report were red in the Database Fields linking dialog, whereas mine are a bit rainbow-y. All the links in TableA are red, though... _ )
    In the "Subreport Links" dialog, I have an integer which I know is being pulled from the database correctly. I've added it in the "Fields to link to" listbox, and selected the newly-created parameter in the "Subreport parameter to use" combobox. I've ticked the "Select data in subreport based on field" checkbox.
    The database field I want to link to then does not appear in the second combobox.
    Another integer field in TableA shows up fine in the "Select data..." combobox (and is linked to another field being passed in), so I don't know why these two integer fields, which are equally important, and exist on the same level, on the same table, are being treated differently by the report designed.
    Any ideas what I'm doing wrong?

    Here is what I'd do:
    1) Download CR 2008 eval designer from here:
    http://www.sap.com/solutions/sapbusinessobjects/sme/freetrials/index.epx
    2) Try the linking in CR 2008 designer
    3) If it does not work there, ask why not in the [CR design|SAP Crystal Reports, version for Visual Studio; forum.
    4) If you get the linking working in the CR 200 designer, try to run the report in your VS2010 app (after ensuring the report woks as expected in CR 2008).
    5) If (4) above works out for you, please let me know as this may be an issue with CRVS2010.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Table & Field Name for Plan Data in CO

    Hi All,
    Can anyone tell me the table & field name where we can get the planned data in Cost Center Accounting and Profit Center Accounting.
    I checked out the COSP(which is Totals) and COEP tables for CCA but i could find the fields only for actual data and not planned data.
    Same for PCA...i checked out the GLPCT & GLPCA tables but in vain.
    Regards & Thanks
    Piyush Kothari.

    Hi,
    Thanks for the reply but COKL is only for Activity Type which contains Allocation Cost Elements.
    I would like to have the Table & Field name for Plan data of Primary Cost Element.
    Piyush

  • Unable to find a qualifications catalog for the root object specified-ESS

    Hi SDN,
    We are getting following exception Unable to find a qualifications catalog for the root object specified   when click on Add New Skill in Skills Profile, ESS . It is working fine , if user is assigned sap_all role. This is issue with permissions. Which role need to be assigned to work with Skills Profile in r3. Please help me out.
    regards,
    Sree.

    Have a look in table T77S0 for an entry called QUALI ESSST and make sure the object ID stored there matches the appropriate node in your qualifications catalogue.
    This setting is designed to be used for restricting ESS users to a particular part of the Quals Catalogue.
    If the table entry was configured in your development system, it may not match the obect numbers in your production system.

  • IE07 and error 'Maintain field selection for Fleet data in Equipment List'

    Hi all,
    When running transaction IE07 (multi-level equipment list) , I get the following error:  'Maintain field selection for Fleet data in Equipment List (Multilevel)'
    I can't see where is the missing configuration point.
    We have activated business function LOG_EAM_CI_3.
    Have anyone encountered this error before?
    Thanks,
    P.

    Hi Narasimhan
    Could you give more details ? where is located this setting?
    Thanks,
    P.

  • Internationalization for dynamic data

    HI ..i want to know how to do internationalization for dynamic data that is from database...
    Please let me know
    Thanks in advance
    Rams

    HI
    You can do the trick by extending ResourceBundle (or ListResourceBundle) and write your own handleGetObject and getKeys method.
    But in that case you are forced to create different classes for different locales and follow the naming convention for bundles:
    If your class for the default locale is MyResourceBundle, then for all the other locales you have to create a class called "MyResourceBundle_"+localeName .
    But I don't know how can I bypass this strange behaviour. All the getBundle, and getBundleImpl methods are static. So if a framework call your class through ResourceBundle.getBundle() static method you are forced to do this. If you want to change you have to call your class. So you need to instantiate your ResuorceBundle class yourself.
    Bence

  • Field catalog for internal table in ALV

    In my program the internal table consists many fields from various tables and structure doesn't belong to a single data table.
    In order to get output in ALV grid following FM has been used
    REUSE_ALV_GRID_DISPLAY
    for field catalog the fields are defined specifically.
      l_fieldcat-fieldname  = 'VBELN'.
      l_fieldcat-outputlen  = 10.
      l_fieldcat-seltext_l  = 'Billing doc'.
      l_fieldcat-no_zero = 'X'.
      l_fieldcat-hotspot = 'X'.
      append l_fieldcat to p_fieldtab.
    ..............and so on for all the fields.
    Just wanted to know is there any other method to display all the fields of this internal table automatically so each field is not specified specifically.
    anya

    Hi
    Try this instead:
    *& Form  create_fieldcatalog
    * Create a field catalogue from any internal table
    *      -->PT_TABLE     Internal table
    *      -->PT_FIELDCAT  Field Catalogue
    FORM  create_fieldcatalog
           USING     pt_table     TYPE ANY TABLE
           CHANGING  pt_fieldcat  TYPE lvc_t_fcat.
      DATA:
        lr_tabdescr TYPE REF TO cl_abap_structdescr
      , lr_data     TYPE REF TO data
      , lt_dfies    TYPE ddfields
      , ls_dfies    TYPE dfies
      , ls_fieldcat TYPE lvc_s_fcat
      CLEAR pt_fieldcat.
      CREATE DATA lr_data LIKE LINE OF pt_table.
      lr_tabdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ).
      lt_dfies = cl_salv_data_descr=>read_structdescr( lr_tabdescr ).
      LOOP AT lt_dfies
      INTO    ls_dfies.
        CLEAR ls_fieldcat.
        MOVE-CORRESPONDING ls_dfies TO ls_fieldcat.
        APPEND ls_fieldcat TO pt_fieldcat.
      ENDLOOP.
    ENDFORM.                    "create_fieldcatalog

  • New field in Pricing field catalog for Item category

    Dear SD colleagues,
    We have scenario of maintaining pricing for Lower level BOM component.
    Like:
    Base price - 100/-
    When BOM explodes - 95/-.
    For this, I have taken ABAPer help and inseted a Z field for Item category in Pricing field catalog.
    Then, a new condition table is been generated using ZPSTYV and included in Access sequence. For Base price condition type, we have maintained record in combination with ZBOM-Item category for lower level BOM item.
    A new pricing routine is created in VOFM for Condition value and same is been assigned to Condition type as Alternative calculation type in pricin gprocedure contro data.
    Whe I create Sales order, value based on ZBOM is being pciked up by system.
    request you to please help in this regard.
    Thanks & regards,
    Praveen.

    Hi Marino,
    I have a requirement to determine the pricing based on "Discount Code", which is not a standard SAP field and i would like to have this as a custom field and linked to  customer in custom table.
    Question: When i add a new custom field and custom table for pricing, what are all the things i need to do in terms of ABAP.
    As per my knowledge, below are the steps...Please check and confirm my understanding is correct and let me know if i miss anything.
    1. Create a new field
    2. Create Custome Table
    3. Add field to Field Catlogue KOMG
    4. Add Field to KOMP (as this is item field)
    5. Add code in userexit USEREXIT_PRICING_PREPARE_TKOMP to make the data avaialable - Sales Order
    5. Add code in userexit USEREXIT_PRICING_PREPARE_TKOMP to make the data avaialable - Billing
    Thanks.

Maybe you are looking for

  • Infoset Query Wrong result after removing document number in the drilldown

    Hi Friends, I have 2 oDS,billing ODS and Condition ODS.I have created an infoset query based on these two ODS. From my Billing ODS i need QTY and from Condition ODS i need Value,Discount etc. Since there are more than one record in condition ods for

  • Keynote slides shrunk after moving from iMac to MacBook Air

    After moving a Keynote (6.5.3) presentation from my iMac to MacBook Air, the slides have shrunk WAY down. Check out this image. Any thoughts on why this should happen?

  • JMS (bea 9) redelivery does not work ?

    I'm a bit at a loss. Any help is therefore welcome. I am using Bea 9 and Java 1.5. I have a MDB bean that attempts to transmit data to a foreign site via ftp. When it fails to transmit files, it errors and the message's content (a file) that I attemp

  • Voiceover using FW iSight's mic

    Hi guys, I've transferred some old movies from my brother and I'd childhood into iMovie. I thought it'd be less boring to watch by adding some quips. I have a Firewire iSight alas when clicking on Voicover, no sound is recorded even though:1- iSight

  • Bluetooth doesn't work after sleep mode wake up

    Okay, so my computer goes to sleep while in Windows XP and I wake is up. I have my bluetooth mouse and keyboard hooked up to it and I try to wake them up. My mouse doesn't reconnect. I notice that my computer also says that it's not connected to my w