How do I read the metadata of an object in abap?

I need to find a way to read the metadata of an object (say an internal table) in abap.  An example of what I am looking to do is that I want to get a list of all the column names of an internal table.  Any help would be greatly appreciated!
Dustin

Sure, use this function.
TYPES: BEGIN OF type_item,
       f1 TYPE char30,
       f2 TYPE char30,
       f3 TYPE char30,
       f4 TYPE char30,
       END OF type_item.
DATA:  lineitems TYPE TABLE OF type_item WITH HEADER LINE,
       fieldlist TYPE TABLE OF rstrucinfo WITH HEADER LINE.
DATA:  syrepid TYPE sy-repid.
syrepid = sy-repid.
* gets all of the components of a structure
CALL FUNCTION 'GET_COMPONENT_LIST'
  EXPORTING
    program    = syrepid
    fieldname  = 'lineitems'
  TABLES
    components = fieldlist.
LOOP AT fieldlist.
  WRITE:/ fieldlist-compname .
ENDLOOP.
Regards,
Rich Heilman

Similar Messages

  • How to read the metadata in the SWF ?

    Hi,
    Is there anyway to read the metadata which we are adding to swf as a file info in the Publish Settings.
    I just want to know that, this metadata added to the swf header ?
    Thanks.

    Hi
    look at this thread your problem is solved here
    File Adapter
    Regards
    Abhishek
    Edited by: Abhishek Agrahari on Dec 16, 2008 11:37 AM

  • How do I read table metadata?

    Hi
    Can anyone advise me how to read the metadata in through a JDBC connection?
    Specifically I am connecting to a DB2 database and reading in the table names for a given schema from the table: -
    // Connect to DB and read in the table names
    stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT NAME FROM SYSTOOLS.HMON_ATM_INFO WHERE SCHEMA = '" + schema + "'");
    while(rs.next()){
    tblNames.add(rs.getString("NAME"));
    Now I want to iterate through my ArrayList tblNames and use each table name to query each table's metadata, specifically the name of each field in the table and its datatype and size. Is it possible to do this through the getMetaData call something like this: -
    // Got the table names so read the table metrics
    Iterator<?> tnms = tblNames.iterator();
    while(tnms.hasNext()){
    String[] types = {"NAME"};
    String tableName = (String)tnms.next();
    DatabaseMetaData dbmd = conn.getMetaData();
    rs = dbmd.getTables("", schema, tableName, types);
    Thanks in advance
    Brad

    OK found how to do it in case anyone else is looking I will answer this myself: -
    package db_tools;
    import java.sql.Connection;
    import java.sql.DatabaseMetaData;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import java.util.Iterator;
    * @author brad
    public class Db2MetricsManager {
         // jdbc Connection
         private Connection conn = null;
         private ArrayList<String> tblNames;
         // Constructors
         Db2MetricsManager(){
         Db2MetricsManager(Connection conn){
              this.conn = conn;
              tblNames = new ArrayList<String>();
         // Methods
         public ArrayList<String> getTableNames(){
              return tblNames;
         public void readTableMetricsBySchema(String schema){
              Statement stmt = null;
              try{
                   // Connect to DB and read in the table names
                   String[] types = {"TABLE"};
                   DatabaseMetaData dbmdt = conn.getMetaData();
                   ResultSet rst = dbmdt.getTables(null, schema, "%", types);
                   while(rst.next()){
                        tblNames.add(rst.getString("TABLE_NAME"));
                   // Got the table names so read the table metrics
                   ArrayList<String> columns = new ArrayList<String>();
                   Iterator<?> tnms = tblNames.iterator();
                   while(tnms.hasNext()){
                        String tableName = (String)tnms.next();
                        System.out.println("TABLE_NAME = " + tableName);
                        DatabaseMetaData dbmd = conn.getMetaData();
                        ResultSet rsc = dbmd.getColumns(null, schema, tableName, "%");
                        while(rsc.next()){
                             String cn = rsc.getString("COLUMN_NAME");
                             System.out.print("COLUMN_NAME = " + cn);
                             String dt = rsc.getString("TYPE_NAME");
                             System.out.print("\t\tTYPE_NAME = " + dt);
                             int cs = rsc.getInt("COLUMN_SIZE");
                             System.out.print("\t\tCOLUMN_SIZE = " + cs);
                             System.out.println();
                             /** TODO Create a UDT to hold the metadata and add to a collection */
                        System.out.println();
              catch (SQLException sqle){
                   System.err.println(sqle.getMessage());
              finally{
                   if(stmt != null){
                        try{stmt.close();}catch(Exception e){};
    }

  • How can we read the screen field values from the report selection screen wi

    Hi expart,
    How can we read the screen field values from the report selection screen with out having an ENTER button pressed  .
    Regards
    Razz

    use this code...
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.
    **Read the Values of the SCREEN FIELDs
    CALL FUNCTION 'DYNP_VALUES_READ'

  • How can I read the bootstrap files and extract the fragment-URLs and fragment-numbers in plain text?

    How can I read the bootstrap files of any HDS Live stream and extract the fragment-URLs and fragment-numbers in plain text?
    Could it be that it is some kind of compressed format in the bootstrap? Can I uncompress it wirh  f4fpackager.exe? Could not find any download for f4fpackager.exe. I would prefere less code to do so. Is there something in Java of JavaScript, that can extract the fragment-numbers?
    Thank you!

    Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
    Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave.

  • How can I read the trace data from Agilent(HP​)8510C in C++ using NI488.2 and PCI-GPIB ?

    Hello! I am trying to develop an application in C++ for measurements with Agilent(HP) 8510C network analyser using NI488.2 and National Instrument's PCI-GPIB card. In HPBASIC the trace data is read using OUTPDATA command which contains PREAMBLE, SIZE and then the data string in real and imaginary pair for the required points. The ibrd function gives data only for one point. Kindly guide me how I can read the whole trace and and separate out the real and imaginary data values. Regards, kapil

    Hey Kapil,
    It seems that in HPBASIC you were using an instrument driver for the 8510C. OUTPDATA is not a native HPBASIC function. National Instrument has similar instrument drivers for LabVIEW and CVI.
    http://zone.ni.com/idnet97.nsf/9b2b33e1993d8777862​56436006ec498/7b235254f3881ddb862568ab005fbd2e?Ope​nDocument
    http://zone.ni.com/idnet97.nsf/9b2b33e1993d8777862​56436006ec498/24ca7db880ab78ae862568ab005fbc0f?Ope​nDocument
    For example in the CVI instrument driver you will find a source file called hp8510.c. In the source code you will find a function called hp8510c_dataInRaw that sounds similar to the function that you described.
    Note that this example is designed for CVI, but it is possible that you could extract the information you need for C++. If
    you had a copy of CVI you could just add the files downloaded from the instrument driver to a project and then compile and run the project. It already contains a ready to run example that allows you to capture data and use your instrument.
    If you want try CVI you can download an evaluation copy on-line at http://ni.com/lwcvi/launch.htm.
    I hope this helps out,
    JoshuaP
    National Instruments

  • How can I read the printer snapshot file printers.xml

    How can I read the printer snapshot file printers.xml

    XML files are typically viewed using a web browser.
    Open the XML file and the default program should open it automatically.  If you are prompted to select a program, use the option that lets you choose a program and brows through the directories for your browser (for example, use Internet Explorer, Firefox, etc.).
    If need be, you should be able to right-click the file and select open with to choose the program to open it with.
    There are other XML viewers out ther, but web browsers are typically the default as XML is a web language.
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • SapScript, How do I read the current line number?

    I have sections of text - each in it's own element with an 'include' of the standard text.
    These sections are variable in size.
    All elements are in the MAIN window.
    I do not want a paragraph to split over two pages.
    How do I read the current line number within the sapscript before the section prints so I can issue a new-page command at the beginning of the paragraph?
    Thanks!

    Yes, that does work for paragraphs.
    If I have multiple elements to print from within a loop where "at first, at each and at last" each call the Sapscript funtcion write_form - how can I keep the whole section together.  protect/endprotect will keep each element together but not the group of elements.
    There must be a way to find the current line number.

  • How can I read the EXCEL file while Program is running in background.

    Hi all Expert,
    How can I read the EXCEL file while Program is running in background.
    Thanks

    you need to place ur excel file on application server and follow this thread: Reading an Excel file from the application server?
    loots of information if you can search forum.. thanks

  • How do I read the selected value of a comboBox?

    I need to send the selected value of a comboBox in an HTTPService request. How do I read the selected value (not label or item or index) from the comboBox?

    > (not label or item or index)
    I suspect 'item' is what you need actually. Specifically the 'selectedItem' property which returns the whole of the selected object from your dataprovider. From that you can then extract the selected object's properties.
    e.g.  selectedValue = myComboBox.selectedItem.value;
    The example in tour-de-flex shows this - note:  'data' in that example is i think what you call 'value'.
    http://tourdeflex.adobe.com/flex4.0/ComboBox/sample.html  (right-click to view source)
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/suppor tClasses/ListBase.html#selectedItem
    hth
    Paul Evans
    http://www.creative-cognition.co.uk/
    http://blog.creacog.co.uk/

  • How can i read the data fromtext fieldsin the form of bytes??

    Hi friends,
    How can i read the data fromtext fieldsin the form of byte string while using Socket connection.
    I have two text fields. i need to send the data from the textfeilds to the server using a byte string.
    Can anyboday help me???
    KK

    Does <cfdbinfo> work for Access DBs?
    You might be better off asking this on a MS Access forum.  It's more of an Access issue than a CF one.
    Adam

  • How can I read the trace data into LabVIEW for E5071B

    HI 
    I am setting up the measurement using vector network analyzer (VNA) E5071B controlled by NI 488.2. How can I read the trace data into LabVIEW and display on the graph? If anyone having an idea or know well about this process please give me the suggestion, I will much appreciate it.
    Many Thanks

    You want to start with the driver
     In case you do not know it, you can do the driver search in LabVIEW from Tools>Instrumentation>Find Instrument Drivers. You might also want to bookmark the Instrument Driver Network for information on what a driver is and how to use it.

  • How can I read the image from database into form

    hi everyone
    if I have table like this
    create table test
    (id number(10),
    pic long raw);
    in this table record
    in form If I have block non database
    how can i read the image into non database item
    I try with this code but no good
    select pic into :photo from test where id=5;
    photo its non database item kind image
    how can i invoke image into item
    thanks alooooooot

    Hello,
    You can't select image with select query. You need to create another database block from test table which has item binds with database pic column. Now in where condition in test block's property you have to write id=5. Change test block's properties UPDATE ALLOWED, INSERT ALLOWED, DELETE ALLOWED to NO. Only Query allowed property set to YES.
    Now in your particular trigger write the code
    GO_BLOCK('test');
    Execute_Query;
    please mark if it help you or correct
    Regards,
    Danish

  • How do you read the camera position in the 3d picture control?

    Hello,
    There is a method to setup the camera position, but how do you read the current camera position?  e.g. the user uses the mouse, ctrl, and shift, to change the camera position.  How do you read this new camera position?  There don't seem to be any properties to do this.
    I've read this thread:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=214629&requireLogin=False
    but the question was never answered....
    From the comments in that thread, even if you had the proper documentation for the "Model Matrix" property, you couldn't get the information necessary to calculation the camera position.

    Lorielle,
    Thanks for the VI.
    Could you point me towards a more detailed description of the "Modelview Matrix" property?  I've attached a screenshot from the online help.  It is not very helpful.
    Attachments:
    Modelview Matrix.jpg ‏71 KB
    Modelview Matrix1.jpg ‏71 KB

  • HT4587 How do you read the Serial Number on the back of the Airport Express? It is sop small and silver writing on hite background?

    How do you read the Serial Number on the back of the Airport Express? It is sop small and silver writing on white background?

    http://support.apple.com/kb/ht3546

Maybe you are looking for