How to read the column name of a table from sap system using C#?

Hi!!
I am using SAP .NET connector and creating a windows application.
Now I wanna read the column name when a table name is given....
Connection is done, but I don't know the code to read the column names alone...
Can anyone help me with the code??

fine!!
So if i give the table name, which the RFC_READ_TABLE function module have, will it run properly? or i wanna change all the codes in order to support RFC_READ_TABLE function module?
Because from the beginning I was using BAPI_CUSTOMER_GETLIST function, but my client requirement is to use ERP function module RFC_READ_TABLE, he didn't give any table name also..
This is my code: What I have to change in this???
ECCDestinationConfig ECCDestination = new ECCDestinationConfig();
            RfcDestinationManager.RegisterDestinationConfiguration(ECCDestination);
            RfcDestination rfcDest = null;
            rfcDest = RfcDestinationManager.GetDestination(a);
                RfcRepository repo = rfcDest.Repository;
                IRfcFunction customerList = repo.CreateFunction("BAPI_CUSTOMER_GETLIST");
                IRfcTable addressData = customerList.GetTable("AddressTable"));
                int j = addressData.Metadata.LineType.FieldCount;
                for (int i = 0; i < j; i++)
                    RfcElementMetadata metadata = addressData.GetElementMetadata(i);
                    listallcolumn.Items.Add(metadata.Name);
Message was edited by: Jeswin Rebil

Similar Messages

  • How to display the column names of a table in the output

    Hi,
    I want to display the name of the columns of the table without using literals in a abap report.
    EX: Consider the table KNA1
    KUNNR NAME  ADDRESS
    I want to display the column names in the above fashion without using hardcoded write statements.
    Thanking in anticipation

    You can use this FM <b>DDIF_FIELDINFO_GET</b> It gives you all the names related to fields in a table -:)
    Greetings,
    Blag.

  • How to read the column name of the Table.

    hi
       I have applied sort functionality to the Table columns. It is working fine but I need to read the table column name before sorting ( On which column user trying to sort ).
       Thank you all,
    Rama...

    Hi Alex
       Thank you very much for your valid input.
    But I am facing one problem here. To get sort functionality I added following logic in WDDOMODIFYVIEW method.
      DATA wd_table TYPE REF TO cl_wd_table.
      CHECK first_time = abap_true.
      wd_table ?= view->get_element( 'TABLE_NAME' ).
      wd_this->table_control ?= wd_table->_method_handler.
      wd_this->table_control->set_key_attribute_name( 'COL_NAME1' ).
    here I hard coded first column name(i.e. COL_NAME1). Is it correct?
      and added following code in SORT ACTION of table i.e.
    wd_this->table_control->apply_sorting( ).
    To get column name I am using the method in SORT ACTION of table which you mentioned but always I am getting  COL_NAME1 only....
    Please help me how can I rectify this...
    Thank you
    Rama

  • How to get the Column names of output that is displaying in Sql Developer(Oracle 11g).

    Hi,
        I am using OCCI to interact with DB through code, which means I am writing a vc++ file to interact with Data Base and execute the Stored Procedure which I am calling from the C++ Code. And  also displaying the output of the Stored Procedures to the Front End. I am succeeded in this, but now I should be able to display  the Column names of the output to Front End. Can any one help me on this.
    Example:
    Sno  |   Sname
    ------- |-------------
    1          ABC
    2          DEF
    I am getting (1,ABC) and (2,DEF) as the output of the Stored Procedure but I need the Column names also to display. How to get them.
    Thanks in Advance..:)

    Look at Re: exporting csv via pl/sql - select statement?
    It has an example how to extract the column name from a cursor. You have to check, whether you can use DBMS_SQL.DESCRIBE_COLUMNS
    Your procedure might need another out parameter, that returns the column names , e.g. as comma separated list or as varray.

  • How to find the column name and table name with a value

    Hi All
    How to find the column name and table name with "Value".
    For Example i have value named "Srikkanth" This value will be stored in one table and in one column i we dont know the table how to find the table name and column name
    Any help is highly appricatable
    Thanks & Regards
    Srikkanth.M

    2 solutions by Michaels (the latter is 11g upwards only)...
    michaels>  var val varchar2(5)
    michaels>  exec :val := 'as'
    PL/SQL procedure successfully completed.
    michaels>  select distinct substr (:val, 1, 11) "Searchword",
                    substr (table_name, 1, 14) "Table",
                    substr (t.column_value.getstringval (), 1, 50) "Column/Value"
               from cols,
                    table
                       (xmlsequence
                           (dbms_xmlgen.getxmltype ('select ' || column_name
                                                    || ' from ' || table_name
                                                    || ' where upper('
                                                    || column_name
                                                    || ') like upper(''%' || :val
                                                    || '%'')'
                                                   ).extract ('ROWSET/ROW/*')
                       ) t
    --        where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
           order by "Table"or
    SQL> select table_name,
           column_name,
           :search_string search_string,
           result
      from cols,
           xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
           columns result varchar2(10) path '.'
    where table_name in ('EMP', 'DEPT')
    TABLE_NAME           COLUMN_NAME          SEARCH_STRING        RESULT   
    DEPT                 DNAME                ES                   RESEARCH 
    DEPT                 DNAME                ES                   SALES    
    EMP                  ENAME                ES                   JONES    
    EMP                  ENAME                ES                   JAMES    
    EMP                  JOB                  ES                   SALESMAN 
    EMP                  JOB                  ES                   SALESMAN 
    EMP                  JOB                  ES                   SALESMAN 
    EMP                  JOB                  ES                   PRESIDENT
    EMP                  JOB                  ES                   SALESMAN 
    9 rows selected.

  • How to read the whole name of a music title while scrolling down a list of titles? With the new iOs7 Music App there is no more black box showing the entire name!

    How to read the whole name of a music title while scrolling down a list of titles? The old software-app had the function to click for a longer time on a titles beginning letters until a black box revealed the entire name. I miss this function especially for my classical music, because lots of pieces start with similar words. E.g.:
    "Beethoven: Variations On "Ein Mädchen Oder Weibchen", Op. 66 - Var. 1"
    "Beethoven: Variations On "Ein Mädchen Oder Weibchen", Op. 66 - Var. 2"
    Scrolling in a list of title, I can't distinguish the titles, because just the first words are shown followed by: "...".
    That's horrible!

    Or you could include a width to your body style:
    body {
    background-image: url(Logo/sky1.jpg);
    background-position: center center;
    background-attachment: fixed;
    width: 75%;}
    It might work or not depending on your other color scheme.

  • How to rename the column name in oracle 8i?

    hi,
    Does anyone know how to rename the column name in oracle 8i?My method was drop the relationship key first then delete the old column,finally add the new column.
    Thanks for your replay.
    jing

    There is no facilty to rename a column name in Oracle 8i. This is possible from Oracle 9.2 version onwards.
    For you task one example given below.
    Example:-
    Already existed table is ITEMS
    columns in ITEMS are ITID, ITEMNAME.
    But instead of ITID I want ITEMID.
    Solution:-
    step 1 :- create table items_dup
    as select itid itemid, itemname from items;
    step 2 :- drop table items;
    step 3 :- rename items_dup to items;
    Result:-
    ITEMS table contains columns ITEMID, ITEMNAME

  • How to get the column names of the table into the Dashboard prompt

    how to get the column names of the table into the Dashboard prompt
    Thanks & Regards
    Kishore P

    Hey john,
    My requirement is as follows
    I have created a Rank for Total sales by Region wise i.e RANK(SUM(Dollars By Region)) in a pivot table.
    My pivot table looks like this
    COLUMN SELECTOR: TOTAL US , REGION , DISTRICT , MARKET
    ---------------------------------------------------- JAN 2009          FEB 2009        MAR 2009
    RANK              REGION                  DOLLARS           DOLLARS        DOLLARS DOLLARS
    1 CENTRAL 10 20 30 40
    2 SOUTHERN 10 30 30 70
    3 EASTERN 20 20 20 60
    4 WESTERN 10 20 30 40
    When i select the District in column selector
    Report has to display rank based on Total Sales by District. i.e
    ------------------------------------------------- JAN 2009         FEB 2009       MAR 2009
    RANK             DISTRICT              DOLLARS           DOLLARS        DOLLARS DOLLARS
    for this i need to change the fx of rank i.e RANK(SUM(Dollars By Region)) to RANK(SUM(Dollars By District)) and fx of Region i.e Markets.Region to Markets.District dynamically.
    so , i need to capture column name of the value selected from the column selector and dynamically i need to update the fx 0f RANK & fx of region.
    do you have any solution for this?
    http://rapidshare.com/files/402337112/Presentation1.jpg.html
    Thanks & Regards
    Edited by: Kishore P on Jun 24, 2010 7:24 PM
    Edited by: Kishore P on Jun 24, 2010 7:28 PM

  • Script task to read the column names dynamically and create a table in database based on excel column structure

    Hello,
    Can anyone help me out to write a vb.net script.
    I need to read the column names from excel and based on that column names I need to create a table in database(I have more than one sheet in excel).
    For each sheet columns will be changing and should create a table dynamically for each sheet.
    Any help would be appreciated.

    Refer the below script to read columns in each sheet.
    Dim excelfile As String = Dts.Variables("ExcelPath").Value.ToString
    Dim connectionstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;" +
    "Data Source=" + excelfile + ";Extended Properties=Excel 8.0"
    Dim oledbcon As New OleDb.OleDbConnection(connectionstring)
    oledbcon.Open()
    Dim dt As DataTable
    Dim schemaTable As DataTable
    Dim OLEDBCMD As New OleDb.OleDbCommand
    Dim oledbdatareader As OleDb.OleDbDataReader
    Dim columns As String = ""
    dt = oledbcon.GetSchema("Tables")
    Dim TABCOMMAND(20) As String
    Dim TABCOUNT As Integer = 0
    For Each row As DataRow In dt.Rows
    TABCOMMAND(TABCOUNT) = "SELECT * FROM [" & row.Item("TABLE_NAME").ToString & "]"
    OLEDBCMD.CommandText = TABCOMMAND(TABCOUNT)
    OLEDBCMD.Connection = oledbcon
    oledbdatareader = OLEDBCMD.ExecuteReader(CommandBehavior.KeyInfo)
    schemaTable = oledbdatareader.GetSchemaTable()
    For Each myfield As DataRow In schemaTable.Rows
    For Each myproperty As DataColumn In schemaTable.Columns
    If myproperty.ColumnName = "ColumnName" Then
    columns = columns & myfield(myproperty).ToString & ","
    MsgBox(myfield(myproperty).ToString)
    End If
    Next
    Next
    oledbdatareader.Close()
    OLEDBCMD.Dispose()
    Next
    oledbcon.Close()
    Regards, RSingh

  • How to select even the column names of a table?

    Hello All,
    Is there a way to select even the column names of a table in the select statement?
    My select from a table (say X) is in a SQL* Plus script that gets invoked by application tier and displays data in the application tier window. User's can then copy the data into a spreadsheet and do their processing. However, I need to give them the column names too along with the data.
    Thanks,
    Chiru

    If there is a middle tier that is selecting and
    displaying the data, and that's what the users are
    copying from, the middle tier would have to address
    its presentation of the data to allow users to
    include column names. If this is a common task, the
    application should probably be modified to give users
    the option of downloading the data in a spreadsheet
    directly rather than forcing them to copy and paste
    data.Thanks for the reply.
    The users don't have to copy paste. The application tier has an options in the "Tools" menu item which allows them to copy the entire output to a file (in my case a txt file which is a pipe delimited). Then they have to do text to columns to get the data into each column of the spreadsheet. I could have directly called the stored procedures from the application tier and created ".csv" files and FTP'd them to the user's folders. However, I am having to go this round about because, I am not getting enough support from the LAN team in FTP'ing etc.
    OK I'll think of another workaround.
    Thanks,
    Chiru

  • How to rename a column name in a table? Thanks first!

    I tried to drop a column age from table student by writing the
    following in the sql plus environment as :
    SQL> alter table student drop column age ;
    but I found the following error
    ORA-00905: &#32570;&#23569;&#20851;&#38190;&#23383; (Lack of Key word)
    I have oracle enterprise edition 8.0.5 installed at windows 2000
    thank you
    And I want to know how to rename a column name in a table?
    thanks

    In Oracle 8i, your syntax would have worked.  However, if I
    recall correctly, in Oracle 8.0, you can't rename or drop a
    column directly.  One way to get around that problem is to
    create another table based on a select statement from your
    original table, providing the new column name as an alias if you
    want to change the column name, or omitting that column from the
    select statement if you just want to drop it.  Then drop the
    original table.  Then re-create the original table based on a
    select statement from the other table.  Then you can drop the
    other table.  Here is an example:
    CREATE TABLE temporary_table_name
    AS
    SELECT age AS new_column_name,
           other_columns
    FROM   student
    DROP TABLE student
    CREATE TABLE student
    AS
    SELECT *
    FROM   temporary_table_name
    DROP TABLE temporary_table_name
    Something that you need to consider before doing this is
    dependencies.  You need to make a list of all your dependecies
    before you do this, so that you can re-create them afterwards. 
    If there are a lot of them, it might be worthwhile to do
    something else, like creating a view with an alias for the
    column or just providing an alias in a select.  It depends on
    what you need the different column name for.

  • Set the column name of a table in a list box

    is there any code to set the column name of a table in a list box at oracle devloper 6i?
    pls help.

    I dont want to go for pl/sql . It should work any table.You want Dynamic SQL without using PL/SQL? Tricky. I'm sure there's a possible way using some very complex and convoluted XML functionality of SQL but in reality you are asking for something that isn't natural to SQL queries, especially if you are expecting a dynamic number of columns to be produced for each row of data. SQL expects a table structure, including output formats, to be a defined number of columns with any number of rows, not a defined number of rows with any number of columns.
    Perhaps if you explain why you need this sort of functionality then we may be able to offer a better solution.
    ;)

  • How to read the current selection in a table.

    Hello Experts,
    I've this issue with the web dynpro. I have a Adaptive Webservice Model in web dynpro. And I have three tables in the UI. When a row is selected in the first table, the second table is populated with the appropriate data (using a method in the web service.) the same applies to the third table, when the a row is selected in the second table, the third table has to be populated with the appropriate data. The methods in the web service are all working fine. However, in web dynpro, I am not able to figure out on how I read the selected row in a table. Any information on how to resolve this would be really really helpful.
    <
    wdContext.currentGetMailElement().setProfileID("-Should be read from the selected row in the table.");
    wdThis.wdGetMailControllerController().executeGetMail();
    >
    regards,
    Sam.

    Hi Samuel,
    I didnt clearly understood  your problem. When you are selecting a particular row in a table you are executing a web service named Get Mail. Are you passing any input parameter(any selected row data)  while executing a web service. And when you get the response node where you have a attribute in the node getmail. Am I right.
    If this is the case, then first check if the GetMail node is present or not by comparing it will null or checking its size. If the node is null then you will not get attribute as the element itself is null as nothing is retrieved in response. And if the node is not null then the element at 0th position is selected by default. you can retreieve the attribute by directly using the following code
    if(wdContext.nodeGetMail() !=null)
        String profileId= wdContext.currentGetMailElement().getProfileID();
    Check if this works for you.
    Regards,
    Ardhendu Sarkar

  • Reading csv file how to get the Column name

    Hi,
    I am trying to read a csv file and then save the data to Oracle.
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection c = DriverManager.getConnection("jdbc:odbc:;Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=.;Extensions=csv,txn");
    Statement stmt = c.createStatement();
    ResultSet rs = stmt.executeQuery("select * from filename.csv");
    while(rs.next())
       System.out.println(rs.getString("Num"));
    My csv file looks like this:
    "CHAM-23","COMPANY NAME","Test","12",20031213,15,16
    Number,Environ,Envel,Date,Time
    "1","2",3,"4",5
    "6","7",8,"9",9
    Now is there anyway using the above code I start processing the file from the second row that holds the names of the columns and skip the first row. And also can I get the name of the column using ResultSet something like:
    if columnName.equals("Number")
    Because I may have a csv file that could have more columns:
    "CHAM-24","COMPANY NAME","Test","12",20031213,16,76
    Number,Environ,Envel,Date,Time,Total,Count
    "1","2","3","4","5",3,9
    "6","7","8","9",9",,2
    So I want to get the column name and then based on that column I do some other processing.
    Once I read the value of each row I want to save the data to an Oracle Table. How do I connect to Oracle from my Application. As the database is on the server. Any help is really appreciated. Thanks

    The only thing I could think of (and this is a cluj) would be to attempt to parse the first element of each row as a number. If it fails, you do not have a column name row. You are counting on the fact that you will never have a column name that is a number in the first position.
    However, I agree that not always placing the headers in the same location is asking for trouble. If you have control over the file, format it how you want. If someone else has control over the file, find out why they are doing it that way. Maybe there is a "magic" number in the first row telling you where to jump.
    Also, I would not use ODBC to simply parse a CSV file. If the file is formatted identically to Microsoft's format (headers in first row, all subsequent rows have same number of columns), then it's fine to take a shortcut and not write your own parser. But if the file is not adhering to that format, don't both using the M$ ODBC driver.
    - Saish
    "My karma ran over your dogma." - Anon

  • To read the column names of an internal table

    Hi ,
    I want to read the column/field names of an internal table into another internal table.
    How can this be done?
    Kind Regards,
    hgarsht Rungta

    Hi ,
    you can get the attributes of any internal table into another ..
    check the following code ..
    DATA : it_mara TYPE STANDARD TABLE OF mara  WITH HEADER LINE.
    DATA : it_detail   TYPE abap_compdescr_tab,
               wa_comp TYPE abap_compdescr.
    DATA : ref_descr TYPE REF TO cl_abap_structdescr.
    ref_descr ?= cl_abap_typedescr=>describe_by_data( it_mara ).
    it_detail[] = ref_descr->components .
    loop at it_detail into wa_comp.
    write:/ wa_comp-name .
    endloop.
    Regards,
    Rajesh Kumar

Maybe you are looking for

  • Variable column header in table control

    Hi all, I need a variable column header text in table control. I am doing the following but is not working, I have deleted the header field that the wizard created me thorugh a internal table, and put a I/O field instead. I have assigned a variable i

  • BAPI to create output messages in material document?

    Our stores manager has a list of material documents which require a repeat output. There are far too many for someone to manually go into each document and create a new message in the output options. Is there a BAPI or transaction which can be used t

  • Steps to configure printer

    Hi, I need to configure Printer for the SAP Server Please let me knwo the link for any documents

  • Date/Timestamp

    Hi I have a column with datatype VARCHAR2(50). The Data inside this column is as below 2012-05-15 23:50:04.250 2012-05-15 23:52:48.023 2012-05-15 23:53:11.043 2012-05-15 23:53:58.477 I want to insert this data into another table having datatype as DA

  • I am unable to connerct to the internet in my house and was previously able to do so

    I am unable to connect to the internet in my home and was previously able to do so. can you help?