How to write table name in SQL according to the user input

hi
  i want to select data from a table , and the table name, field name is input by the user, for example, user input table name T1, field name F1 and i want to construct a SQL like select F1 into a_var from T1 . how does the SQL statement written? thanks for your advice.

hi
for ur requirement u should go for field sysmbols...
dynamic internal tables..
u can chk this....
TYPE-POOLS : slis.
PARAMETERS : p_struc LIKE dd02l-tabname.
DATA : it_fieldcat TYPE lvc_t_fcat,
        t_output TYPE REF TO data .
FIELD-SYMBOLS: <t_output> TYPE table ,
               <wa_output> TYPE ANY,
               <fval> TYPE ANY.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
  I_BUFFER_ACTIVE              = I_BUFFER_ACTIVE
   i_structure_name             = p_struc
  I_CLIENT_NEVER_DISPLAY       = 'X'
  I_BYPASSING_BUFFER           = I_BYPASSING_BUFFER
  I_INTERNAL_TABNAME           = I_INTERNAL_TABNAME
  CHANGING
    ct_fieldcat                  = it_fieldcat
EXCEPTIONS
  INCONSISTENT_INTERFACE       = 1
  PROGRAM_ERROR                = 2
  OTHERS                       = 3
IF sy-subrc <> 0.
MESSAGE i000(bctrain) WITH 'MERGE FAILED'.
*ELSE.
MESSAGE i000(bctrain) WITH 'MERGE SUCCESS'.
ENDIF.
CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
ASSIGN t_newline->* TO <fs_dyntable>.
CALL METHOD cl_alv_table_create=>create_dynamic_table
  EXPORTING
   I_STYLE_TABLE             =
    it_fieldcatalog           = it_fieldcat
   I_LENGTH_IN_BYTE          =
  IMPORTING
    ep_table                  = t_output
   E_STYLE_FNAME             =
  EXCEPTIONS
    generate_subpool_dir_full = 1
    OTHERS                    = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ASSIGN t_output->* TO <t_output>.
SELECT * up to 10 rows FROM
   (p_struc)  INTO
   CORRESPONDING FIELDS OF
   TABLE <t_output>.
*write : / 'dynamic table created'.
LOOP AT <t_output> ASSIGNING  <wa_output>.
  DO.
    ASSIGN component sy-index of structure <wa_output> to <fval>.
    IF sy-subrc <> 0.
      WRITE : /.
      EXIT.
    ELSE.
      WRITE : <fval>.
    ENDIF.
  ENDDO.
ENDLOOP.
Message was edited by:
        Premalatha G

Similar Messages

  • How to find table name which provide data for the DataSource

    Hi friends,
    How to find the Table name which providing data for the Business content DataSources (Master Data). Is there any table or Transation which give datasource and Table name at once.
    Thanks&Regards
    Revathi

    Hi Revathi...........
    1)If the datasource is extracting data from any table.................open the datasource using RSO2..........there u will get the table name......
    2) If the datasource is extracting data from any view.............go to RSA2..........copy the view name..........go to SE11 >> give the view name >> and check..........
    3) If Datasource is Function module based............then u hav to check in RSA2 >> give the datasource name >> execute >> there u will find the Extract structure name......Copy the Extract Structure name >> Go to SE11 >> in the Data Element field give the Extract structure name >> Display >> From the Entry Help/Check tab u can get the Table name............
    If u double click on the Extractor..............u will get the Function Module..............from there also u can check that the FM extracting data from which tables............
    For Other datasources also...........u can get the structure name from here........
    4) If the Datasources r LO datasources............then u can get the table name in LBWE.............LO extractor - goto transaction LBWE.................... Select the maintenance link for your datasource............
    here in the right hand pane.........in the drop down box, you can see the structures associated with this extractor ........ just remove the MC for the structure names to get the base table names. e.g. EKKO for MCEKKO.
    5) There is a pattern for the Extract structure name for LO datasources.............for an example..........
    DataSource 2LIS_11_VAITM ......Extract structure name is  MC11VA0ITM
    2LIS_11_VAHDR  >> MC11VA0HDR
    Hope this helps.........
    Regards,
    Debjani.......

  • How to Concatenate Table name and Where condition at runtime

    I am passing parameter as User and Zone to Stored Procedure.How to concatenate Table Name
    and WHERE CONDITION in SQL Statement.i have different type of users and zones.

    Hi !
    declare
      cur sys_refcursor;
      r emp%rowtype;
      v_sql varchar2(512);
    begin
    -- do your logic here
      v_sql := 'select * from emp';
      open cur for v_sql;
      loop
        fetch cur into r;
        exit when cur%notfound;
        dbms_output.put_line(r.ename);
      end loop;
      close cur;
    end;In this example you can see how can be done this with cursor vars .. You should concatenate v_sql string according to your requirements.
    But as in further posts has already been mentioned , be carefull at publishing such kind of procedures and think on security.
    Also when you want dynamicaly change from clause , you should consider using different records to accept data ? Maybe all your tables has the same structure and then this problem will be smaller.
    T
    T

  • How to change table name after creating page and application

    Hi HTMLDB Team,
    i have created a application with page where the region use master detail form with table name emp.Now after developing the page and the application i want to change the table from emp to emp2 where emp2 is the table with same structure of existing emp and same field properties.How can i edit the table as emp2 ?
    Thanks in advance,
    Cheers,
    koushik

    Koushik,
    Depending on the amount of customizations that you did, it may be easier to use the wizard to re-create the master-detail form & report.
    If you still want to give it a go:
    Assuming that you created the 2-page Master Detail report & form:
    On the first page, you will have to chage the SQL to reflect the new table name. Once you do that, you'll have to re-create the link on the EMPID column.
    On the second page, you'll need to do some more work. You'll have to change both Page Rendering Processes: Fetch Row from EMP and Get Next or Previous Primary Key. You'll then need to change the Page Processing Process: Process Row of EMP. Also, ensure that you have a proper Foreign Key relationship between EMP2 and DEPT (or your detail table).
    Thanks,
    - Scott -

  • How get all table name from database

    hi master
    sir
    how get all table name from database

    The big question is 'why'.
    Selecting from view 'dba_tables' will indeed give the list of all tables in the database, but that includes the dictionary tables and the internal tables, and many others that are probably not of interet to a person who needs to ask this question. Besides, the dba_tables view requires access to a DBA account.
    There are several other views: "user_tables" will list all the tables in this user's schema; and "all_tables" will list all the tables this user can access in some way.
    The above do not, of course, include any information about synonyms, sequences, views, indexes and so on.
    The correct answer and the meaningful answer may be two different things.

  • How to find table name for the fields from Standard Extractor in CRM system

    How to find table name of fields from the standard extractor in CRM system ?
    e.g. We use LBWE TCode in R/3 system to find table name for the field from Extractor VCSCL(e.g.).
    Likewise is there any way to find table name for the fields from Standard extractor like 0CRM_LEAD_I.

    Hi ,
    Please find the link below for understanding BW CRM analysis.
    http://help.sap.com/bp_biv135/html/bw.htm
    activate the CRM DSs by scenario:
    1) Activate the application component hierarchy (tcode RSA9). Changes made to the application component hierarchy in the CRM system can be transferred to the BW using the "Edit Application Component Hierarchy" (SBIW - Postprocessing of DataSources).
    SAP Note 434886 must be implemented in CRM 3.0 before the application component hierarchy is activated.
    2) Activate the Business Content DataSources (tcode RSA5).
    Select/enter the application component and choose Execute (F8).
    To compare the shipped and active versions, choose the 'Select Delta' pushbutton. If there is no active version of the DataSource, it is selected automatically.
    To activate the shipped version, choose the 'Transfer DataSources' pushbutton.
    3) Management of the versions of the BW-Adapter metadata (tcode BWA5). All DataSources are displayed that are managed by the BW Adapter.
    As in transaction RSA5 (Service API Metadata Activation), the 'Select Delta' function can be used to select the inactive DataSources or compare shipped and active versions.
    You can also go directly to the screen for maintaining DataSources that are managed by the BW Adapter.
    The 'Compare Version' function makes a detailed comparison of the shipped and active versions.
    All BW-Adapter metadata is considered when versions are compared:
    Header information (Table SMOXHEAD)
    Mapping information (Table SMOXRELP)
    Global selection conditions (Table SMOXGSEL)
    Attribute key fields (Table SMOXAFLD)
    Hope this helps.
    Regards,
    csm reddy

  • How to find Tables names which are updated or inserted data

    Hi,
    I need some help to know.
    I am submitting a form in Oracle OWS (Oracle Workforce Scheduling), but don’t know where exactly data is going in the tables or how many tables are going to updated.
    I want to know the table names which are update after the submitting the form.
    Thanks in advance....
    Regards,
    Saket

    I don't think so. Never heard of Oracle Workforce Scheduling. Is there a forum for that?
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    https://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How to retrive table names with Java?

    Hello!
    If I connect to my Oracle Database 10g Express Edition Instance with some Java code and I run the following code:
                   ResultSet resultSet = databaseMetaData.getTables(null, null, "%", types);
                   while( resultSet.next() )
                        String tableName = resultSet.getString(3);
                        System.out.println(tableName);
    I get loads of different names of tables beside those that belongs to my user like:
    DR$NUMBER_SEQUENCE
    DR$OBJECT_ATTRIBUTE
    DR$POLICY_TAB
    ARTICLES
    BIN$tQZXQ0iGufbgQAB/AQELFg==$0
    BIN$tQZXQ0iLufbgQAB/AQELFg==$0
    But when I log in to http://127.0.0.1:9090/apex I get a perfect list of the tables belonging to the user:
    ARTICLES
    CUSTOMERS
    DATATYPES
    ORDERROWS
    ORDERS
    REQUESTROWS
    REQUESTS
    SUPPLIERROWS
    SUPPLIERS
    Does any one understand how to access just these table names that is created with my user?
    Best regards
    Fredrik

    Hello Adrian!
    Yes you are right I now understand that this is the wrong forum.
    So I posted the "same question" at:
    How to retrive table names belonging only to a user?
    How ever I seems to have problem with the schema name parameter any way.
    Best regards
    Fredrik

  • How to find Table names for PO & Invoices in SRM Standalnoe system SRM 7.0?

    Hi,
    How to find Table names for PO & Invoices in SRM Standalnoe system SRM 7.0? Please let me know.
    Thanks,
    Monica

    Hi,
    In SRM for all objects like SC ( BUS21210),BID,PO(BUS22010),Confirmation (BUS2203),invoice etc all the data stored
    in BBP_PDHGP and BBP_PDBEI  tables only, These is no separate tables..
    for your reference below are the few SRM tables
    BBP_PDACC  Account Assignment 
    BBP_PDATT  Document Attachment 
    BBP_PDBEH  Backend Specific Header Data 
    BBP_PDBEI  Backend Specific Item Data 
    BBP_PDBGP  Partner Extension Gen. Purchasing Data 
    BBP_PDBINREL  Transaction Object Linkage (EBP) 
    BBP_PDHCF  Set for Tabular Customer and Solution Fields on Hdr 
    BBP_PDHGP  Business Transaction Purchasing Information 
    BBP_PDHSB  Bid Invitation 
    BBP_PDHSC  Header Extension for Customer Fields 
    BBP_PDHSS  Hdr Extension for SAP Internal Enhancements (IBUs and so on)
    BBP_PDICF  Set for Tabluar Customer and Solution Fields on Itm 
    BBP_PDIGP  Business Transaction Item-Purchasing Information 
    BBP_PDISB  Bid Invitation/Bid-Specific Item Data 
    BBP_PDISC  Item Extension for Customer Fields 
    BBP_PDISS  Item Ext. for SAP Internal Enhancements (IBUs and so on) 
    BBP_PDLIM  Value Limit 
    BBP_PDORG  Purchasing Organizational Unit 
    BBP_PDPSET  Further Procurement Information 
    BBP_PDTAX  Tax 
    CDCLS  Cluster structure for change documents 
    CDHDR  Change document header 
    CDPOS_STR  Additional Change Document - Table for STRINGs 
    CDPOS_UID  Additional Table for Inclusion of TABKEY>70 Characters 
    CRM_JCDO  Change Documents for Status Object (Table JSTO) 
    CRM_JCDS  Change Documents for System/User Statuses (Table JEST) 
    CRM_JEST  Individual Object Status 
    CRM_JSTO  Status Object Information 
    CRMD_LINK  Transaction - Set - Link 
    CRMD_ORDERADM_H Business Transaction 
    CRMD_ORDERADM_I Business Transaction Item 
    CRMD_PARTNER  Partners 
    SROBLROLB  Persistent Roles of BOR Objects 
    SROBLROLC  Persistent Roles of Business Classes 
    SRRELROLES  Object Relationship Service: Roles 
    Thanks & Regards,
    Prasad S

  • Table name where I can see the Secondary bit map Index for Cube Loads in BI

    Hello Friends I want to know the table name where I can see the Secondary bit map Index that gets created with each request that get loaded to Cube so each 1 request will be multiplied by 7 dimension and 7x1 = 7 local secondary bit map index will be created where is that table which show me that .
    Under Oracle every uncompressed request corresponds to one partition in the
    F facttable of the corresponding infocube. This partition also brings along
    a full set of secondary local bitmap index partitions.
    If you have a cube with 10 uncompressd requests and 10 dimensions (every
    dimension brings with it a local bitmap index) you have 100 partitions for
    the table itself and 10 x 10 index partitions which makes a total of
    100 database objects. where is that table in BI WHICH STORE THIS INFORMATION
    Also if I have E Table with no entries for future 2009 dentries will that be an issue with blank partition ion E Fact table if yes please suggest how to resolve this issue

    Hi Soniya
    Information about BI objects is stored in the RSD* tables. For example:
    Infocubes: RSDCUBE / RSDCUBET
    Aggregates: RSDDAGGR_V / RSDDAGGRT
    You can see information on abap dictionary object as well in transactions SE11 / SE14. You will have to know the real table name of the cube, should be something like /BIC/F* for the uncompressed and /BIC/E* for the compressed table.
    Best regards, Michael

  • Is it possible to have access a table of DB SQL Server for the DB Oracle?

    Is it possible to have access a table of DB SQL Server for the DB Oracle? How?
    Thank you, Paulo.

    You can configure Heterogeneous Distributed Database Systems

  • Table name for shipping details for the given purchase order

    Hi,
    Table name for shipping details for the given purchase order
    regards,
    vijay

    Had anybody seen that this question was raised 5 years ago?
    And the question was about where are the shipping details of a purchase order stored.
    The discussion owner hat marked the the discussion a year ago as solved, but did not mark any correct answer and did not tell himself what the solution was.
    The correct answer was given by Amitkumar yesterday, it is EKPV
    I am locking the discussion to avoid that even more wrong answers are added to this particualr question

  • How to write triggers on startup and shutdown of the server?

    Plz advice.
    How to write triggers on startup and shutdown of the server?
    I could write it but nothing happened!!!

    Small code example for you:
    [email protected]> @ connect mob/mob
    [email protected]> create or replace trigger shutdown_trigger
    2 before shutdown on database
    3 begin
    4 insert into shut_table values(sysdate);
    5 end;
    6 /
    Trigger created.
    [email protected]> create or replace trigger start_trigger
    2 after startup on database
    3 begin
    4 insert into start_table values(sysdate);
    5 end;
    6 /
    Trigger created.
    [email protected]> @ connect "/ as sysdba"
    [email protected]> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    [email protected]> startup
    ORA-32004: obsolete and/or deprecated parameter(s) specified
    ORACLE instance started.
    Total System Global Area 64036368 bytes
    Fixed Size 454160 bytes
    Variable Size 50331648 bytes
    Database Buffers 12582912 bytes
    Redo Buffers 667648 bytes
    Database mounted.
    Database opened.
    [email protected]> select * from mob.start_table;
    START_DAT
    14-SEP-06
    [email protected]> select * from mob.shut_table;
    SHUT_DATE
    14-SEP-06
    Best Regards
    Krystian Zieja / mob

  • The table name or tcode to count the number of Dimensions and Key Figures

    Hi all,
    Do you have an idea about the table name or tcode to count the number of Dimensions and Key Figures of an Infocube WITHOUT installing the cube from Business Content?
    Thanks in adv.
    Ajay

    Hi,
    You can't do that because there's no active table in the system for the Business Content since it hasn't been installed yet...
    One thing you could do is go to the Business Content Tab, select "Infoproviders by InfoArea" on the left side, look for the Cube or DSO you want to check, right click on it and select "Display Description".
    On the window that opens you'll have a list of all InfoObjects and Key Figures. You also have the option to Display it as Start Schema, where you can see the Dimensions, etc.
    Hope this helps.
    Luis

  • How can you segment an audio signal according to the pitch periods?

    hello
    i was wondering if someone could give me some pointers as to how can i segment a sound signal according to the pitch periods present in the signal.i have already estimated the pitch periods and i want now to segment the signal according to those periods and multiply them by a uniform windowing function of twice the segment's length
    anybody can help?
    regards
    madgreek

    Hi madgreek,
    I would highly recommend that you search our Forums and Developer Zone to look for additional help. If you are not able to find any information, you can post your VI and we should be able to troubleshoot the issue.
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies

Maybe you are looking for