How to move data from 2 internal table to 1 internal table

Can any body send me code that how to move data from 2 internal table into one internal table.
Moderator message : Read ABAP documentation. Thread locked.
Edited by: Vinod Kumar on Jun 13, 2011 11:45 AM

Hi Mohdarif92;
I don't know your full needs. But general method should be as below code.
Please check exam below code.
Best regards.
data : begin of gt_result.
            ... like mkpf-...
            ... like mkpf-...
            ... like mseg-...
            ... like mseg-...
          end of gt_result
select *
into table gt_mkpf
from mkpf where ...
select *
into table mseg
from mseg where ...
loop at gt_mkpf.
     loop at gt_mseg where ... = mkpf-...
        move-corresponding gt_mkpf to gt_result.
        move-corresponding gt_mseg to gt_result.
        append gt_result
     endloop.
endloop.

Similar Messages

  • How to move data from a staging table to three entity tables #2

    Environment: SQL Server 2008 R2
    I have a few questions:
    How would I prevent duplicate records, when/ IF SSIS is executed many times?
    How would I know that all huge volume of data being loaded in the entity tables?
    In reference to "how to move data from a staging table to three entity tables ", since I am loading large volume of data, while using lookup transformation:
    which of the merge components is best suited.
    How to configure merge component correctly. (screen shot is preferred) 
    Please refer to the following link
    http://social.msdn.microsoft.com/Forums/en-US/5f2128c8-3ddd-4455-9076-05fa1902a62a/how-to-move-data-from-a-staging-table-to-three-entity-tables?forum=sqlintegrationservices

    You can use RowCount transformation in the path where you want to capture record details. Then inside rowcount transformation pass a integer variable to get count value inside
    the event handler can be configured as below
    Inside Execute SQL task add INSERT statement to add rowcount to your audit table
    Can you also show me how to Check against destination table using key columns inside a lookup task and insert only non
    matched records (No Match output)
    This is explained clearly in below link which Arthur posted
    http://www.sqlis.com/sqlis/post/Get-all-from-Table-A-that-isnt-in-Table-B.aspx
    For large data I would prefer doing this in T-SQL. So what you could do is dump data to staging table and then apply
    T-SQL MERGE between tables (or even a combination of INSERT/UPDATE statements)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to extract data from info cube into an internal table using ABAP code

    HI
    Can Anyone plz suggest me
    How to extract data from info cube into an internal table using ABAP code like BAPI's or function modules.
    Thankx in advance
    regds
    AJAY

    HI Dinesh,
    Thankq for ur reply
    but i ahve already tried to use the function module.
    When I try to Use the function module RSDRI_INFOPOV_READ
    I get an information message "ERROR GENERATION TEST FRAME".
    can U plz tell me what could be the problem
    Bye
    AJAY

  • How to read data from a CLUSTER STRUCTURE not cluster table.

    Hi,
    how to read data from a CLUSTER STRUCTURE not cluster table.
    regards,
    Usha.

    Hello,
    A structre doesnt contain data.. so u cannot read from it. U need to find out table of that structure and read data from it.
    Regards,
    Mansi.

  • How to delete data from single field in a database table?

    Hi guys,
         Plz suggest me How to delete data from single field in a database table?
    thnks,
    pavan

    hi
    in addition to abv details..chk this:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
    http://dev.mysql.com/doc/maxdb/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm
    regards,
    madhu

  • How to retrieve data from domain(Value Range)  of the table

    hi
    how to retrieve data from domain(Value Range)  of the table
    thanks

    Hello,
    You can try using the FM: DOMAIN_VALUE_GET TB_DOMAINVALUES_GET.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 24, 2009 10:08 AM

  • HOW TO MOVE DATA FROM INT-TABLE TO DATABASE STRUCTURE?

    DEAR ALL!
    CAN ANY ONE GIVE ME SAMPLE CODE TO MOVE DATA FROM INT -TABLE TO DB-STRUCTURE PLEASE.
    I HAVE THE VALUES IN TABLE AND I NEED TO UPDATE STRUCTURE.
    REGARDS,
    VJ

    Hi,
       If you want to update a db STRUCTURE it is not possible because Structure doesnot hold any data.
    If you are trying to update a db table  then the update command should do the work.
    Eg : UPDATE VBPA3 FROM TABLE DA_XVBPA3U.
    Note :  The Internal table should be of same structure and should not have duplicate entries.
    Regards,
    Srini.

  • How to extract data from xml and insert into Oracle table

    Hi,
    I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
    There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
    I need to extract the values of these columns and insert into the table
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>

    Re: Insert from XML to relational table
    http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=

  • How to fetch data from bseg based  on 2 internal tables in 1 select query?

    hi,
    i have bukrs and belnr in one internal table and bukrs and vbeln in another internal table..now if i select from bseg twice using for all entries for fields bukrs vbeln and bukrs belnr twice in 2 select statements its fine..but since bseg is a huge table i want to use select only once..but the problem is that none of the belnrs in the one internal table will have vbeln in another internal table....ie if vbeln is selected from bseg based on belnr in 1 internal table non eof those vbeln will be equal to vbeln on another internal tables..in this scenario even if i take all data from two internal tables into 1 single internal table and then use for all entries on vbeln and belnr of that table ..but i think this will not work because and AND operator will not work because no record will satisfy both vbeln and belnr conditions..even if i use OR operator if the 1st condition satisfies the select clause will not enter into the second clause and all the records will not be fetched...Please help how should i tackle this..

    Hi vijaya,
    no simple select statement solution so far.
    As BSEG is a huge table you should try to get the full key values into another internal table first.
    SAP avoids direct selections from BSEG.
    Pleas consider the use of one of the secondary index tables first:
          BSAD : Accounting: Secondary Index for Customers (Cleared Items)
          BSAK : Accounting: Secondary Index for Vendors (Cleared Items)
          BSAS : Accounting: Secondary Index for G/L Accounts (Cleared Item
          BSEC : One-Time Account Data Document Segment
          BSEG : Accounting Document Segment
          BSID : Accounting: Secondary Index for Customers
          BSIK : Accounting: Secondary Index for Vendors
          BSIS : Accounting: Secondary Index for G/L Accounts
    you may include
          BKPF : Accounting Document Header
    for restrictions about time and document type.
    The last step is a FOR ALL ENTRIES selection from BSEG providing the full key values.
    Although you may have even more selects, the overall performance will be much better.
    Regards,
    Clemens

  • How to Copy data from field symbol to Dynamic Internal Table

    Hi,
    I want to copy the data between two dynamic Internal tables . Following is the code were I have data in the field symbol wanted to transfer it to the other Internal table :
    REPORT  ztest.
    DATA:
           gd_dref          TYPE REF TO data,
           gd_dref1          TYPE REF TO data.
    FIELD-SYMBOLS:  <fs1>   TYPE any,
                               <fs_wa> TYPE any,
                                <field>    TYPE any,                  
                                <fs_wa1> TYPE ANY TABLE.  * Contains data from p_src
    *Copy data from p_src to p_dest*
    PARAMETERS: p_src LIKE dd02l-tabname .    * Name of Dynamic Internal table *
                             p_dest LIKE dd02l-tabname .  * Name of Dynamic Internal table*
    *DATA : lt_csks LIKE p_dest WITH HEADER LINE.
    START-OF-SELECTION.
      CREATE DATA gd_dref TYPE (p_src).
      CREATE DATA gd_dref1 TYPE TABLE OF (p_src).
       ASSIGN gd_dref->* TO <fs_wa>.
       ASSIGN gd_dref1->* TO <fs_wa1>.
       SELECT * FROM (p_src) INTO TABLE <fs_wa1>.
    *Write out data from FIELD SYMBOLS TO Table.
       loop at <fs_wa1> into <fs_wa>.
         do.
           assign component  sy-index
              of structure <fs_wa> to <field>.
           if sy-subrc <> 0.
           exit.
           endif.
           if sy-index = 1.
             write:/ <field>.
           else.
           write: / <field>.
           endif.
         enddo.
       endloop.
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    *p_dest is a table having a similar structure to table p_src .
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    EXIT.
    Thanks in Advance.

    try this...
    I have extended your source code and just used vbak/vbap as an example as they have some common fields like vbeln/erdat etc which corresponds with your requirement of 'similar structure' i.e. shared/common fields in both.
    Cheers...
    report  ztest.
    data:
      gd_dref type ref to data,
      gd_dref1 type ref to data,
      gd_dref_str type ref to data,
      gd_dref_tab type ref to data.
    field-symbols:
      <fs1> type any,
      <fs_wa> type any,
      <fs1_dest_str> type any,
      <fs_dest_tab> type any table,
      <field> type any,
      <fs_wa1> type any table.
    * contains data from p_src
    *Copy data from p_src to p_dest*
    parameters: p_src like dd02l-tabname default 'vbak',
    * name of dynamic internal table *
                p_dest like dd02l-tabname default 'vbap'.
    * name of dynamic internal table*
    *data : lt_csks like p_dest with header line.
    start-of-selection.
      create data gd_dref type (p_src).
      create data gd_dref1 type table of (p_src).
      assign gd_dref->* to <fs_wa>.
      assign gd_dref1->* to <fs_wa1>.
      select * from (p_src) into corresponding fields of table <fs_wa1>
      up to 3 rows
      where vbeln ne space.
      create data gd_dref_str type (p_dest).
      create data gd_dref_tab type standard table of (p_dest).
      assign gd_dref_str->* to <fs1_dest_str>.
      assign gd_dref_tab->* to <fs_dest_tab>.
    *write out data from field symbols to table.
      loop at <fs_wa1> into <fs_wa>.
        " break-point here - can see vbeln/waers/create date/ etc move over to new structure
        " the 'common' fields of your structures - the same will happen. if they not the same name you will have to do an
        " explicit move i.e. if fieldname = xyz ....move fieldxyz to new field123....after the move-corre
        break-point.
        move-corresponding <fs_wa> to <fs1_dest_str>.
        insert <fs1_dest_str> into table <fs_dest_tab>.
    **    do.
    **      assign component  sy-index
    **         of structure <fs_wa> to <field>.
    **      if sy-subrc <> 0.
    **        exit.
    **      endif.
    **      if sy-index = 1.
    **        write:/ <field>.
    **      else.
    **        write: / <field>.
    **      endif.
    **    enddo.
      endloop.
      " write out some dest data from the dest table build from previous loop
      loop at <fs_dest_tab> assigning <fs1_dest_str>.
        do.
          assign component sy-index of structure <fs_wa> to <field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <field>.
          else.
            write: / <field>.
          endif.
        enddo.
      endloop.

  • How to import data from a text file into a table

    Hello,
    I need help with importing data from a .csv file with comma delimiter into a table.
    I've been struggling to figure out how to use the "Import from Files" wizard in Oracle 10g web-base Enterprise Manager.
    I have not been able to find a simple instruction on how to use the Wizard.
    I have looked at the Oracle Database Utilities - Overview of Oracle Data Pump and the Help on the "Import: Files" page.
    Neither one gave me enough instruction to be able to do the import successfully.
    Using the "Import from file" wizard, I created a Directory Object using the Create Directory Object button. I Copied the file from which i needed to import the data into the Operating System Directory i had defined in the Create Directory Object page. I chose "Entire files" for the Import type.
    Step 1 of 4 is the "Import:Re-Mapping" page, I have no idea what i need to do on this page. All i know i am not tying to import data that was in one schema into a different schema and I am not importing data that was in one tablespace into a different tablespace and i am not R-Mapping datafiles either. I am importing data from a csv file.
    For step 2 of 4, "Import:Options" page, I selected the same directory object i had created.
    For step 3 of 4, I entered a job name and a description and selected Start Immediately option.
    What i noticed going through the wizard, the wizard never asked into which table do i want to import the data.
    I submitted the job and I got ORA-31619 invalid dump file error.
    I was sure that the wizard was going to fail when it never asked me into which table do i want to import the data.
    I tried to use the "imp" utility in command-line window.
    After I entered (imp), i was prompted for the username and the password and then the buffer size as soon as i entered the min buffer size I got the following error and the import was terminated:
    C:\>imp
    Import: Release 10.1.0.2.0 - Production on Fri Jul 9 12:56:11 2004
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Username: user1
    Password:
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Import file: EXPDAT.DMP > c:\securParms\securParms.csv
    Enter insert buffer size (minimum is 8192) 30720> 8192
    IMP-00037: Character set marker unknown
    IMP-00000: Import terminated unsuccessfully
    Please show me the easiest way to import a text file into a table. How complex could it be to do a simple import into a table using a text file?
    We are testing our application against both an Oracle database and a MSSQLServer 2000 database.
    I was able to import the data into a table in MSSQLServer database and I can say that anybody with no experience could easily do an export/import in MSSQLServer 2000.
    I appreciate if someone could show me how to the import from a file into a table!
    Thanks,
    Mitra

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • How to calculate the total of absences? How to collect data from a specific line of a table?

    Hi,
    Again, I made a nice coloured picture from a screen capture which summarise the improvements that I would like to make in my form,
    Situation:
    For an educational purpose, I made this form   to simplify the way of recording the data and also to develope the independence of the students.
    ( I am doing this on a voluntary basis, working extra hours on my free time but I don't really mind because I am learning a lot of things in the same time)
    After being tested by the teacher, the student has to record the short date, the lines memorised, his grade, number of mistakes, and his attendance.
    I created everything in Word, then converted the file in PDF, then I created all the different fields with Adobe acrobat.
    There is in total 4 sheets, there are all similar except the first one in which there is a box with: date started, date finished, total time spent, absences.
    Below this box there is a table with 16 lines from (A to P) and 7 columns (Days, Date, From.. to.. , Grade, No. lines memorised, No. Errors, Attendance) ( so this table is present on all the sheets)
    Due to the fact that some students need more time than others, and also beacause some text need more time, I estimated a need of 4 sheets at the very most.
    I would like to make the following amelioration and automate the inputting of some of the data because I know that some of the students will certainly forget, so to avoid this scenario I am trying to make this form the easiest possible.
    screen capture of the form:
    screen capture of the form editing, you can see the names of the different fields:
    here is the form (only the first page) : http://cjoint.com/12fe/BBotMMgfYIy_memorisation_sheet_sample.pdf
    In  yellow 00000:
    At present, the students has to input the total of absences manually, is there a way ( script) to automate this by initialising the field next to "Absences" at  " 0 day"   and then everytime that Absent is selected from the COMBO BOX, it add 1 and it is displayed like this:  " 1 day" then " 2 days"  then " 3 days" etc … (so from what I read I have to initialise a counter a the beginning and then for (i...   ) count= count++; something like this...
    Furthermore, I need a solution to overcome the possibility that a second sheet may be needed for the same student; therefore I would need the data from the "attendance column" from the second sheet ( and perhaps the 3rd and 4th aswell) to be added on the "absences field" in the first sheet
    My idea: everytime that the short date is inputted in the first line (next to A) in the "Date" column of one of the 4 sheets then we check the 16 Combo box of the attendance column in this sheet instead to check 16*4=64 fields fot the 4 sheets in one go?
    but I don't know at all how to write it in Javascript. Or perhaps there is a way more easier than that?
    Shall I allocate a value for Absent on the “ export value”?
    In purple
    At present I wrote a simple script which matches the number of lines to the poem selected (Eg.  if I select the poem V.Hugo,  the number "36" will appear next to Number of lines).
    Again I would like the make the life of the students very easy so I would like a script which detects this number “36” on the "From .. to …" column,  as soon it is detected (on the first sheet or 2nd or 3rd or 4th)  check from the same line if "A / Pass" or "B / Pass" have been selected in the "Grade" column ,if yes the short date inputted on this line will be written on the field next to "Date finished" .
    this is a simple example with 36 lines only but somethimes, the students may have to memorise 80 lines and more, this is the reason for having 4 sheets in total.
    So basically I would like to automate the field next to" Date finished:" with a script that collect the short date from the day in which the student has finished his memorisation with "A / Pass" or "B / Pass"
    As for the "Total time spent" George Johnson helped me with a script that calculate the difference betwen date started and date finished (thank you)
    I am sollicting your help, because after trying for hours I was really confused with the different if/else needed. And in top of that, it’s my first experience with Javascript.
    I anticipate your assistance, thanking you in advance.

    I found this for counting the absences, its give you the total that's perfect, but is there a better methode which avoid me to write all the fields name, more simple????
    ( I found the idea here : Re: Total number added automatically  )
    // custom calculation script for field "Total #"
    function CountFields(aFields) {
    var nFields = 0;
    for(i = 0; i < aFields.length; i++) {
    try {
    // count null values, export value of Absence is 0;
    if(this.getField(aFields[i]).value == "0") nFields++;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to count
    var aNames = new Array("Sheet1AttendanceA","Sheet1AttendanceB","Sheet1AttendanceC","Sheet1AttendanceD","Sh eet1AttendanceE","Sheet1AttendanceF",
    "Sheet1AttendanceG","Sheet1AttendanceH","Sheet1AttendanceI","Sheet1AttendanceJ","Sheet1Att endanceK","Sheet1AttendanceL",
    "Sheet1AttendanceM","Sheet1AttendanceN","Sheet1AttendanceO","Sheet1AttendanceP" );
    // count the non-null fields;
    event.value = CountFields(aNames);
    As for the 2nd question, I've tried to do something similar to the previous script, but of course it doesn't work, but I am quite sure that the idea is similar:
    I don't know also how to add the other condition: the student should get A / Pass or B / Pass in order to consider he has finished??? and also how to check these condition from page 2, 3 and 4 and collect the date
    function Datefinished(bFields) {
    d2.value = nFields[i].value;
    for(i = 0; i < aFields.length; i++) {
    try {
    if(this.getField(aFields[i]).value == this.getField("NumberLines").value) d2.value = nFields[i].value;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to check
    var aNames = new Array("Texte00","Texte54","Texte56","Texte58","Texte60","Texte62","Texte64","Texte66","Te xte68","Texte70","Texte72","Texte74","Texte76","Texte78","Texte80","Texte82");
    var bNames = new Array("d1","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","d13","d14 ","d15","d16","d17");   // d1 is included because in some cases a student can finish in 1 day (short text);

  • How to fetch data from database in javafx 2.2 table which is editable.

    Dears!
    I want to fetch data from database in javafx 2.2 tableformat with jdbc , which is also editable and i can add more records in this table also.
    Can anybody help me

    I can vaguely recall some sort of JavaFX database connectivity feature, I'm not sure if it's valid anymore.The link is based on JavaFX Composer which only applied to NetBeans 6.9 and JavaFX 1.x (both of which are now dead techs).
    There is a good chance you will have to write your own. There are several blogs describing other peoples' work. You could probably use them as a reference.Here is Narayan's basic [url http://blog.ngopal.com.np/2011/10/19/dyanmic-tableview-data-from-database/] tutorial for displaying data from a database in a TableView, you'll need to look elsewhere for the editing portion.
    The [url http://docs.oracle.com/javafx/2/ui_controls/table-view.htm]JavaFX TableView tutorial gives info about how to handle edits in a TableView, but you will need to tie the updates back to the database yourself.
    It is possible that [url http://www.javafxdata.org/]DataFX may provide some facilities to help support you.

  • How to move data from one database to another one?

    I 'd like to build up a new database, some of the data would come from an old database, then I have to make two connection objects to both databases, (two statement objects...) retrieving the data from the old one and inserting them to the new one.... sounds reasonable, huh? but it could not work this way... "........it would have caused the duplicated value , blah, blah..." even though I made two tables in two databases completely different, that errors are still there. seemed I cannot clone that table.
    could you guys have any better ideas? and why couldn't I go this way?
    the database: cloudscape3.01
    two databases are all on my local PC (WinNT4.0)
    thanks

    If you are getting dupicate record errors, then look at your recordset objects and make sure they are both pointing at seperate databases, and check the one you are using to output and make sure it isn't just writing NULL, if it is then trace up the line: your input (read) recordset may be reading NULL too.

  • How to read data from spreadsheet as a look up table

    Hello Can anybody please help me out in this..??
    I want to read data from a spreadsheet file as it is a look up table.
    I want to create a program which lets the user enter an element which is be found in the data in the spreadsheet file and gives back the number which is to the adjoining column of the element in the spreadsheet file.
    Example i have the following data in spreadsheet file:
    Range  Count
    2              10
    4              49
    6              60
    Etc.
    If i enter 2 to search the data in the spreadsheet file, i do expect the program replies back with the answer 10 and so on...
    Can anyone please help out...
    Thanks in advance...

    apok wrote:
    Why autoindex the output?  You should only have 1 output.  Besides, the Search 1D Array is simpler (no loop needed).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Lookup Table.png ‏11 KB

Maybe you are looking for