This is regarding abap for database table......

Hi to all,
here is my requirement,
i want to give table name as input.
if i give table name as input with parameters,then i want to display all fields in that
table dynamically.
suppose first i want to give lfa1 as input and i want to display all the fields in lfa1,
then i will give ekko and now i want to all the fields in the ekko table.
like that i want to see some 16 tables.....How to write coding fot this...
please reply.........
Regards,
swami.

Hi
This code may help.
parameters : p_tab type TABNAME.
data : i_tab type standard table of dd03l,
        wa_tab type dd03l.
select * from dd03l into table i_tab where tabname = p_tab.
loop at i_tab into wa_tab.
write : / wa_tab-tabname, wa_tab-fieldname.
endloop.
~ Ranganath

Similar Messages

  • Temporary data carriers for Database tables

    hi Gurus,
    How can we find temporary Data Carriers for database tables. For eg.   when we craete a BOM in CS01/CS02 the data first goes to RC29P structure and when system finishes it goes to STPO.
    This is one example. how canw e find other structures and theirs corresponding Database Tables?
    Any idea?
    Regards

    Hi Greg,
    Those are the aggregated tables. If they are not filled with data although the Portal Activity Report is activated, you should check whether the aggregation finished successfully.
    In the older SPs there were some problems that were fixed in later SPs of 7.0.
    In order to have the latest version of Portal Activity report, you can check SAP note 1084379 - Portal Activity Report - Latest Version (SDA file).
    You can compare the SP via the MANIFAST file, as it contains the version and SP number.
    In order to troubleshoot problems in Activity Report, you can follow SAP note: 1690023 - Portal Activity Report - Component-specific Note
    Some basic checks that you can do:
    Run query on the raw data tables to check since when there is data in those tables:
    select min(timestamphour) from SAP<SystemID>DB.WCR_WEBCNODESTAT;
    If there is too much data from long time ago, then you should delete the old data, and leave only the new data (there is anyways retention time for the data to be kept).
    If there is no data, then it means that the Portal Activity Report does not collect data, and not really activated (usually this is not the case).
    The aggregation runs every top of the hour, so you can check in the default traces for an error during that time.
    In most of the cases something went wrong while aggregating the data.
    As a result the aggregation is not finished, so the transaction is not being committed, and the aggregated tables stay empty.
    If there is a DuplicateKeyException in the trace, you can follow SAP note 1054145 - Duplicate Key Exception.
    If you have any more questions, please don't hesitate to ask.
    I hope this information helps,
    Thanks & regards,
    Michal Zilcha-Lang

  • Delete restrict for ABAP Dictionary database table

    Hi,
    I defined two database tables in ABAP dictionary, one with master data, and one with records referencing the master data.
    I also defined a foreign key relationship in the second table, so that new entries in the second table are checked against the master data table.
    In addition to this behaviour, I also want the Dicitionary to perform a check the other way round. In other words, if I try to delete a record in the master data table, this should not be possible if there are records in the second table referencing this record. Thats how foreign key relationships work in Oracle databases.
    Is there a way to force this behaviour for ABAP Dictionary tables, too? Or is it possible to make the table maintenance view perform this check?
    Thanks for your help!
    Kind regards,
    Tobias

    Hello Tobias,
    I can delete records in the master table which have dependent entries in the second table without an error or a warning.
    How are you deleting the entries, via SM30?
    If yes, you can use the [Event 03: Before Deleting the Display Data|http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9f14a9d111d1a5690000e82deaaa/content.htm]. In this TMG event you can check if the entry can be deleted at all!
    If you're using Open SQL statements to delete the records, i don't think DB layer implicitly checks the dependency. You can always put an explicit check though
    Btw, out-of-curiosity, is this a custom or standard table?
    BR,
    Suhas

  • Navigation for database tables in a transaction code

    Hi all !
       Is there any way to know the database tables linked to a transaction code, so that searching for fields in tables gets easier right?Please help.
    What is the use of Tcode SE80.How can we make use of this transaction?

    hi,
    SE80 - Object Navigator
    se80 is a tool to develope and navigate programs and dd-obj.
    SE80 Object Navigator - > means all the objects qill be available there.
    in se80 in addition to viewing the objects related to programming and classess, there are more priviliges to view such as some other repositories suchas mime, object repository,object browser and all..
    The 2 editors are se38 and se80 both have the abap editor in place. In se38 you can go create programs and view online reports and basically do all thedevelopmet of objects in this editor. In se80 ( object navigator) there are additional features such as creating packages,module pool , function group ,classes, programs ( where you can create ur programs) and BSP applications .
    SE38, u will get more space in editor when u compare with the SE80 screen, the tree structure available will occupy more space so it will be eay for us to code.
    If u want to do any special navigation then u can got to SE80, but there is no specific reason.
    It depends on teh users convineince.
    se80 is to navigate to every object .....
    but everytime there is no need to navigate to several steps and go to abap editor.
    So there certain transactions which takes us to directly to the objects such as SE38 for abapaeditor
    SE37 for function module
    SE93 for creating transaction codes...etc.
    U can also traverse to se80 from SE38 itself using CtrlShiftF5.
    SE 38 ->Abap Editor thru which we can create/modify the programs.
    SE80 ->Object Navigator thru which we can navigate to many areas like message classes,Function modules,application areas,transactions, programs etc.

  • Inner Join Condition For  Database Tables in JDBC Adapter

    Hi
    Is there any restriction for Number of database tables to Write Inner join Condition in JDBC.
    Thanks

    Venkat,
    No there is no restriction in Inner join. If your query executes perfectly in target Database then the same query will exceute perfectly while calling through XI.
    Best regards,
    raj.

  • Regarding updating of database table..

    Halo All,
    I have actually done the program successfully for updating the database table QMFE some days back, now we needed to update some more records and i have just changed the path of the text files but the problem is that all the values are being uploaded but the update statement is not executing successfully
    I have also tried to debug the program and saw that the sy-subrc value is 4 instead of 0.
    I am pasting my code here.
    Please solve this asap.
    *&     Report          Y_UPDATE_QMFE_01                                *
    *&     Program         Y_UPDATE_QMFE_01                                *
    *&     Author          RAMA KRISHNA BASA                               *
    *&     Date            02-04-2007                                      *
    *&     Description     REPORT FOR Update of Table QMFE                 *
    *&     Includes                                                        *
    *&     Tables          QMFE                                            *
    *&     Program Maintenance History                                     *
    *&     Date         Author     Change Request Number       SAP Release *
    *&  02-04-2007       BASA           EF7K919575                 6.10    *
    REPORT  Y_UPDATE_QMFE                            .
    Tables: qmfe.
    data: begin of gt1_qmfe occurs 0,
          qmnum       like qmfe-qmnum,
          fenum       like qmfe-fenum,
          /itml/usr20 like qmfe-/itml/usr20,
          end of gt1_qmfe.
    data: begin of gt2_qmfe occurs 0,
          qmnum       like qmfe-qmnum,
          fenum       like qmfe-fenum,
          /itml/usr21 like qmfe-/itml/usr21,
          end of gt2_qmfe.
    data: begin of gt3_qmfe occurs 0,
          qmnum       like qmfe-qmnum,
          fenum       like qmfe-fenum,
          /itml/usr19 like qmfe-/itml/usr19,
          end of gt3_qmfe.
    data: begin of gt4_qmfe occurs 0,
          qmnum       like qmfe-qmnum,
          fenum       like qmfe-fenum,
          /itml/usr07 like qmfe-/itml/usr07,
          end of gt4_qmfe.
    data: gs1_qmfe like line of gt1_qmfe,
          gs2_qmfe like line of gt2_qmfe,
          gs3_qmfe like line of gt3_qmfe,
          gs4_qmfe like line of gt4_qmfe.
    data: ls_lines1 type i,
          ls_lines2 type i,
          ls_lines3 type i,
          ls_lines4 type i.
    parameters: ip_file1 type RLGRAP-FILENAME default 'C:\Urgent\New\Text Files\StoDt.txt'     obligatory,   " usr20
                ip_file2 type RLGRAP-FILENAME default 'C:\Urgent\New\Text Files\RcDtCust.txt'  obligatory,   " usr21
                ip_file3 type RLGRAP-FILENAME default 'C:\Urgent\New\Text Files\DockDate.txt'  obligatory,   " usr19
                ip_file4 type RLGRAP-FILENAME default 'C:\Urgent\New\Text Files\AWB.txt'       obligatory.   " usr07
    field-symbols: <fs1> like gs1_qmfe,
                   <fs2> like gs2_qmfe,
                   <fs3> like gs3_qmfe,
                   <fs4> like gs4_qmfe.
    perform upload_gt1_qmfe.
    perform upload_gt2_qmfe.
    perform upload_gt3_qmfe.
    perform upload_gt4_qmfe.
    perform update_qmfe.
    *&      Form  upload_gt1_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM upload_gt1_qmfe .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      = ip_file1
       FILETYPE                      = 'DAT'
      TABLES
        DATA_TAB                      = gt1_qmfe.
    describe table gt1_qmfe lines ls_lines1.
    write: / ls_lines1.
    ENDFORM.                    " upload_gt1_qmfe
    *&      Form  upload_gt2_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM upload_gt2_qmfe .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      = ip_file2
       FILETYPE                      = 'DAT'
      TABLES
        DATA_TAB                      = gt2_qmfe.
    describe table gt2_qmfe lines ls_lines2.
    write: / ls_lines2.
    ENDFORM.                    " upload_gt2_qmfe
    *&      Form  upload_gt3_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM upload_gt3_qmfe .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      = ip_file3
       FILETYPE                      = 'DAT'
      TABLES
        DATA_TAB                      = gt3_qmfe.
    describe table gt3_qmfe lines ls_lines3.
    write: / ls_lines3.
    ENDFORM.                    " upload_gt3_qmfe
    *&      Form  upload_gt4_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM upload_gt4_qmfe .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      = ip_file4
       FILETYPE                      = 'DAT'
      TABLES
        DATA_TAB                      = gt4_qmfe.
    describe table gt4_qmfe lines ls_lines4.
    write: / ls_lines4.
    ENDFORM.                    " upload_gt4_qmfe
    *&      Form  update_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM update_qmfe .
    data: ls_cnt1 type i,
          ls_cnt2 type i,
          ls_cnt3 type i,
          ls_cnt4 type i.
    *refresh gt1_qmfe.
    *clear   gt1_qmfe.
    loop at gt1_qmfe assigning <fs1> .
    *concatenate <fs1>-/itml/usr206(2) '.' <fs1>-/itml/usr204(2) '.' <fs1>-/itml/usr20+2(2) into <fs1>-/itml/usr20.
    data wa_qmfe type qmfe.
    *select single * from qmfe into wa_qmfe where qmnum = <fs1>-qmnum
                                                      and   fenum = <fs1>-fenum.
    *wa_qmfe-/itml/usr20 = <fs1>-/itml/usr20.
    update QMFE  set    /itml/usr20 = <fs1>-/itml/usr20
                 where  qmnum       = <fs1>-qmnum
                 and    fenum       = <fs1>-fenum.
    *modify qmfe from wa_qmfe.
    if sy-subrc = 0.
    commit work.
    add 1 to ls_cnt1.
    endif.
    endloop.
    write: / ls_cnt1.
    *refresh gt2_qmfe.
    *clear   gt2_qmfe.
    loop at gt2_qmfe assigning <fs2>.
    *concatenate <fs2>-/itml/usr216(2) '.' <fs2>-/itml/usr214(2) '.' <fs2>-/itml/usr21+2(2) into <fs2>-/itml/usr21.
    update qmfe set    /itml/usr21 = <fs2>-/itml/usr21
                where  qmnum       = <fs2>-qmnum
                and    fenum       = <fs2>-fenum.
    if sy-subrc = 0.
    commit work.
    add 1 to ls_cnt2.
    endif.
    endloop.
    write: / ls_cnt2.
    *refresh gt3_qmfe.
    *clear   gt3_qmfe.
    loop at gt3_qmfe assigning <fs3>.
    *concatenate <fs3>-/itml/usr196(2) '.' <fs3>-/itml/usr194(2) '.' <fs3>-/itml/usr19+2(2) into <fs3>-/itml/usr19.
    update qmfe set    /itml/usr19 = <fs3>-/itml/usr19
                where  qmnum       = <fs3>-qmnum
                and    fenum       = <fs3>-fenum.
    if sy-subrc = 0.
    commit work.
    add 1 to ls_cnt3.
    endif.
    endloop.
    *top_of_page.
    write: / ls_cnt3.
    *refresh gt4_qmfe.
    *clear   gt4_qmfe.
    loop at gt4_qmfe assigning <fs4>.
    update qmfe set    /itml/usr07 = <fs4>-/itml/usr07
                where  qmnum       = <fs4>-qmnum
                and    fenum       = <fs4>-fenum.
    if sy-subrc = 0.
    commit work.
    add 1 to ls_cnt4.
    endif.
    endloop.
    write: / ls_cnt4.
    ENDFORM.                    " update_qmfe
    Thanks in advance,
    rama.

    Hi,
    Thanks for the reply..
    But last time the update was successfull and the program was transported onto the productive system
    after that now i need to update the new records into QMFE
    so what i did is just changed the path of the text files since they are of same format as of the old text files.
    Does it have any problems.
    How can i do that using what u have suggested......
    i need to update the database table QMFE
    is there any bapi to update the data base table

  • Can IdM use TimeStamp files in its Active Sync for Database table ?

    I have an IdM 7.1 implementation that I inherited
    and have a Database Table resource adapter with Active Sync.
    Here's a few ways to set up Active Sync, but I want to explore the latter.
    -Static Search Predicate (clause)
    You can use a flag (column) in your data table. Does not require any mapping, and presumably whatever process you're kicking off would turn off the flag, so the record is not picked up subsequently.
    -Last Fetched Predicate (documented in the Resource Reference, under Database Table),
    Normally, you'd be doing a comparison based on timestamps, and the mapping between a timestamp-User Extended Attribute AND timestamp-Database Column
    In this implementation, I do not see a User Extended Attribute (UXA) but I do see a 0 byte timestamp file on the server. Did not see anything like this discussed in the docs, but my hypothesis is that this is being used, or has been configured somehow. I wonder if I am right ?
    Let's call it 'MyTS'
    I see MyTS both in ActiveSync logs, as well as in the 'XML Data' object, resource_SYNC, that A/S creates. Maybe this is a hidden feature, or mostly undocumented, or from an earlier version. Anyone care to offer a suggestion or explanation ? Your thoughts would be welcome.
    thanks

    'MyTS' would be a resource attribute. Have a look in the schema map for your resource.
    It doesn't need to be, and would not normally be, a user extended attribute.

  • Csv file uploading for database table creation

    Hi there,
    I'm in the process of making an application that will be able to upload a csv file and create a table based on the same file. As of now, I have managed to make my application upload a csv file into the database. My problem now is to transfer the data in the csv into a table. If there is a function that can do this, please let me know. But as of now, I have tried all that I can but in vain. I would appreciate any assistance rendered as to how I can go about this.
    Kind regards,
    Lusuntha

    hai Lusuntha ,
    Go to search forum and type "upload within html db".here u will find the required information ,as well as the code.go for each topic in the search result.

  • How to find Tcode for database table

    Hi Gurus,
    I need to find out tcode for Standard SAP table in SCM APO '/SAPAPO/PBMVWT' for maintaining Plannning book text in different languages.
    The problem is that Table maintainance is not maintained so SM30 wont work. I tried Where used list option for table but no tcode or report found using this table..
    Kindly help
    Swapnil

    Hi,
    there is no maintenance txn. If you need to have text in different languages, you need to do it as follows:
    - logon for example once in english
    - goto txn /SAPAPO/SDP8B
    - maintain the text in English and activate the planning book.
    - Logon in the other Language
    - enter /SAPAPO/SDP8B again
    - Type in the text in the other language and activate the Planning book again.
    This will give the planning book language specific texts.
    Best regards
    Rico Frenzel

  • Pl/sql Clob code not works for database table but works for collection!

    Dear friends
    I modified pl/sql code to insert large data for clob column ın ORACLE APEX , It works for collection (I modified it to work for both)
    the modified code is blod
    declare
    aClob1 clob := empty_clob;
    aClob2 clob ;
    begin
    dbms_lob.createtemporary( aClob1, false, dbms_lob.SESSION );
    for i in 1..wwv_flow.g_f01.count loop
    dbms_lob.writeappend(aClob1,length(wwv_flow.g_f01(i)),wwv_flow.g_f01(i));
    end loop;
         apex_collection.create_or_truncate_collection(p_collection_name => 'CLOB_CONTENT');
         apex_collection.add_member(p_collection_name => 'CLOB_CONTENT',p_clob001 => aClob1);
         htmldb_application.g_unrecoverable_error := TRUE;
    select cc into aClob2 from tt where id = 21 for update ;
    dbms_lob.write(aClob2,Length(aClob1),1,aClob1); commit;
    end;
    but the charcters more than 8100 not be saved to database clob column !
    regards
    Edited by: Siyavus on Jan 30, 2009 5:26 PM
    Edited by: Siyavus on Jan 30, 2009 5:29 PM

    Dear Thomas
    dbms_lob.write(aClob2,*dbms_lob.getlength*(aClob1),1,aClob1); commit;
    I tried it ( dbms_lob.getlength(aClob1) ) but the result is the same
    regards

  • Any easy way to generate unique primary key for database table?

    I'm currently playing with the J2EE reference implementation from Sun which comes with the IBM Cloudscape database. This Cloudscape database supports the use of an AutoIncrement field.
    First question: Can I use CMP and assume that the database will generate a proper key for me? Anyone tried it out successfully before?
    Also, based on what I've heard so far, it seems that generating database primary key is not really well-supported by J2EE using CMP in that a lot of J2EE developers have to resort to workarounds like using a session bean, JDBC and (1) some seed numbers for ID implanted in the database itself (as in the J2EE tutorial DukesBankApp example) or (2) using the SQL MAX aggregation command + 1. Usign seed number is contradictory to good database design and using MAX is dangerous for heavy traffic application if 2 beans try to insert themselves into the database at the same time (synchronizarion problem).
    Anyway I find it dumb that we still have to go back to JDBC and SQL which was the reason why the concept Entity Bean was introduced; to make database persistence transparent! Now it seems that J2EE makes it worse and more troublesome than before.
    Second Question: Is there any easy (hopefully transparent/automatic) way of generating primary key ID?

    if you want to rely on your container or database then go hard, will probably be faster.
    to make a cross container/db soln I used a CMP Entity bean called Sequence with one field for uid
    I use one instance and increment the field each time.
    To do the logic, I have a utils class with static method, no need for session bean overhead
    I reckon this approach is OK considering all things

  • Authorisation Object: for database table

    Hi .
    I have a custom Z table which contains data for different plants.We have craeted a maintenence generator so that user can change data. Now I want to  user should able to change data a particulat plant.
    i already have authority object 'ZPLANT' with roles.
    In se11 when i am trying to use authorization object, it is coming as " S_TABU_DIS " even in change mode.
    How can I restrict user at table level.

    Hi
    Following links show some relevant info for authorizations.
    http://www.sapdb.org/7.4/htmhelp/ee/1c5bcdeba711d4aa2800a0c9430730/content.htm
    Also check the following links.
    http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb43cc455611d189710000e8322d00/content.htm
    http://www.sap-img.com/human/main-hr-authorization-object-for-security.htm
    http://www.sapdb.org/7.4/htmhelp/ee/1c5bcdeba711d4aa2800a0c9430730/content.htm
    Please reward if it helps.

  • This is regarding code for a count up timer.....

    I have created a custom count up timer and I have written the code. But I would like for the dynamic text "0" that I created in Flash to be the counter not some random number that pops up when I initiate the counter. What do I need to do for it to recognize the "0" I typed in a text field as where it should started counting? Does this make sense?
    Here is the code:
    var startT:Number = 1;
    var endT:Number =8000000;
    var tf:TextField = this.createTextField('counter', this.getNextHighestDepth(), 10, 10, 300, 22);
    onEnterFrame = function ()
        if (startT >=endT)
            delete onEnterFrame;
            tf.text = String(endT);
        else
            tf.text = String(startT);
            startT += 1;

    I get that but what I'm saying is I have a typed number "0" in my counter that I would like it to count up, instead I enter the code and test it and out to the left appears another 0 which is smaller and black and it begins to count up... hopefully this is more clear.

  • Download and upload ABAP database table to presentation server and R/3

    Hi experts,
    I want to download ABAP database table (Ztable) to presentation server and again want to upload this to another R/3 server but i dont want to use any transport request. is there any possible sollution for this.
    Thanks in advance

    Hi,
    Look at this code hope this will help you to solve your problem
    REPORT y_test_559.
    Program for
    1. Downloading Data of any DB table to a tab delimited ASCII file
    2. Checking if a tab delimited ASCII file has the structure of a
       DB table and showing its contents
    3. Uploading a tab delimited ASCII file to a DB table with the same
       structure
    4. Showing the data of any DB table
    ======================================================================
    ======================================================================
    DATA DECLARATIONS
    ======================================================================
    TYPES : data_object  TYPE REF TO data.
    DATA  : itab TYPE REF TO data .
    TYPE-POOLS : slis .
    DATA  : it_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv
            WITH HEADER LINE .
    DATA : it_fieldcatalog TYPE lvc_t_fcat .
    DATA : wa_fieldcatalog TYPE lvc_s_fcat .
    DATA : i_structure_name LIKE dd02l-tabname .
    DATA : i_callback_program LIKE sy-repid .
    DATA  : dyn_line TYPE data_object .
    FIELD-SYMBOLS : <fs_itab> TYPE  STANDARD  TABLE .
    DATA : table_name_is_valid TYPE c .
    DATA : dynamic_it_instantiated TYPE c .
    CONSTANTS buttonselected TYPE c VALUE 'X' .
    ======================================================================
    SELECTION SCREEN DEFAULT
    ======================================================================
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_tabl.
    PARAMETERS : tabl_nam LIKE rsrd1-tbma_val
                 MATCHCODE OBJECT dd_dbtb_16 OBLIGATORY .
                                   "Search for Database Tables is dd_dbtb_16
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_file.
    PARAMETERS : file_nam LIKE rlgrap-filename .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_down.
    PARAMETERS : p_downld RADIOBUTTON GROUP grp1
                 USER-COMMAND m_ucomm .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_chkf.
    PARAMETERS : p_chkfil RADIOBUTTON GROUP grp1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_upld.
    PARAMETERS : p_upload RADIOBUTTON GROUP grp1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_show.
    PARAMETERS : p_show_t RADIOBUTTON GROUP grp1 ."show table data
    SELECTION-SCREEN END OF LINE.
    ======================================================================
    AT SELECTION SCREEN OUTPUT
    ======================================================================
    AT SELECTION-SCREEN OUTPUT .
      PERFORM check_filename .
    ======================================================================
    AT SELECTION SCREEN ON VALUE REQUEST FOR FILENAME
    ======================================================================
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_nam .
      PERFORM f4_for_filename .
    ======================================================================
    Initialization .
    ======================================================================
    INITIALIZATION .
      t_tabl = 'Table Name' .
      t_file = 'File Name' .
      t_down = 'Download Table' .
      t_chkf = 'Check File to Upload' .
      t_upld = 'Upload File' .
      t_show = 'Show Table Contents' .
    ======================================================================
    START OF SELECTION
    ======================================================================
    START-OF-SELECTION .
      PERFORM check_table_name_is_valid .
    ======================================================================
    END OF SELECTION
    ======================================================================
    END-OF-SELECTION .
      IF table_name_is_valid EQ ' ' .
        MESSAGE i398(00) WITH 'INVALID TABLE NAME' .
      ELSE .
        PERFORM instantiate_dynamic_internal_t  .
        CHECK  dynamic_it_instantiated = 'X' .
        CASE buttonselected .
          WHEN p_downld .
            PERFORM select_and_download .
          WHEN p_chkfil .
            PERFORM check_file_to_upload .
          WHEN p_upload .
            PERFORM upload_from_file .
          WHEN p_show_t .
            PERFORM show_contents .
        ENDCASE .
      ENDIF .
    *&      Form  CHECK_TABLE_NAME_IS_VALID
          text
    -->  p1        text
    <--  p2        text
    FORM check_table_name_is_valid.
      DATA l_count TYPE i .
      TABLES dd02l .
      CLEAR table_name_is_valid .
      SELECT COUNT(*) INTO l_count FROM tadir
      WHERE  pgmid = 'R3TR'
      AND    object = 'TABL'
      AND    obj_name = tabl_nam .
      IF l_count EQ 1 .
        CLEAR dd02l .
        SELECT SINGLE * FROM dd02l WHERE tabname  = tabl_nam .
        IF sy-subrc EQ 0.
          IF dd02l-tabclass = 'TRANSP' .
            table_name_is_valid = 'X' .
          ENDIF .
        ENDIF.
      ENDIF .
    ENDFORM.                    " CHECK_TABLE_NAME_IS_VALID
    *&      Form  SELECT_AND_DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM select_and_download.
      CLEAR : <fs_itab> .
      SELECT * FROM (tabl_nam)
      INTO CORRESPONDING FIELDS OF TABLE <fs_itab>   .
      PERFORM check_filename.
      CALL FUNCTION 'WS_DOWNLOAD'
        EXPORTING
          filename                = file_nam
          filetype                = 'DAT'
        TABLES
          data_tab                = <fs_itab>
        EXCEPTIONS
          file_open_error         = 1
          file_write_error        = 2
          invalid_filesize        = 3
          invalid_type            = 4
          no_batch                = 5
          unknown_error           = 6
          invalid_table_width     = 7
          gui_refuse_filetransfer = 8
          customer_error          = 9
          OTHERS                  = 10.
      IF sy-subrc EQ 0.
        MESSAGE i398(00) WITH 'Table' tabl_nam
                              'successfully downloaded to '
                              file_nam .
      ENDIF.
    ENDFORM.                    " SELECT_AND_DOWNLOAD
    *&      Form  UPLOAD_FROM_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM upload_from_file.
      DATA : ans TYPE c .
      DATA : lines_of_itab TYPE i .
      DATA : l_subrc TYPE i .
      CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
        EXPORTING
          textline1 = 'Are you sure you wish to upload'
          textline2 = 'data from ASCII File to DB table '
          titel     = 'Confirmation of Data Upload'
        IMPORTING
          answer    = ans.
      IF ans = 'J' .
        PERFORM check_filename.
        CLEAR l_subrc .
        CALL FUNCTION 'WS_UPLOAD'
          EXPORTING
            filename                = file_nam
            filetype                = 'DAT'
          TABLES
            data_tab                = <fs_itab>
          EXCEPTIONS
            conversion_error        = 1
            file_open_error         = 2
            file_read_error         = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            OTHERS                  = 10.
        l_subrc = l_subrc  + sy-subrc .
        IF sy-subrc EQ 0.
          DESCRIBE TABLE <fs_itab> LINES lines_of_itab .
          IF lines_of_itab GT 0 .
            DELETE (tabl_nam) FROM TABLE <fs_itab> .
            COMMIT WORK .
            INSERT (tabl_nam) FROM TABLE <fs_itab> .
            l_subrc = l_subrc  + sy-subrc .
          ENDIF .
        ENDIF.
        IF  l_subrc EQ 0  .
          MESSAGE i398(00) WITH lines_of_itab
                               'Record(s) inserted in table'
                                tabl_nam .
        ELSE .
          MESSAGE i398(00) WITH
                          'Errors occurred No Records inserted in table'
                           tabl_nam .
        ENDIF .
      ENDIF .
    ENDFORM.                    " UPLOAD_FROM_FILE
    *&      Form  F4_FOR_FILENAME
          text
    -->  p1        text
    <--  p2        text
    FORM f4_for_filename.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = 'C:\'
          mask             = ',.,..'
          mode             = '0'
        IMPORTING
          filename         = file_nam
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
    ENDFORM.                    " F4_FOR_FILENAME
    *&      Form  CHECK_FILENAME
          text
    -->  p1        text
    <--  p2        text
    FORM check_filename.
      IF file_nam IS INITIAL
      AND NOT ( tabl_nam IS INITIAL  )
      AND p_show_t NE buttonselected.
        CONCATENATE 'C:\' tabl_nam  '.TXT'  INTO file_nam.
      ENDIF .
    ENDFORM.                    " CHECK_FILENAME
    *&      Form  INSTANTIATE_DYNAMIC_INTERNAL_T
          text
    -->  p1        text
    <--  p2        text
    FORM instantiate_dynamic_internal_t.
      CLEAR dynamic_it_instantiated .
    -----> Step 1 - Finding Field Names and ALV GRID Fieldcatalog
      i_structure_name =  tabl_nam .
      CLEAR it_fieldcat[] .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = i_structure_name
        CHANGING
          ct_fieldcat            = it_fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc EQ 0.
    -----> Step 2 - Creating Field Catalog of the Object
                                                  cl_alv_table_create
        LOOP AT it_fieldcat .
          CLEAR wa_fieldcatalog .
          MOVE-CORRESPONDING it_fieldcat TO  wa_fieldcatalog .
          wa_fieldcatalog-ref_field = it_fieldcat-fieldname .
          wa_fieldcatalog-ref_table = tabl_nam .
          APPEND  wa_fieldcatalog  TO it_fieldcatalog .
        ENDLOOP .
    -----> Step 3 - Creating Internal Table Dynamicaly
        CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog = it_fieldcatalog
          IMPORTING
            ep_table        = itab.
        ASSIGN itab->* TO <fs_itab> .
        dynamic_it_instantiated = 'X' .
      ENDIF.
    ENDFORM.                    " INSTANTIATE_DYNAMIC_INTERNAL_T
    *&      Form  SHOW_CONTENTS
          text
    -->  p1        text
    <--  p2        text
    FORM show_contents.
      CLEAR : <fs_itab> .
      SELECT * FROM (tabl_nam)
      INTO CORRESPONDING FIELDS OF TABLE <fs_itab>   .
      i_callback_program = sy-repid .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = i_callback_program
          it_fieldcat        = it_fieldcat[]
        TABLES
          t_outtab           = <fs_itab>
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    ENDFORM.                    " SHOW_CONTENTS
    *&      Form  CHECK_FILE_TO_UPLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM check_file_to_upload.
      PERFORM check_filename.
    CLEAR l_subrc .
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
          filename                = file_nam
          filetype                = 'DAT'
        TABLES
          data_tab                = <fs_itab>
        EXCEPTIONS
          conversion_error        = 1
          file_open_error         = 2
          file_read_error         = 3
          invalid_type            = 4
          no_batch                = 5
          unknown_error           = 6
          invalid_table_width     = 7
          gui_refuse_filetransfer = 8
          customer_error          = 9
          OTHERS                  = 10.
    l_subrc = l_subrc  + SY-SUBRC .
      IF sy-subrc EQ 0.
        i_callback_program = sy-repid .
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program = i_callback_program
            it_fieldcat        = it_fieldcat[]
          TABLES
            t_outtab           = <fs_itab>
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
      ENDIF .
    ENDFORM.                    " CHECK_FILE_TO_UPLOAD
    Thanks,
    Pramod

  • Number of records in a database table

    Hi,
    Is there a way to find the no of records for database tables ? I have over 1000 tables and need to find the tables without any records. I have found an FM for this requirment but it isnt of much use as i dont have developer access to the system.
    Thanks & Regards,
    Esha Raj

    Hi esha,
    This is one way. Just copy paste to get a feel.
    On the screen, in select-options, enter a few tables, and it will output the table name and the record count.
    report abc.
    data : mycount type i.
    tables : DD02L.
    select-options : tabname for dd02l-tabname no intervals.
    loop at tabname.
      select count(*)
      into mycount
      from (tabname-low).
      write :/ tabname-low , mycount.
    endloop.
    regards,
    amit m.

Maybe you are looking for

  • Redirect user to a different Page based on number of  Liquid output result

    I want to redirect the user to a different page based on the number of results. I have some multi-account users and single account user in my secure zone. I want single account users to be sent to a different page, while multiple account user should

  • How to make player interact with game world objects?

    I am trying to make a side scrolling rpg game similar to South Park Stick of Truth. Right now I have the player done and i sketched the outline of the room i wanted in order to test the the collision detector. So right now there are only 4 classes. T

  • Word Download in Grey 4 Times in Song List - Why?

    I had to do a restore when my hard drive crashed and when I was done syncing, I now have the word "download" showing 4 times in the song list of my iphone 4s.  It is greyed out so you cant do anything with it and no matter what I do I cant get rid of

  • How to Add new Manual address in ADRC?

    Hello Experts, My requirement is, I want to add new address in ADRC table, once I insert new address, I will get the new ADRNR number fot that address. I want that ADRNR to link with vendor address in delivery document. Means wants to update VBPA tab

  • Echo in imported video

    I'm in the process of archiving my old Videos to harddrive. Some of the videos are 6 years old, were recorded on different Camcorders, edited on a PC (ULead MediaStudio) and written back to tape. Now when I import the videos to iMove, when I after im