Dynamic table  selection from database

Hi ;
I want to create  variable field that I will use at database selection.I tried to do it with   select *  from ( tabname )..... but I couldn't do it how you any offer fot this issue.

Hi,
DATA FCAT1 TYPE LVC_T_FCAT."fieldcat of type internal table
DATA:DYN_ITAB TYPE REF TO DATA,"holding the dynamic internal table
WA TYPE REF TO DATA."holding the wa for dynamic internal table
FIELD-SYMBOLS: <DISP_TABLE> TYPE TABLE,
<WA> TYPE ANY.
SELECT SINGLE tab_name FROM table INTO DB_TABLE.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          I_STRUCTURE_NAME = DB_TABLE
        CHANGING
          CT_FIELDCAT      = FCAT1[].
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE"creating dynamic internal table using fieldcat
    EXPORTING
    IT_FIELDCATALOG = FCAT1[]
    IMPORTING
    EP_TABLE = DYN_ITAB.
    ASSIGN DYN_ITAB->* TO <DISP_TABLE>."creating internal table by refering the dynamically generated internal table structure
    CREATE DATA WA LIKE LINE OF <DISP_TABLE>."creating work area for the internal table
    ASSIGN WA->* TO <WA>.
    SELECT * FROM (DB_TABLE) INTO <WA> UP TO MAX_HITS ROWS."filling the internal table
    APPEND <WA> TO <DISP_table>.
    ENDSELECT.
<b>REWARD ALL HELPFUL ANSWERS.</b>
rgds,
bharat.
Message was edited by:
        Bharat Kalagara

Similar Messages

  • Dynamic record deletion from database table

    Hi,
    I need to delete selected records from database table(dynamic names). Table names are being passed from main program with some of their field names. The record to be deleted from the database table is being decided based on the fields passed for the table and their contains passed from the main program.
    It is not possible to write dynamic where clause for DELETE statement directly.
    So, I created a dynamic internal table and i am trying to fetch all records using SELECT statement(for which we can write dynamic where condition, something like...SELECT...WHERE (itab).  ) which need to be deleted in the iternal table.
    Piece of code :
              CONCATENATE c_im v_tablefield1 INTO v_imprtfield1.
              CONCATENATE v_tablefield1 c_in v_imprtfield1
                       into s_condition separated by space.
              APPEND s_condition TO t_condition.
              PERFORM GET_DYNAMIC_ITAB USING s_flds_agtab-tabname
                                    changing t_itab.
              ASSIGN t_itab->* TO <itab>.
    *Select the data (to be deleted) from the database table
               SELECT * FROM (s_flds_agtab-tabname) INTO TABLE <itab>
                 WHERE (t_condition).
    *Delete the records from the table
               IF SY-SUBRC = 0.
                 DELETE (s_flds_agtab-tabname) FROM TABLE <itab>.
               ENDIF.
    Here t_condition is of standard table of WHERETXT.
    t_condition at the run time before giving dump was:
    SPART IN IM_SPART
    AND KUNNR IN IM_KUNNR
    Here IM_SPART is renge type of SPART and IM_KUNNR is renge of KUNNR.
    I am getting a DUMP:
    The WHERE condition has an unexpected format.
    Error analysis                                                                               
    The current ABAP/4 program attempted to execute an ABAP/4 Open SQL
    statement containing a WHERE condition of the form WHERE (itab) or
    WHERE ... AND (itab). The part of the WHERE condition specified at
    runtime in the internal table itab contains the operator         
             IN (v1, ..., vn)                                        
    in incomplete form.                                              
    How to correct the error
    If the error occurred in a non-modified SAP program, you may be  
    able to find a solution in the SAP note system.                  
    If you have access to the note system yourself, use the following
    search criteria:                                                 
    "SAPSQL_IN_ILLEGAL_LIST"                               
    "SAPLZSD_TAB_REFRESH " or "LZSD_TAB_REFRESHU01 "       
    "Z_SD_REFRESH_AGTABLES"                                
    If you cannot solve the problem yourself, please send the
    following documents to SAP:                             
    I would like to know whether "IN" operator is allowed in (itab) of WHERE clause. While testing I changed the "IN" to "=" specifying a suitable value there. It worked. So please let me know if i can give "IN" operator using renge table in the dynamic where clause.
    Thanking you,
    Surya

    Hi again,  so if you can not use the IN in a dynamic where clause you might be forced to dynamically build the entire select statement,  Here is a sample program which may give you some ideas, notice that we are writing the select statement code, putting it in another program and generating the subroutine at runtime, then call this routine.  I'm sure that this will help you see what you need to do.
    report zrich_0003 .
    tables: kna1.
    types: t_source(72).
    data: routine(32) value 'DYNAMIC_SELECT',
                 program(8),
                 message(128),
                 line type i.
    data: isource type table of t_source,
                xsource type t_source.
    ranges:
            r_kunnr for kna1-kunnr.
    data: ikna1 type table of kna1.
    data: xkna1 type kna1.
    r_kunnr-sign = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low    = '0001000500'.
    append r_kunnr.
    xsource = 'REPORT ZTEMP.'.
    insert xsource  into isource index 1.
    xsource = 'FORM dynamic_select'.
    insert xsource  into isource index 2.
    xsource = 'Tables r_kunnr ikna1.'.
    append xsource to isource.
    xsource = 'select * into table ikna1 from kna1'.
    append xsource to isource.
    xsource = 'where kunnr in r_kunnr.'.
    append xsource to isource.
    xsource = 'ENDFORM.'.
    append xsource to isource.
    generate subroutine pool isource name program
                             message message
                             line line.
    if sy-subrc = 0.
      perform (routine) in program (program) tables r_kunnr
                                                    ikna1.
    else.
      write:/ message.
    endif.
    loop at ikna1 into xkna1.
      write:/ xkna1-kunnr.
    endloop.
    Regards,
    Rich Heilman

  • Dynamic parameter selection from infoview not storing the sql password

    We are having the problem of dynamic parameter selection from infoview not storing the sql password as it does for the actual report. We are using Crystal Reports XI Release 2 version 11.5.3.438 (Not sure of SP level, asked in separate thread).
    To be more specific.
    We have created a report that dynamically populates the parameters of the report by pulling the records from the Informix sql database and allowing selection from there.
    In the Central Management Console for the report object we have set as follows:
    Process - Database:
    Use original database logon information from the report - the sql username and pw etc
    Use same database logon as when report is run
    Process - Parameters
    In selecting a default selection there is the option to put in the sql password, however, this does not stick and clears after update.
    As such the end result is that every time this report is run from infoview and a user chooses a parameter (there are 5), crystal goes through some timeout for about a minute or so and then requests the sql password, if a user then selects the next parameter, the same timeout and password dialog appears.
    We need the crystal report to handle to the sql password for fetching the parameters as well as for the database section of running the report, however, the parameters insists on the end user always putting the password in.
    This is 100% replicatable on our system.
    Any way that we can fix this?
    Will an update fix this issue? If so could you please advise which one?
    Thanks

    Hi,
    I am having the exact same problem. Any help?
    And what does "Use same database logon as when report is run" mean? For me that would be that no prompt is needed for getting values in a dynamic parameter...
    Regards
    Magnus

  • LTR - Error occurred when selecting from database

    Hi,
    We created couple of configurations using LTRC in our SLT systems. When i try to check these in transaction LTR, they are not displayed, just getting the error - Error occurred when selecting from database (Attached screenshot). All the required SICF for SLT has already been activated. Any suggestions how to fix this issue?
    Thanks,
    Saravanan

    Hi Experts,
    Did anybody get the solution of this error ,if yes please reply?
    I am getting below error when I am refreshing the current config or creating a new one in LTR
    " Error occurred when selecting from database"
    Thanks for your help,
    Balwant

  • Dynamic data select from table is giving dump

    Hello Experts,
       Below statement is giving Dump after it move all the data in my dynamic table.
    When i see in debug. All my recored are avilable in <T_TAB> Table.
    SELECT * FROM (pa_tab) INTO CORRESPONDING FIELDS OF TABLE <T_TAB>.
    > IF SY-SUBRC = 0.
    Information on where terminated
    The termination occurred in the ABAP program "ZFIR_ZTABLE_UPLOAD" in
    "F_DOWNLOAD".
    The main program was "ZFIR_ZTABLE_UPLOAD ".
    The termination occurred in line 403 of the source code of the (Include)
    program "ZFIR_ZTABLE_UPLOAD"
    of the source code of program "ZFIR_ZTABLE_UPLOAD" (when calling the editor
    4030).
    Processing was terminated because the exception "CX_SY_OPEN_SQL_DB" occurred in
    the
    procedure "F_DOWNLOAD" "(FORM)" but was not handled locally, not declared in
    the
    RAISING clause of the procedure.
    The procedure is in the program "ZFIR_ZTABLE_UPLOAD ". Its source code starts
    in line 399
    of the (Include) program "ZFIR_ZTABLE_UPLOAD ".
    please help me.
    Regards,
    Amit
    Message was edited by:
            Amit Gupta

    Hi Amit,
    Check if you are doing the following in your program
    FIELD-SYMBOLS <T_TAB> TYPE STANDARD TABLE.
    DATA: g_tabref type ref to data.   "Reference to your table structure
    CREATE DATA g_tabref type standard table of (pa_tab).
    ASSIGN g_tabref->* to <T_TAB>.
    SELECT * FROM (PA_TAB) INTO TABLE <T_TAB>.
    Hope this solves your problem.
    Let me know if you require any further info.
    Enjoy SAP. Reward points of useful
    Rajasekhar

  • Dynamic table pulled from SQL database, Need to Search

    My table results are not static, they are pulled into a
    dynamic table from a SQL database. Each table displays 10 records
    with an option at the bottom to display additional records
    (next/previous), for my query. I also have an option set up to
    allow users to click for a detail view of a record in the table. If
    the table data was static, I would be able to set up a search
    option and a results page for it, but I'm dealing with dynamic data
    on an .ASP page. I'd like to set up a search box to limit the
    records displayed in the table. I haven't found any code samples
    that are designed for dynamic data.
    Here is a copy of the code from my table.

    Hi,
    I think the code on this URL will get you the solution
    http://www.asp.happycodings.com/Array/code3.html
    Cheers,
    ~Maneet

  • Why does "SELECT * FROM [database].[schema].[table]" not work in Azure ?

    Hi all
    In Microsoft Azure I have 2 databases.
    I work since more than 10 years with T-SQL and I always use
    fully qualified object names, means "[database].[schema].[table]".
    When I now make a connection to my database "A" in Azure and
    write a Query against database "B" ("SELECT * FROM [B].[schema].[table]")
    I get an exception. Of course when I connect to database "B" it works
    but again not to database "A". When I use "SELECT * FROM [schema].[table]"
    with the right database connected, it also works in Azure.
    Hope you understand what I mean :-)
    In MS-SQL, this of course works fine.
    Well my question is: What sense does this make ??
    Do I now have to re-write everything just for azure or will this behavior changed sometimes ?
    I know MS-SQL is not the same like Azure-SQL, but hey; does Microsoft think all projects have only one database ?? :-)
    Thanks for any answer
    Frank

    Hi Frank,
    According to your description, you want to retrieval data cross database in SQL Azure, right?
    As June said, Currently cross database joins are not supported in SQL Azure. Also you cannot change database mid query so you cannot, for example, put a USE [MyDB] in your query either. Please refer to the link below to see the details.
    http://www.britishdeveloper.co.uk/2011/11/cross-database-joins-in-sql-azure.html
    If you have any concern about this behavior, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product. Your feedback enables Microsoft to make software and services the best that they can be, Microsoft might consider to add this feature
    in the following release after official confirmation.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Selection from database tables

    Hi Experts,
    In one program I'm selecting data from tables <b>VBAK, VBAP,VBRK,VBRP,LIKP,LIPS</b>. As the tables have huge data, it's taking forever to get the data into internal tables.
    Could you please suggest  me to better the performance.
    Thnx much.

    hi dev,
      do not use select .. endselect statement and include all the key fields in your select statement.
    instead of select .. endselect statement use
    select * from <table> into table itab where < conditions)
    Regards,
    Santosh
    Message was edited by: Santosh Kumar P

  • Dynamic SQL select from unknown table until runtime

    I need to do a select from a table that is unknown until runtime. Is there any good examples of this. The Store Procedure will take in the table name and return a row.
    I am not using inline SQL because there is a lot more complexity involved . What I need to do is understand how to reference this unknown table.
    Here is an example of what I have written so far.
    PACKAGE pk_LoadNativeDataItems IS
    PROCEDURE version;
    TYPE RowDataCur IS REF CURSOR;
    PROCEDURE pr_LoadNativeDataItems(p_flag IN NUMBER
    p_how_many_rows_to_fetch IN NUMBER,
    p_row_data OUT RowDataCur);
    PROCEDURE pr_LoadNativeDataItems(p_flag IN NUMBER
    p_how_many_rows_to_fetch IN NUMBER,
    p_table_name IN VARCHAR,
    p_row_data OUT RowDataCur) IS
    BEGIN
    OPEN p_row_data FOR
    SELECT * from ||p_table_name||;
    END pr_LoadNativeDataItems;
    END pk_LoadNativeDataItems;
    Thanks for any help
    Tony

    Here is example for similar question:
    Using variables for tables and columns

  • How to save values form all row in dynamic table into mysql database?

    hello guys..
    i got some problem on developing expert system using adobe dreamweaver and mysql.
    i've create a dynamic table and have some value from different row. i want to save values from all row to mysql database.. unfortunately.. i'm failed to do that.. for now, i just can save value from first row.
    kindly you can help me to solve this problem.. or maybe there is any tutorial i can follow..
    thank you in advance.
    this is my script for dynamic table
    <table border="1" cellpadding="1" cellspacing="1">
      <tr>
        <td>namaSoalan</td>
        <td>jaw</td>
      </tr>
      <?php do { ?>
        <tr>
          <td><?php echo $row_Recordset1['namaSoalan']; ?></td>
          <td><label for="9"></label>
            <select name="9" id="9">
              <option value="value" <?php if (!(strcmp("value", $row_Recordset1['namaSoalan']))) {echo "selected=\"selected\"";} ?>>sila</option>
              <option value="" <?php if (!(strcmp("", $row_Recordset1['namaSoalan']))) {echo "selected=\"selected\"";} ?>>ya</option>
              <option value="0" <?php if (!(strcmp(0, $row_Recordset1['namaSoalan']))) {echo "selected=\"selected\"";} ?>>tidak</option>
            </select>       
            <label for="u"></label></td>
        </tr>
        <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
    </table>

    dear bregent and SnakEyez02.
    i have create 2 table, which is soalan table and temporary table.
    user will answer all the question. either 'ya' or 'tidak'..
    each answer have different value..
    this value store permanently in soalan table..
    this value i want save to temporary table too.
    for now, i success only save for the first row but i want save for all..
    anybody please help me..

  • Dynamically fetch data from database and display it in the report

    Hi,
    We have a requirement in developing a report which needs us to dynamically fetch data from the database and display it in the report.
    We have a column called WORKER in the report.
    For each worker there is a measure(PSA) associated with it.
    In the report we have to display both the WORKER and the PSA column.
    What we want is, when we display the list of the workers, the corresponding workerid_id of the worker will be passed and the value of his PSA will be fetched from the database and displayed in the report.
    Or anything similar to this.
    We also have drill applied on this WORKER column. So after any drill up or drill down also the value for PSA should change.
    Is there any way of doing this?
    Please help if possible.
    Thanks,

    hi,
    data : count type i value 0.
    data : Begin of itab occurs 0 ,
    plan_version like hrhap-plan_version,
    APPRAISAL_ID like hrhap-APPRAISAL_ID,
    AP_START_DATE like hrhap-AP_START_DATE,
    AP_END_DATE like hrhap-AP_END_DATE,
    AP_STATUS like hrhap-AP_STATUS,
    AP_STATUS_SUB like hrhap-AP_STATUS_SUB,
    OBJ_DATE_SET like hrhap-OBJ_DATE_SET,
    REVIEW_DATE_SET like hrhap-REVIEW_DATE_SET,
    AP_DATE_SET like hrhap-AP_DATE_SET,
    AP_DATE_EARLIEST like hrhap-AP_DATE_EARLIEST,
    AP_DATE_LATEST like hrhap-AP_DATE_LATEST,
    CHANGE_DATE like hrhap-CHANGE_DATE,
    CHANGE_TIME like hrhap-CHANGE_TIME,
    CHANGE_USER like hrhap-CHANGE_USER,
    end of itab.
    <b>select * from hrhap into corresponding fields of table itab.</b>
    loop at itab.
    write :/ itab-plan_version under 'plan_version',
    itab-appraisal_id under 'Appraisal Id',
    itab-AP_START_DATE under 'Start Date',
    itab-AP_END_DATE under 'End date',
    itab-AP_STATUS under 'Status',
    itab-AP_STATUS_SUB under 'Substatus',
    itab-OBJ_DATE_SET under 'Objective setting date',
    itab-REVIEW_DATE_SET under 'Review date set',
    itab-AP_DATE_SET under 'appraisal date',
    itab-AP_DATE_EARLIEST under 'Earliest appraisal date',
    itab-AP_DATE_LATEST under 'Latest Appraisal date',
    itab-CHANGE_DATE under 'Change Date',
    itab-CHANGE_TIME under 'change time',
    itab-CHANGE_user under 'change user'.
    count = count + 1.
    endloop.
    write : 'No of records' ,count.
    rgds
    anver
    if hlped mark points.

  • 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.

  • Dynamic Table selection

    Hi All,
    Please help me to resolve this Issue.
    Internal table - IT which has table name like
    KOTH600 
    KOTH601 
    KOTH602 
    KOTH603   , All these table has field KNUMH.
    Loop at IT into WA. ( which has table name in it )
    select * from (WA-TABNAME) into (New_WA)
                where KNUMH = '100010'.
    write:/ New_WA - NAME.
    Endloop.
    Here issue is table name is dynamic and depending upon this New_WA will change. How can I give both table name and work-area dynamic.  ( I do not wish to define 4 new work-area, one for each to handle this situation as number of tables will increase going further ).
    Thanks in advance,
    Regards,
    Mayank Rajguru.

    In this example you have what you are looking for. Create dinamyc tables.
    REPORT Z_DUMMY_ATG NO STANDARD PAGE HEADING MESSAGE-ID SAPLWOSA.
    *=======================================================================
    Variables*
    *=======================================================================
    DATA DESCR_STRUCT_REF TYPE REF TO CL_ABAP_STRUCTDESCR.
    DATA WA_FCAT TYPE LVC_S_FCAT.
    DATA IT_FIELDCATALOG TYPE LVC_T_FCAT.
    DATA DATAREF TYPE REF TO DATA.
    DATA: ONE  LIKE PCFILE-DRIVE,
          TWO  LIKE PCFILE-PATH,
          LONG TYPE I,
          FLAG TYPE C,
          FILEPATH(128) TYPE C,
          FILE_TAB TYPE STRING,
          TABNAME LIKE DD02L-TABNAME.
    *=======================================================================
    Field-Symbols.*
    *=======================================================================
    FIELD-SYMBOLS:
                  <ROW> TYPE ANY TABLE,
                  <TABLE> TYPE STANDARD TABLE,
                  <COMPONENT> TYPE ABAP_COMPDESCR,
                  <FS>  TYPE ANY.
    *=======================================================================
    Selection screen*
    *=======================================================================
    SELECTION-SCREEN BEGIN OF BLOCK DATA WITH FRAME TITLE TEXT-T01.
    PARAMETERS:
        TABNAM(128) TYPE C,
        FUNCTION(1) TYPE C OBLIGATORY,
        LISTNAME LIKE RLGRAP-FILENAME.
    SELECTION-SCREEN END OF BLOCK DATA.
    *=======================================================================
    At Selection screen*
    *=======================================================================
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR LISTNAME.
      PERFORM GET_FILENAME CHANGING LISTNAME.
    *=======================================================================
    Start-of-selection*
    *=======================================================================
    START-OF-SELECTION.
      CLEAR FLAG.
      PERFORM LOAD_DATA USING TABNAM.
      PERFORM VERIFY_TABLE USING TABNAM CHANGING FLAG.
      IF FLAG NE 'X'.
        IF FUNCTION EQ 'D'.
          PERFORM CREATE_TABLE USING TABNAM.
          PERFORM DOWNLOAD_TABLE USING TABNAM.
        ELSE.
          PERFORM CREATE_TABLE USING TABNAM.
          PERFORM UPLOAD_TABLE USING TABNAM.
        ENDIF.
      ELSE.
        MESSAGE S000 WITH 'The proposed table doesn''t exist.'.
      ENDIF.
          FORM GET_FILENAME                                             **
          Name of the directory.*
    FORM GET_FILENAME CHANGING LISTNAME.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                DEF_FILENAME     = LISTNAME
                DEF_PATH         = 'C:\downloads\list'
                MASK             = ',.,.. '
                MODE             = 'S'
                TITLE            = 'Save as'
           IMPORTING
                FILENAME         = LISTNAME
           EXCEPTIONS
                INV_WINSYS       = 1
                NO_BATCH         = 2
                SELECTION_CANCEL = 3
                SELECTION_ERROR  = 4
                OTHERS           = 5.
    ENDFORM.
          FORM LOAD_DATA                                                **
          Specifies the path and table name*
    FORM LOAD_DATA USING MY_TAB.
      DATA: W_FILE LIKE PCFILE-PATH.
      W_FILE = LISTNAME.
      CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
           EXPORTING
                COMPLETE_FILENAME = W_FILE
           IMPORTING
                DRIVE             = ONE
                PATH              = TWO
           EXCEPTIONS
                INVALID_DRIVE     = 1
                INVALID_EXTENSION = 2
                INVALID_NAME      = 3
                INVALID_PATH      = 4
                OTHERS            = 5.
      CONCATENATE ONE ':' TWO INTO FILEPATH.
      CONCATENATE FILEPATH MY_TAB '.txt' INTO FILE_TAB.
    ENDFORM.
          FORM DOWNLOAD_TABLE                                           **
          Downloads the table data.*
    FORM DOWNLOAD_TABLE USING MY_TAB.
      *SELECT **
      INTO TABLE <ROW>
      FROM (MY_TAB).
      ASSIGN <ROW> TO <TABLE>.
      CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
                FILENAME                = FILE_TAB
                FILETYPE                = 'ASC'
           TABLES
                DATA_TAB                = <TABLE>
           EXCEPTIONS
                FILE_WRITE_ERROR        = 1
                NO_BATCH                = 2
                GUI_REFUSE_FILETRANSFER = 3
                INVALID_TYPE            = 4
                NO_AUTHORITY            = 5
                UNKNOWN_ERROR           = 6.
      IF SY-SUBRC EQ 0.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  TITEL = 'Successful Download'
                  TXT1  = 'All the data from the table'
                  TXT2  = 'was correctly downloaded.'.
      ELSE.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  TITEL = 'Download Error!'
                  TXT1  = 'The data of the table'
                  TXT2  = 'couldn''t be downloaded.'.
      ENDIF.
    ENDFORM.
          FORM UPLOAD_TABLE                                           **
          Table Upload.*
    FORM UPLOAD_TABLE USING MY_TAB.
      ASSIGN <ROW> TO <TABLE>.
      CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
                FILENAME                = FILE_TAB
                FILETYPE                = 'ASC'
           IMPORTING
                FILELENGTH              = LONG
           TABLES
                DATA_TAB                = <TABLE>
           EXCEPTIONS
                FILE_OPEN_ERROR         = 1
                FILE_READ_ERROR         = 2
                NO_BATCH                = 3
                GUI_REFUSE_FILETRANSFER = 4
                INVALID_TYPE            = 5
                NO_AUTHORITY            = 6
                UNKNOWN_ERROR           = 7.
      MODIFY (MY_TAB) FROM TABLE <TABLE>.
      IF SY-SUBRC EQ 0.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  TITEL = 'Successful Upload'
                  TXT1  = 'All the data from the table'
                  TXT2  = 'was correctly uploaded.'.
      ELSE.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  TITEL = 'Upload Error!'
                  TXT1  = 'The data of the table'
                  TXT2  = 'couldn''t be uploaded.'.
      ENDIF.
    ENDFORM.
          FORM CREATE_TABLE                                             **
          Creates a dynamic internal table.*
    FORM CREATE_TABLE USING MY_TAB.
      CREATE DATA DATAREF TYPE (MY_TAB).
      ASSIGN DATAREF-> TO <FS>.*
      DESCR_STRUCT_REF ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( <FS> ).
      LOOP AT DESCR_STRUCT_REF->COMPONENTS ASSIGNING <COMPONENT>.
        WA_FCAT-FIELDNAME     = <COMPONENT>-NAME.
        WA_FCAT-REF_TABLE     = MY_TAB.
        WA_FCAT-REF_FIELD     = <COMPONENT>-NAME.
        APPEND WA_FCAT TO IT_FIELDCATALOG.
      ENDLOOP.
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
         EXPORTING
           IT_FIELDCATALOG           = IT_FIELDCATALOG
         IMPORTING
           EP_TABLE                  = DATAREF
         EXCEPTIONS
           GENERATE_SUBPOOL_DIR_FULL = 1
           OTHERS                    = 2.
      ASSIGN DATAREF-> TO <ROW>.*
    ENDFORM.
    *&      Form  VERIFY_TABLE
          The table must exist!*
    FORM VERIFY_TABLE USING TABNAM CHANGING FLAG.
      SELECT SINGLE TABNAME
      INTO (TABNAME)
      FROM DD02L
      WHERE TABNAME EQ TABNAM.
      IF SY-SUBRC NE 0.
        FLAG = 'X'.
      ENDIF.
    ENDFORM.

  • Oracle External Table SELECT FROM problem from workstation

    At Solaris Oracle database server console.
    Created directory on the Solaris server as Oracle owner.
    As SYS created oracle directory object on that Solaris directory
    Granted read/write to SCHEMA_OWNER on that oracle directory object.
    Using OS Oracle user, moved a tab-delimited flat file into the Solaris directory.
    Logged on a SCHEMA_OWNER using SQLPLUS on the Solaris database server.
    Ran external table script in SQLPLUS.
    External table was created.
    Ran Select * from ext_table.
    Appropriate dataset returned.
    So at the Oracle Solaris server console,
    the create external table script worked without errors,
    and a select from statement on the external table worked without errors.
    Move to developer workstation:
    Logged on as SCHEMA_OWNER using SQLPLUS on Windows workstation.
    TNSNAMES of course points to the Solaris database server.
    Ran the external table script in SQLPLUS.
    External table was created.
    Ran Select * from ext_table.
    This failed with these errors:
    ORA29913 error executing ODCIEXTTABLEOPEN callout
    ORA29400 data cartridge error
    cant open logfile.log
    OS permission denied
    ORA06512 sys.oracle_loader line 19
    So how can I select from external tables from a windows workstation?
    Any guidance on this problem would be appreciated.

    Thank you for your response.
    I am not creating the external table on the workstation.
    In both cases,
    from the Solaris console
    and from the Windows workstation
    the external table is being created on the Solaris file system
    in an Oracle Directory object
    running an SQL script from SQLPLUS prompt.
    The external table creator, schema owner, has read and write permissions
    granted by SYS on the oracle directory object.
    The problem is:
    Logged in as the schema owner,
    you can select * from ext_table from the Solaris console SQLPLUS,
    but you can not select * from ext_table from the Windows workstation SQLPLUS.
    You can DROP TABLE ext_table from the Windows workstation SQLPLUS.
    You just cannot select * from ext_table from the Windows workstation SQLPLUS.
    I guess as a test,
    I can drop from the ext_table creation script the references
    to discardfile, badfile, and logfile,
    and remove this other file objects from the equation...
    which appears to be a file permissions problem.

  • Dynamic table name from Arguments in cfquery /

    I'm trying to use dynamic table names in a cfc but seem to
    have hit upon a wall as my calling methods from flash keep hitting
    my _error methods - Code attached to show what I'm trying to
    achieve; if anyone can give me some pointers it would be a great
    help. I've seen numerous by using the Form with the arguments but
    this is coming into a gateway used by a flash component and doesn't
    work no matter how much I fiddle the code.
    Thanks in advance

    There was a time when I needed a dynamic query such as this.
    BUT, it is very dangerous, which is why I took a few steps to make
    it more secure.
    1. Always use cfqueryparam and strict datatyping
    2. Use listFindNoCase for known table names in the database
    e.g
    <cfset variables.tableNames =
    "items,products,categories,blog" />
    <cfif
    listContainsNoCase(variables.tableNames,lCase(trim(arguments.tableName)),",")>
    query here
    <cfelse>
    Error: Unknown table requested
    </cfif>
    Mikey

Maybe you are looking for

  • Automatic creation of WBES element using front end application

    Hi, i am looking at developing a front end tool where user will provide the required data and project name/wbes lement in the request. upon approval from project manager, sytem must creation requird WBE element in the requested project automatically.

  • How to get webi data into dashboard for non-users of webi.

    I need to find a way to get data from a WebIntelligence Report (essentially 3 numbers: Average This Year, Average Last Year and Target This Year (eg, 40, 63, 55)) into a dashboard, where the data is refreshed each day.  The resulting dashboard will b

  • How To: Itunes 10 for xp 64 bit

    File Extraction 1. Download the latest itunes x64 from apple.com 2. Locate the downloaded file, right click 3. Select 7-zip from the menu, and "extract to iTunes64Setup\" as it will extract to a contained folder 4. Open the extracted folder. If you s

  • Logic Pro / Protools - G5 and Mac Pro?

    I have a G5 with 8Gb (so still an ok machine) with many VST's and EW library through Kompakt player etc... this also runs Logic 8.02 and Ableton 7 well on Tiger 10.4.11 I have now just bought a Mac Pro 3.0Ghz with 10Gb and Protools HD, on Leopard 10.

  • I'm trying tooo add music to an ipod but it wont work!

    I'm trying to add music from a cd to my ipod but when I sync the Ipod for the music to go on it ..it doesnt go on my ipod..I tried everything I even called!!!!! HELP ME!