Manipulating data between 2 tables

Hi Everyone,
Scenario:
Having two tables displayed and being able to add a row of data from table 'A' to table 'B' and also be able to remove a row of data from table 'B'.  (similar to out of the box UME functionality in adding/removing roles to a user). 
Question:  Is there a standard delivered template i could use to handle this?  If not what is the best way to build this in VC?
Thanks

Hi Amil,
there is no template available for doing this, but have a look into the <a href="https://wiki.sdn.sap.com/wiki/display/VC/Movingdatabetween+tables">Wiki</a> for more details to do this.
Best Regards,
Marcel

Similar Messages

  • Moving data between tables (how to find out if the 2nd table is empty)

    Hi,
    I have 2 tables, and I'm copying records from one table to another.
    I've followed the Wiki: [https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/movingdatabetween+tables]
    So far, everything works ok.
    Here is my question: how do I get the number of records passed?
    I mean, how do I know the number of rows in the 2nd table? (Remember that this number is variable, because it depends on how many rows I've inserted and deleted on the 2nd table).
    I've tried to achieve that using a data store with a numeric field, but I couldn't find the way to increment/decrement the numeric field on data store, and insert/delete the row on table at the same time .
    All I want is to find out if the 2nd table is empty or not.
    Any ideas to solve this?
    Thanks in advance!
    Help will be point-rewarded.
    Marcelo

    Hi Ahmed
    thanks for your reply, it was very helpful!! (I've assigned points to you)
    However the user can add twice or more times the same row... so the counter doesn't reflect the real number of rows in the 2nd table.
    I've partially solved this also using a data store with a parameter called key_list, where I add (I mean, concatenate) the key field for the selected row.
    So, if I have a table with 4 rows with key fields "key1", "key2", "key3", the parameter key_list would get "key1;key2;key3".
    So far, it's ok. But when I remove a row previosly added.... I can't remove the key from the key_list parameter. (I mean, from 2nd table I choose to remove the "key2" row, but I don't know how also remove the key name from the key_list)
    I hope be clearly enough.
    Any help will be really appreciated and point-rewarded.
    Thanks again.
    Best Regards
    PS: is there any way of "mark" a row that has been added to the 2nd table? I mean, using (for example) a hidden boolean field named "added", that becomes true when the selected row is added to the 2nd table.

  • Comparing two columns in two tables using partial text strings and copying data between tables

    I have two tables:
    The Vendor table is supplied by a clothing manufacturer and lists product data by row with a column that contains a unique manufacturer ID, such as T5C4.  In this table is a short product description and a long product description that I need to find and copy into the second table, Inventory.
    The Inventory table is an export from our Magento store.  Each row contains a unique inventory number in a column that includes but does not match the unique manufacturer ID from the Vendor table.  For example, the unique inventory number could be T5C4-W12, or RED-T5C4W12 or some other variation.
    For each product in Inventory, I need to find the matching product in Vendor, and then copy the short description and long description from Vendor to Inventory.
    Any tips?  Thanks!
    Karl

    Karl,
    Here's a start, as you requested.
    The formula for Our Inventory Row is:
    =IFERROR(MATCH("*"&A&"*", Our Inventory :: A, 0), "n/a")
    The formula for Brief Description in the inventory table is:
    =IFERROR(INDEX(ABC Products :: $A$1:$C$9,MATCH(ROW(), ABC Products :: $D, 0), 2), "n/a")
    The formula for the Full description in the inventory table is:
    =IFERROR(INDEX(ABC Products :: $A$1:$C$9,MATCH(ROW(), ABC Products :: $D, 0), 3), "n/a")
    The Manufacturer's table knows the concise product numbers, so it has the ability to search the Inventory table for it's product id's using wildcards and it then displays the line number of the item in the inventory table. The Inventory table can then search the manufacturer's table for its row number and can reference the brief and full descriptions.
    This approach has a serious limitation. It will only find the first occurrence in the inventory. Now, if you want to accept this, you can sort all the found descriptions and pull them out of the inventory table, and then the next product in line will display it's description too.
    I wish I could do better with this, but it's all I can come up with at this point, knowing only what you have told me.
    Jerry

  • Move data between tables

    I use SQL*Loader to load data into a interface table where I do some data cleaning.
    Is there a easy way of moving the data from the interface table to a target table inside the same database, keeping in mind that the target table already contains data.
    I normally export the data from the interface table, create a data and control file and use SQL*Loader again, but this seems like such a long way, surely there should be a easier way??
    Thank you in advance

    It's not a problem that the target table contains more columns, you can either do ...
    insert into my_target (col1, col2, col3, col4,col5)
    select col_a, col_b, 'my_default_value',null, sysdate
    from my_source;
    ... or ...
    insert into my_target (col1, col2)
    select co;l_a, col_b
    from my_source;
    The second statement will automatically put NULL into columns not listed after my_target, the first statement allows you to specify NULL explicitly or specify some static or dynamic default value.
    I guess you have to find out why it's taking so long to insert the values. My guess would be that you have indexes on the table that are slowing things up. You may find it beneficial to drop the indexes, load the new data, rebuild the indexes.
    You could also add the APPEND hint to the insert ...
    insert /*+ append */ into my_target ...
    ... which might speed things up a little. Also check that your pctfree value for the table is set very low (0) and pctused is very high (99) if you are not going to be updating these rows in future -- this will pack more rows into each block.
    Another option is to partition your target table, and use the EXCHANGE PARTITION mechanism to get data into it.

  • Moving data between tables

    Hi, I have 2 tables: l_eket_obj and itab
    TYPES: BEGIN OF eket_obj,
          werks LIKE ekpo-werks,
          matnr LIKE ekpo-matnr,
          menge TYPE i,
          wemng TYPE i,
          objednane TYPE i,
          END OF eket_obj.
    DATA: l_eket_obj TYPE eket_obj OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF itab OCCURS 0,
          werks like ekpo-werks,
          matnr LIKE ekpo-matnr,
          zamowione type i,
          END OF itab.
    How to move all data from field l_eket_obj-objednane into field itab-zamowione?
    Thanks,
    Joanna

    HEllo
    do like this.
    loop at l_eket_obj .
    read table itab with key werks eq l_eket_obj-werks
                                       matnr eq l_eket_obj-matnr.
    if sy-subrc =  0.
    itab-zamowione = l_eket_obj-objednane.
    modify itab transporting zamowione where werks eq l_eket_obj-werks
                                       matnr eq l_eket_obj-matnr.
    endif.
    endloop.
    Hope this solve ur problem.
    Regards,
    Vasanth

  • Transfering data between tables

    I am creating a table to allow the user to enter data. When this is done i am transferring the data from one table and into another so that another program can work on it. This is my code:
    for (i= 0; i<n; i++)
                        for (j=0; j<n; j++)
                             String obj = (String)matrix.getValueAt(i,j); // Take value out of 1st table
                             double ni = Double.parseDouble(obj);
                             table.setValueAt(""+ni,i,j);                    // Assign it to same location in 2nd table
                             //System.out.println(ni);
    I am getting a nullExceptionError though each time i try this. Can any body see the problem.
    Thanks

    Every JTable has a table model (whether you created the model or not).
    table2.setModel(table1.getModel());
    should work.

  • Diffrerent data between table and RSA3

    Hi all,
    I got one prduction order.We filled the setup tables.
    Later we changed production order.We deleted and filled the setup tables again.
    But in RSA3 Its showing the same dates wht we before.
    In tables also its showing changed information.But in RSA3 the old ones we r getting.

    Krish,
    Give a new run and fill the setup tables. This might be due to the validity of given before the run. Check it once.

  • Copying data between tables - numbers on an ipad

    I have two [main] lists (tables):
    Workers names, photos, arrival times, training record and other data on one table (the 'Workers List') with one worker's data on each line.
    The other table (really a set of 3)  of three 'shift sheets', Red, Green and Neutral listing who is on-duty at any given time.
    What I'm trying to do - on an iPad - is allocate each worker to a R,G or N shift by making an entry on their row in the Workers List, and have their name and photo (cells from columns B and C in the Workers List) copied automatically to the next available empty row in the relevant one-of-three shift sheets.
    As I see it there are two main problems: the 'cut and paste' aspect which I can just abut get a handle on, and the selection of the next empty row in the coreect (1 of 3) sheet - which has me baffled.
    I'd really appreciate any thoughts.
    Nick
    (if anyone's even remotely interested, this is for organising the staff at the Incredibly-Famous Cider Bus at Glastonbury Festival!! - a free jar for the problem solver!)

    ok, my solution gets a little complicated and I dont know if it would work for the pictures at all.
    I would have three columns Marked as R, G or B. These would eb equations that look at your column that has R, G or B entered. These increment by one if the letter for that column is found on that row.
    Then in my "color" tables, I have an equation that uses an offset and a match to locate the next row for that color.
    Heres a table for an example(with formula results):
    1
    a
    R
    1
    b
    G
    2
    c
    R
    3
    d
    R
    3
    e
    G
    Column A increments every time R appears in C
    then in the Color R table we use this in cell A1 to pull back the data in the first rows column B that has an R (row 1 in this case)
    =offset(table1::$B$1,match(row(),table1::$a,0)-1,0,1,1)
    this looks for the number 1 in column A, returns what row that was found on, offset from B1 that number minus 1. grab a range 1x1, ie. one cell.
    Just modify this to pull back as many different columns you need. It will show #N/A when you hit the last row for R, just delete those and remove the extra rows from displaying in your table. exapnd when you add more.
    Repeat this with an additional column for G and B, and modify the equation for referencing thier counter columns. the first row in your G table will pull back the information from row 2 in my table above.
    Let me know here if this makes sense. its the only way I could find of doing something similar in XL at work.
    Thanks
    Jason
    Message was edited by: jaxjason

  • Problem copying data between tables

    Hello Members,
    Its my first day using SQL queries on oracle 10g database.I used the following query to copy selected feilds of a table :
    CREATE TABLE SAMPLE_TEMP as (SELECT CUSTOMER, BALANCE FROM CUSTOMER_ALL)
    The CUSTOMER_ALL table has over 2 million records. I was successful in creating a table and copying data, but the new table could populate only 52978 records.
    ---- Sample data in my table
    CUSTOMER     BALANCE
    6.28899273     0
    6.28899274     0
    6.28899275     0
    6.28899289     625.12
    6.28899292     2666.24
    How do I go about fixing this ? Do i need to declare a structure and assign the number of records i will store to it ? Any guidance will help me get started.
    Regards
    newbie

    Hello,
    If the CUSTOMER_ALL table is a live table, there may have been new records INSERTed since you copied the data, therefore you will have different counts.
    To check on the data difference:
    SELECT CUSTOMER, BALANCE FROM CUSTOMER_ALL
    MINUS
    SELECT CUSTOMER, BALANCE FROM SAMPLE_ALL

  • Copying data between tables

    I have just completed the process of exporting my companies
    main mailing database into a new database file which is setup and
    structured differently. I am trying to figure out how to run a
    coldfusion query that can update my contact information from one
    table into another, tables are as follows:
    companies table
    companyid | contacttitle1 | contactname1 | contactsurname1 |
    contactposition1 | mail1
    autonum | text | text | text | text | text
    AddxContacts table
    id | contacttitle1 | contactname1 | contactsurname1 |
    contactposition1 | mail1
    number | text | text | text | text | text
    i need to update the fields in the first table with the
    fields in the second table, the companyid & id from each table
    are the primary keys that match up the records, however the
    AddxContacts table may contain more than one entry with the same id
    no, but i only want to copy one record for each id no.
    I have scoured various forums looking for an easy way to do
    this but so far have come up blank, any help would be greatly
    appriciated. Thanks

    There is a major difference between what you say you intend
    to do and what your sample code indicates you are attempting to do.
    Do not store contact information in your company table. Put
    it elsewhere with either a one to many or many to many relationship
    set up, depending on your business requirements.

  • Move data between tables with INSERT-LOOP?

    Greetings
    I need to move all the contact information (contained in 5
    fields- call it the address table) into the table (call it the main
    table) that contains all the other associated information. Tables
    are related via the "vendor_ID" key field.
    There are about 7000 records.
    I tried the attached code- with no luck- am I in the
    ballpark?
    Thanks!
    newportri

    Sorry- yes the tables are in the same DB because I imported
    them together.
    I am trying to clean this DB up for eventual porting to SQL
    Server (it is in Access now) - I saw no good reason why the
    designer used 2 separate tables- one with most info on each vendor,
    but split the addresses off in another table?
    I guess there are lumpers and splitters- but I can't see the
    point of inserting/updating/deleting form 2 tables vs 1?
    ERROR: The field 'Vendor1.vendor_ID' cannot contain a Null
    value because the Required property for this field is set to True.
    Enter a value in this field.
    Thanks for your quick response.

  • Insertion of data between 2 tables ( 1 to * relationship )

    Hi all, I am new to Oracle ADF, I have a problem with the insertion of data between 2 tables (Table A and Table B), I have the ratio 1 to *, and I need to insert data in table B (* Relationship) when insert in Table A all goes well, but when inserted in Table B, I need the primary key value in Table A () in the value field in table B that is as foreign key.
    Ie
    Value Table A
    coda = 20 -> primary key
    Table B values
    1 set of values
    val_1,
    val_2,
    val_3,
    coda = 20 -> need this value is constant up to do a Commit.
    set of values 2
    val_1,
    val_2,
    val_3,
    coda = 20 -> need this value is constant up to do a Commit.
    How I can do it?
    thanks

    Thanks for you answers 'M.Jabr'
    I was wrong, because the relationship 1 to * between tables A and B, I was writing the groovy expression in each table, in this case in Table B (A.codSolicitude), but now I notice that within the DataControls, but specifically in the control data of Table A, there is a relationship between the board B, and I thought to insert into the related table that appears as a master/detail, and first inset in table A and then in Table B in the same page master/detail, and A.CodSolicitude value is automatically filled in Table B, and performed the Commit and everything works. !
    Thanks for you help.
    Now if you can give me some examples with images that are on the web similar to this problem would be great:) Thanks!

  • How to compare data between two tables?

    Hi,
    My team is trying to develop a SAP data migration tool (DMT) using ABAP.
    One of the functionalities in the DMT is to validate the data in the staging area against the loaded SAP data.
    The tables in the stagin area are customer tables (i.e. user-defined tables starting with Y, Z).
    How do I compare the data in the staging area against data that are loaded into SAP tables? Are there some built-in SAP functions to do this? Or, are there some better ways of doing this (e.g. instead of comparing against data in the SAP tables, we compare with some INTERNAL tables)?
    Any help would be greatly appreciated, thanks!

    Hi Kian,
    Use <b>SCMP</b> transaction to compare data between two tables and you can not use this for comparing internal tables.
    Thanks,
    Vinay

  • Compare table data between two schemas?

    Hi,
    I am looking for a script to compare the table data between the schemas (two different databases)? I know how to compare table by table but looking for a generic script where I can compare all the tables data from one schema to another schema?
    Thanks a lot...

    here the idea, adapt it with your needs :)
    Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
    Connected as SYS
    SQL> create user user1 identified by user1;
    User created
    SQL> grant create  session to user1;
    Grant succeeded
    SQL> grant create table to user1;
    Grant succeeded
    SQL> alter user user1 quota 10m on DATA;
    User altered
    SQL> create user user2 identified by user2;
    User created
    SQL> alter user user2 quota 10m on DATA;
    User altered
    SQL> grant create table to user2;
    Grant succeeded
    SQL> grant create  session to user2;
    Grant succeeded
    SQL> create table user1.test(a Number) tablespace DATA;
    Table created
    SQL> create table user2.test(a Number) tablespace DATA;
    Table created
    SQL> insert into user1.test values (1);
    1 row inserted
    SQL> insert into user1.test values (2);
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> insert into user2.test values (2);
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> create table sys.logs(Diff number) tablespace data;
    Table created
    SQL> select * from sys.logs;
          DIFF
    SQL>
    CREATE OR REPLACE PROCEDURE TEST_MY_DIFF IS
      CURSOR CUR_ IS
        SELECT D.TABLE_NAME T_NAME FROM DBA_TABLES D WHERE D.OWNER = 'USER1';
      W_DIFF NUMBER;
      TYPE CV_TYP IS REF CURSOR;
      CV CV_TYP;
    BEGIN
      EXECUTE IMMEDIATE 'TRUNCATE TABLE SYS.LOGS';
      FOR I IN CUR_ LOOP
        W_DIFF := 0;
        OPEN CV FOR 'select count(*)
    from
    ( select * from USER1.' || I.T_NAME || '
    minus
    select * from USER2.' || I.T_NAME || ' )
    union all
    ( select * from USER2.' || I.T_NAME || '
    minus
    select * from USER1.' || I.T_NAME || ')
        LOOP
          FETCH CV
            INTO W_DIFF;
          INSERT INTO SYS.LOGS VALUES (W_DIFF);
          COMMIT;
          EXIT WHEN CV%NOTFOUND;
        END LOOP;
      END LOOP;
    EXCEPTION
      WHEN OTHERS THEN
        NULL;
    END;
    SQL> BEGIN
      2  test_my_diff;
      3  end;
      4  /
    PL/SQL procedure successfully completed
    SQL> select * from sys.logs;
          DIFF
             1
             1

  • Data mismatch between TABLE and Std. Extract str. (AFPO & 2LIS_04_P_MATNR)

    Hi,
    I am getting data mismatch in ECC standard table and ECC standard extract structure. Please help me.
    I am using 2LIS_04_P_P_MATNR data source (standard extract structure).
    <b>I have following data in ECC Table (AFPO - Order Item).</b>
    AUFNR (Order Number) --> 4000460
    PGMNG (Total planned quantity)  --> 0
    PSMNG (ORDER QTY) --> 2000
    <b>Extract Structure is showing following data.</b>
    AUFNR (Order Number) --> 4000460
    PGMNG (Total planned quantity)  --> 2000 (It should be zero)
    PSMNG (ORDER QTY) --> 2000
    I have checked with many other order numbers. <b>The extract structure in RSA3 is showing correct values only if PGMNG is non-zero values. If PGMNG is zero, then it is automatically assigning PSMNG value.</b>
    Is this common? I want to display correct values for PGMNG from AFPO Table. Why this mismatch between table data and extract data. I have done  all required steps refreshing data (deleting setup tables, filling set up tables etc.).
    pls suggest. Poinsts will be assigned to every useful answer.
    Thanks in advance.

    Hi Avneet,
    I have a similar problem where in AFPO shows value 1000 in PSMNG field and 1200 in RSA3 for extractor 2LIS_04_P_MATNR.
    I have found that the standard feature of the extractor extracts the data at the time of release of process order. If the process order is changed after the release then the extractor will not picup the chagne.
    Ex: AFPO value 1000 ---BI Value 1000
    Now released in ECC
    AFPO value 1000 ---BI Value 1000
    In ECC value changed to 1500 after the release. BI will not pickup the change.
    Extractor is pulling the data from MCAFPOV table. You can check the values, there it matches with RSA3 values.
    I was just going thru forums for the solution. After i found the solution. I am just updating it.
    Hope it helps you.
    Thaks
    Srikanth

Maybe you are looking for

  • I have the original iPad and today 2 inches of the screen went to all color lines. Cant' work or play?

    I have the original ipad. Today 2 inches of the screen went to straight color lines. Can't change it! Can't read or work. HELP!!!! Please : )

  • SAP Roadmap

    Hi, I am new to SAP AS and SAP technology. I am interested in NetWeaver and did basic initial JSP / Servlet / EJB projects on latest SAP AS. I am quite comfortable in J2EE without any SAP background. Please let me know further roadmap in SAP world. T

  • Putting documents into notes

    OK, I just got my new 5gen 60 iPod last wednesday, been having no problems with it itself(had an isue with iTunes and no sound on videos, but got that taken care of with iSquint), but now I seem to be running into something of an issue. I have severa

  • What happened to "body" "contains" in filters?

    I have several filters that have "body" and "contains" that have stopped working. Opening these existing, and previously working, filters in edit shows the words "body" greyed out. Clicking OK I receive the message "This filter cannot be saved becaus

  • Organizational structure data retrieval

    Hi I am trying to retrieve a list of the first level of employees reporting to a manager using the .Net Connector. I have used the HRWPC_RFC_GET_OBJECTS rfc used by the Team Viewer iView with viewid="A_ALL". This returns all the employees under the m