Compare table A and table B and update table B ,,,,table B has 300k rows
Hi,
I m trying to write a code, I have tables A and table B.
I need to compare table A and table B , and update table B with one column.
using joins b/w A&B tables, I selected one record from table A in cursor.
After Begin I m trying to open cursor and in FOR LOOP
Im trying to update table B WHERE CURRENT OF Cursor.
this is erroring out.
could you let me know on this.
there is another way like selecting required columns from both table.but i was told to do as above.
Thanks
> this is erroring out.
You haven't posted nearly enough for anyone to help you. You didn't even tell us what error you are getting.
So about the only thing we can do is post a generic MERGE statement which you'll have to modify for your use.
merge into tableB b
using (select some_key, some_column from tableA where etc.) u
on (u.some_key = b.some_key)
when matched then update
set b.some_column = u.some_column;
Similar Messages
-
Compare 45 columns and update one table col
I am using Oracle 9i database.I need to compare each record between two tables
and update the one of table column (what records are updated)
CURSOR cur1 is select t1., t2. from t1, t2 where t1.primarykey = t2.primarykey
FOR rec1 IN cur1
LOOP
IF rec1.t1_col_1<>rec1.t2_col_1
then
update t1
set col_t1.rem="MOdified",t.col_1=rec1.t2_col_1
where t1.primerykey=rec1.primarykey
END IF;
IF rec1.t1_col_2<>rec1.t2_col_2
then
update t1
set col_t1.rem="MOdified",t.col_2=rec1.t2_col_2
where t1.primerykey=rec1.primarykey
END IF;
..........45 if else conditions
END LOOP;
I have 1 million records to compare and 45 columns to compare, how do I increase performance.
Currently it takes about 5hrs for the cursor to go through this if -else comparison.
Thanks and Regards
Swayamprakash.ChiluveruHi Swayamprakash,
Few basics first.
1. DML SQL's perform better than PL/SQL. Sounds great but Oracle then need to hop between SQL and PL/SQL engine for every record in the cursor causing THRASHING. This is an old concept, reference of which can be found in Operating Systems.
With Bulk Collect option, this could be minimized to a large extent, but causes a large amount of Undo being generated. This is another pitfall of using Bulk Collect. Morever, when you expect more percentage of records to be updated, it is advisable that the indices (if any) must be disabled. They can be rebuild afterwards causing very minimal amount of Undo. Performance gain is expected here.
Now a query that you need to clarify:
1. One million records to be updated on a diurnal basis - An OLTP database might need this functionality which is better handled by a screen driven interface rather than a SQL/Procedure running in background.
An OLAP database must simply ignore such requirements for they are meant to be history archives.
Suggestion:
Merge - Seems to be the only optimal solution at the moment for the exact requirements are unclear. Already, somone has suggested this.
Oracle Developers, DBA's must setp out from technicalities and turn towards functionality.
Kind regards,
Abhijit -
my ipad is in recovery mode and eveytime i go to restore and update a message comes up saying error has occured 3194
Yes, I'm having the same problem. My iPad Air worked great on OS 7xx but since updating to 8.01 and now 8.1, the display went crazy. Now, I'm also stuck in the restore loop and the iPad is useless. Oops, it finally looks as if it is going to restore as I'm writing, we will see what happens. All my data was erased as well.
All for nothing, itunes says the device has been wiped but it will not start (the screen glows and that is all.) -
Compare same first and last name that exists in 2 different rows!
Dear All,
I am using Oracle 11gR1 on Linux OS.
I have a table that stores employee_id, emp_first_name, emp_last_name, hire_date
The records may be like this:
14210, imran, baig, 12-MAR-10
10673, mobeen, ahmed, 14-MAR-10
10060, saad, qureshi, 16-MAR-10
6902, abdul, aleem, 18-MAR-10
33652, imran, baig, 22-OCT-10
55522, mobeen, ahmed, 22-OCT-10
I need the output in this format: same names are to be shown in one row with old and new hire dates and IDs.
14210, imran, baig, 33652, 12-MAR-10, 22-OCT-10
10673, mobeen, ahmed, 55522, 14-MAR-10, 22-OCT-10
Thank you very much.
Regards, ImranHi, Imran,
If there will be (at most) only two rows with the same name, then you could do a self-join.
If there could be a variable number of rows with the same name, then you probably need String Aggregation . The following page shows several techniques for doing string aggregation:
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
LISTAGG, as Pavan Kumar suggested, is the best of these. Unfortunately, it doesn't work in versions earlier than 11.2.(That's why the site mentions the others.)
If the order or the output is not important, then I recommend the user-defined aggregate function, called STRING_AGG on that site, but called STRAGG by most people.
If the order of the output is significant, then I recommnend the SYS_CONNECT_BY_PATH approach.
If you'd like help, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data, formatted between \ tags.
In the future, if you have a question like "How can I write a query to ...?", you should post it in the SQL forum:
PL/SQL
You'll propably get better response there. -
Since I upgraded to iphoto 11, I have not be able to access my photos without the program locking up, not respondiong, and shutting down. iphoto has went into repair on its own, but still shuts down. I have sent in reports each time, but have not figured out the problem. Has anyone else had this problem?
Post the first 50 - 100 lines of the crash log?
As a Test:
Hold down the option (or alt) key and launch iPhoto. From the resulting menu select 'Create Library'
Import a few pics into this new, blank library. Is the Problem repeated there?
Post back with the result. -
Select and update rownum sender jdbc
Dear all
i am using PI 7.31 sender jdbc adapter.
table(TB_AA) has 10000 row with pi_stat = 'R' and then sender jdbc adapter tried 10 row in using rownum every 120 second and update same rownum
but result of select query and udpate query were different. not same record update for selecting data.
co_cd, memid is PK.
select co_cd , mem_id, reg_n FROM TB_AA where PI_STAT = 'R' AND rownum <= 10
update TB_AA set PI_STAT = 'S', where PI_STAT = 'R' and rownum <= 10
query is wrong? , what is correct update query with several PK ?Hi Arten Solohin.
co_cd, memid is Primary Key.
select co_cd , mem_id, reg_n FROM TB_AA where PI_STAT = 'R' AND rownum <= 10
update TB_AA set PI_STAT = 'S', where PI_STAT = 'R' and rownum <= 10
could you make your query with above my query ? because i am confusing ORDER BY <your unique id_field> AND LINE_ID ....
will be highly appreciated in advance
thanks you very much. -
Comparing Two tables with 300k records and update one table
Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
Column B has same data in both the tables.
I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
I m trying to do using PLSQL Tables.
Any suggestion?
Thanks.Hi,
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results will be the contents of the changed table(s) when everything is finished.
Always say which version of Oracle you're using (for example, 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
ef2019c7-080c-4475-9cf4-2cf1b1057a41 wrote:
Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
Column B has same data in both the tables.
I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
I m trying to do using PLSQL Tables.
Any suggestion?
Thanks.
Why are you trying to use PL/SQL tables? If tabl_1 and tabl_2 are regular database tables, it will be much simpler and faster just to use them.
Depending on your requirements, you can do an UPDATE or MERGE, either in SQL or in PL/SQL. -
Compare table structure and add the missing columns
Hello,
I want to compare the table schema of two tables and update with some plsql code the second one with the missing columns of the fist one :
Example
SQL> desc a
Name Type Nullable Default Comments
C1 VARCHAR2(10) Y
C2 NUMBER(3) Y
C3 NUMBER(10,2) Y
SQL> desc b
Name Type Nullable Default Comments
C1 VARCHAR2(10) Y
C2 NUMBER(3) Y
I want a script that will generate the following code
alter table b add (c3 number(10,2))
Thanks
AndreasHow abt the below mentioned code
SQL>desc a
Name Null? Type
C1 VARCHAR2(30)
C2 NUMBER(3)
C3 NUMBER(10,2)
C4 NOT NULL DATE
C5 VARCHAR2(30)
SQL>desc b
Name Null? Type
C1 VARCHAR2(30)
SQL>ed
Wrote file afiedt.buf
1 Declare
2 Cursor c1 is select Column_name,Data_length,Data_type,DATA_PRECISION,DATA_SCALE,
3 Nullable
4 From User_tab_columns
5 Where Table_name = 'A';
6 v_length Number;
7 v_str Varchar2(200);
8 v_null Varchar2(10);
9 Begin
10 For c2 in c1 loop
11 Select count(1) into v_length
12 From user_tab_columns
13 Where Table_name = 'B'
14 And Column_name = c2.column_name;
15 if v_length = 0 Then
16 Select Decode(c2.Nullable,'N','NOT NULL','') into v_null From Dual;
17 if c2.Data_type = 'NUMBER' Then
18 v_str := 'alter table b add '||c2.column_name||
19 ' '||c2.data_type||'('||c2.data_precision||','||c2.data_scale||') '||
20 v_null;
21 Elsif c2.Data_type = 'DATE' Then
22 v_str := 'alter table b add '||c2.column_name||
23 ' '||c2.data_type||' '||v_null;
24 Else
25 v_str := 'alter table b add '||c2.column_name||
26 ' '||c2.data_type||'('||c2.data_length||') '||v_null;
27 End if;
28 Execute immediate v_str;
29 End if;
30 End loop;
31* End;
SQL>/
PL/SQL procedure successfully completed.
Elapsed: 00:00:04.03
SQL>desc b
Name Null? Type
C1 VARCHAR2(30)
C2 NUMBER(3)
C3 NUMBER(10,2)
C4 NOT NULL DATE
C5 VARCHAR2(30) -
Delta Calculation and Updating multiple tables
We pull data from a System of Records table that contains the most up to date information. The information changes daily so we have a delta process to identify what new records were added, which records were deleted (records that are not found in the table as compared to yesterday) and which were updated. Delta process compares the already loaded data with the newly updated SOR data to find the differences.
Once the delta is established, either new records get added or existing records get updated or existing records are marked as inactive (Deletes). Additions and Updates generally happen across multiple destination tables.
Updates are identified by looking at different columns to see if any one column is changed. These columns end up in different tables.
Example
Source Delta Table, S1
ID COL1 COL2 COL3 ACTION
1 abc xyz pqr A
2 bcd lmn def U
S1.Col1 maps to Destination Table D1.Col23
S1.Col2 maps to Destination Table D2.Col45
S1.Col3 maps to Destination Table D3.Col11
Currently all tables are updated irrespective of whether the relevant data has changed or not (All 3 destination tables are updated).
I would like to know which of the Columns for a given row has changed values so that I can update only the relevant tables.
Thus if additional columns are available that act as flags
Source Delta Table, S1
ID COL1 COL2 COL3 ACTION COL1 COL2 COL3
1 abc xyz pqr A - - -
2 bcd lmn def U N Y N
3 kjh qwe iop U Y Y N
then for incoming ID=2, I just have to update Destination Table D2 and not D1 and D3
for incoming ID= 3, I have to update Destination Tables D1 and D2 but not D3.
How can I achieve that?
This is mainly to improve performance as the processing time is very short - Faster the delta processing, better will it be.
Thanks in advance.Thanks for your response.
My question was more towards establishing what has changed.
Given a table, which is updated daily, how does one efficiently establish which data has changed?
Here is an example to clarify my question further
The Source table has the following data on a particular day
Data in Source table on Monday
ID Col1 Col2 Col3
1 abc bcd cde
2 def efg fgh
3 ghi hij ijk
4 jkl klm lmn
Copy of the above data is stored in a Old Data table
Data in Source table on Tuesday
ID Col1 Col2 Col3
1 bac bcd cde
2 def gfe fgh
3 ghi jih jik
5 mno nop opq
Data in Source Table is compared with data in Old Data Table
Delta established by comparing Source Table with Old Data Table
ID Col1 Col2 Col3 Delta_Flag
1 bac bcd cde U
2 def gfe fgh U
4 D
5 mno nop opq A
Rows with IDs 1 & 2 were updated - thus to be updated
Row with ID 3 - no change so not seen in delta
Row with ID 4 was not found - thus to be deleted
Row with ID 5 was new - To be added
I can do the above easily. I would like to a step further to be able to say for updates
Row with ID 1 has Col1 changed
Row with ID 2 has Col2 and Col3 changed
Is there an easy way to do this? -
Importing a Flat File to Oracle and updating another table
Hey everyone,
I am a newbie with Oracle, and I've tried for the last 2 days to solve this problem below. But all my searches and attempts have failed.
I have a text file called ReturnedFile.txt. This is a comma separated text file that contains records for two fields.... Envelope and Date Returned.
At the same time, I have a table in Oracle called Manifest. This table contains the following fields:
Envelope
DateSentOut
DateReturned
I need to write something that imports the ReturnedFile.txt into a temporary Oracle table named UploadTemp, and then compares the data in the Envelope field from UploadTemp with the Envelope field in Manifest. If it's a match, then the DateReturned field in Manifest needs updated with the DateReturned field in UploadTemp.
I've done this with SQL Server no problem, but I've been trying for two days to make this work with Oracle and I can't figure it out. I've been trying to use SQL*Loader, but I can't even get it to run properly on my machine.
I did create a Control file, saved as RetFile.ctl. Below is the contents of the CTL file:
LOAD DATA
INFILE 'C:\OracleTest\ReturnedFile.txt'
APPEND
INTO TABLE UploadTemp
FIELDS TERMINATED BY "'"
ENVELOPE,
DATERETURNED
If I could get SQL*Loader running, below is the code I came up with to import the text file and then to do the compare to the Manifest table and update as appropriate:
sqlldr UserJoe/Password123 CONTROL=C:\OracleTest\RetFile.ctl LOG=RetFile.log BAD=RetFile.bad
update Manifest m set m.DateReturned =
(select t.DateReturned
from UploadTemp t
where m.Envelope = t.Envelope
That's all I got. As I said, I can't find a way to test it and I have no idea if it's even close.
PLEASE...can anyone assist me? Am I even close on this thing?
JoeIf your ReturnedFile.txtfile is comma separated then you need TERMINATED BY "," not TERMINATED BY "'" in your control file. If there happens to not be an ending comma in any row, then you also need to add TRAILING NULLCOLS to your control file. You should also use a date format for your date in your control file that corresponds to the date format in your ReturnedFile.txt file, in case it does not match the date format on your system. You need to add a WHERE EXISTS clause to your update statement to prevent any rows that do not match from having the DateReturned updated to a null value. Please see the example below. If this does not help then please do a copy and paste as I did, that includes a few rows of sample data and table structure. It would also help to see your SQL*Loader log file or a SQL*Loader error message. If you can't get SQL*Loader to run properly, then you may have other issues, such as file permissions at the operating system level. There are also other options besides the methods below. For example, you could use an external table, instead of SQL*Loader, if your ReturnedFile.txtfile is on your serer, not your client. You could also use merge instead of update.
SCOTT@orcl_11gR2> host type returnedfile.txt
env2,03-07-2013
env3,04-07-2013
env4,05-07-2013
SCOTT@orcl_11gR2> host type retfile.ctl
LOAD DATA
INFILE 'ReturnedFile.txt'
APPEND
INTO TABLE UploadTemp
FIELDS TERMINATED BY ","
trailing nullcols
(ENVELOPE
, DATERETURNED date "dd-mm-yyyy")
SCOTT@orcl_11gR2> create table uploadtemp
2 (envelope varchar2(15),
3 datereturned date)
4 /
Table created.
SCOTT@orcl_11gR2> create table Manifest
2 (Envelope varchar2(15),
3 DateSentOut date,
4 DateReturned date)
5 /
Table created.
SCOTT@orcl_11gR2> insert all
2 into manifest values ('env1', sysdate-7, sysdate-3)
3 into manifest values ('env2', sysdate-6, null)
4 into manifest values ('env3', sysdate-5, null)
5 select * from dual
6 /
3 rows created.
SCOTT@orcl_11gR2> select * from manifest
2 /
ENVELOPE DATESENTO DATERETUR
env1 28-JUN-13 02-JUL-13
env2 29-JUN-13
env3 30-JUN-13
3 rows selected.
SCOTT@orcl_11gR2> host sqlldr scott/tiger CONTROL=RetFile.ctl LOG=RetFile.log BAD=RetFile.bad
SQL*Loader: Release 11.2.0.1.0 - Production on Fri Jul 5 13:15:06 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 3
SCOTT@orcl_11gR2> select * from uploadtemp
2 /
ENVELOPE DATERETUR
env2 03-JUL-13
env3 04-JUL-13
env4 05-JUL-13
3 rows selected.
SCOTT@orcl_11gR2> update Manifest m
2 set m.DateReturned =
3 (select t.DateReturned
4 from UploadTemp t
5 where m.Envelope = t.Envelope)
6 where exists
7 (select t.DateReturned
8 from UploadTemp t
9 where m.Envelope = t.Envelope)
10 /
2 rows updated.
SCOTT@orcl_11gR2> select * from manifest
2 /
ENVELOPE DATESENTO DATERETUR
env1 28-JUN-13 02-JUL-13
env2 29-JUN-13 03-JUL-13
env3 30-JUN-13 04-JUL-13
3 rows selected. -
How can i compare tables of same type and in different schemas
Hi all,
i have one table "employee" in schema 'Master'.
And i have the same table +(total structure is same as master schema employee table with some additional columns).+ in Audit schema.
So, when i do update or delete on the "master.employee" table the previous record (entire record) will go into
"Audit.employee" table, and my "master.employee" table is having the existing record.
So now, i want to generate one excel report containing or comparing the existing record from master and previous record from Audit. And my Input fields are " schema_name " and "Table_name".
Ex. i will give masters.employee.
So it has to search the same table in Audit schema compare the values and generate output.Hello,
Here is the Oracle Forms forum, and your question has really nothing to do with this product.
Please, send this kind of question in the database forum, you would increase your chances to get the appropriate answer.
Francois -
Browse and update database tables
I'm looking for a tool that will let me connect to an Oracle database, select a table and some fields off the table and build a simple java class to navigate / update the data.
Essentially, I'm looking for a tool that replicates the way Microsoft Access can build a form for navigation and update of a database table.
However, I want to use java, not MS Access.
Any ideas if such a tool is available ?
Thankshttp://squirrel-sql.sourceforge.net/
-
Analysing and Updating a table
Hi,
Can anyone help me on follwing query..
Can analyse of a table and updation on to same table can happen paralley?
thank in advance.What's your db version? The very first thing is that you should not use the analyze command but dbms_stats package. Now , I am not sure why you want to gather the stats and update the table at the same time? As mentioned by Erica, the update should be followed with the stats gathering. And about the index usage, there are couple of things that can stop index from being used, for example, low selectivity on the column can very well stop the index. Other than that, if you are accessing the column containing the index alone and the column is supposed to contain the null values, oracle would rather use a FTS than using the index which actually makes perfect sense since use of index would result in incorrect data. So there can be couple of htings possible which may stop your index from being used. All what dbms_stats(and even Analyze) command would do , is to make the distribution of the data known tooracle. Having stats alone doesn't guarantee that the index would be used for sure.
HTH
Aman.... -
How to edit and update table control into database?
I am doing table control. Here are my codes:
*& Report ZHERA_TABLE2
REPORT ZHERA_TABLE2.
***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'ZTABLE_CONTROL'
*&SPWIZARD: DEFINITION OF DDIC-TABLE
TABLES: ZHERA.
*&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'ZTABLE_CONTROL'
TYPES: BEGIN OF T_ZTABLE_CONTROL,
NAME LIKE ZHERA-NAME,
AGE LIKE ZHERA-AGE,
END OF T_ZTABLE_CONTROL.
*&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'ZTABLE_CONTROL'
DATA: G_ZTABLE_CONTROL_ITAB TYPE T_ZTABLE_CONTROL OCCURS 0,
G_ZTABLE_CONTROL_WA TYPE T_ZTABLE_CONTROL. "work area
DATA: G_ZTABLE_CONTROL_COPIED. "copy flag
*&SPWIZARD: DECLARATION OF TABLECONTROL 'ZTABLE_CONTROL' ITSELF
CONTROLS: ZTABLE_CONTROL TYPE TABLEVIEW USING SCREEN 1000.
START-OF-SELECTION.
CALL SCREEN 1000.
*&SPWIZARD: OUTPUT MODULE FOR TC 'ZTABLE_CONTROL'. DO NOT CHANGE THIS LI
*&SPWIZARD: COPY DDIC-TABLE TO ITAB
MODULE ZTABLE_CONTROL_INIT OUTPUT.
IF G_ZTABLE_CONTROL_COPIED IS INITIAL.
*&SPWIZARD: COPY DDIC-TABLE 'ZHERA'
*&SPWIZARD: INTO INTERNAL TABLE 'g_ZTABLE_CONTROL_itab'
SELECT * FROM ZHERA
INTO CORRESPONDING FIELDS
OF TABLE G_ZTABLE_CONTROL_ITAB.
G_ZTABLE_CONTROL_COPIED = 'X'.
REFRESH CONTROL 'ZTABLE_CONTROL' FROM SCREEN '1000'.
ENDIF.
ENDMODULE.
*&SPWIZARD: OUTPUT MODULE FOR TC 'ZTABLE_CONTROL'. DO NOT CHANGE THIS LI
*&SPWIZARD: MOVE ITAB TO DYNPRO
MODULE ZTABLE_CONTROL_MOVE OUTPUT.
MOVE-CORRESPONDING G_ZTABLE_CONTROL_WA TO ZHERA.
ENDMODULE.
Screen 1000 codes:
PROCESS BEFORE OUTPUT.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'ZTABLE_CONTROL'
MODULE ZTABLE_CONTROL_INIT.
*&SPWIZARD: MODULE ZTABLE_CONTROL_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE ZTABLE_CONTROL_CHANGE_COL_ATTR.
LOOP AT G_ZTABLE_CONTROL_ITAB
INTO G_ZTABLE_CONTROL_WA
WITH CONTROL ZTABLE_CONTROL
CURSOR ZTABLE_CONTROL-CURRENT_LINE.
*&SPWIZARD: MODULE ZTABLE_CONTROL_CHANGE_FIELD_ATTR
MODULE ZTABLE_CONTROL_MOVE.
ENDLOOP.
MODULE STATUS_1000.
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'ZTABLE_CONTROL'
LOOP AT G_ZTABLE_CONTROL_ITAB.
CHAIN.
FIELD ZHERA-NAME.
FIELD ZHERA-AGE.
ENDCHAIN.
ENDLOOP.
*&SPWIZARD: MODULE ZTABLE_CONTROL_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE ZTABLE_CONTROL_CHANGE_COL_ATTR.
MODULE USER_COMMAND_1000.
Please show me where to put my codes to edit(edit directly on table control fields) and update my table control(using the 'save' button)?Hi,
You have to put the following code in the PBO of screen 1000.This code would make the fields editable to make changes in the table control fields directly.
Here there are 3 transactions.For create and change transactions, the fields will be in editable mode and for display transaction,they will be non editable mode.
DESCRIBE TABLE tb_line LINES lin. " tb_line is the name of the internal table for the table control
tcl_item-lines = lin. '' lin hold the number of lines of the internal table
CASE sy-tcode.
WHEN 'ZCREATE09' OR 'ZCHANGE09'.
***Checking if the table control is empty or not***
IF lin NE 0.
LOOP AT SCREEN.
***To make the screen editable****
screen-input = 1.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name CS 'TB_LINE'.
****To make the screen non-editable if no values are present in the
***table control****
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
Once the fields are edited and the save button is pressed,the entered values have to be populated into the Z tables.The code has to written in the PAI of the screen 1000.Here the values from the work area of the internal table are moved into the Z Table. The code will be.
LOOP AT tb_line.
ztm09_ekpo-ebeln = ztm09_ekko-ebeln. "ztm09_ekko and ztm09_ekpo are the names of the Z Tables.
ztm09_ekpo-ebelp = tb_line-ebelp.
ztm09_ekpo-matnr = tb_line-matnr.
ztm09_ekpo-menge = tb_line-menge.
ztm09_ekpo-meins = tb_line-meins.
ztm09_ekpo-netpr = tb_line-netpr.
ztm09_ekpo-waers = tb_line-waers.
*****Update the entries into item table*****
MODIFY ztm09_ekpo.
ENDLOOP.
Reward if helpfull
Thanks,
Kashyap -
Insert, Delete and Update options in Table control
Experts,
I have writen code for Insert, Delete and Update options in Table control. They are not working properly...
can any one send the code for the above please...
Thanks in advance..Hi,
Following steps will help you.
1.TOP-INCLUDE
DATA: ITAB1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.
DATA: ITAB2 LIKE KNA1 OCCURS 0 WITH HEADER LINE.
DATA: WA LIKE KNA1.
DATA: ANT TYPE I,CUR TYPE I.
DATA: OK_CODE TYPE SY-UCOMM.
CONTROLS: TABCTRL TYPE TABLEVIEW USING SCREEN 100.
IN FLOWLOGIC
PROCESS BEFORE OUTPUT.
LOOP AT ITAB1 CURSOR CUR WITH CONTROL TABCTRL.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE CLEAR_DATA.
LOOP AT ITAB1.
MODULE MOVE_DATA.
ENDLOOP.
ADD OK_CODE IN ELEMENT LIST. CLICK ON LAYOUT AND ADD TABLE CONTROL(name it as TABCTRL) AND PUSHBUTTONS AS FOLLOWS.
SELECT THE FIELDS FROM PROGRAM. SAVE CHECK AND ACTIVATE.
CLICK ON FLOWLOGIC EDITOR FROM APPLICATION TOOL BAR.
DOUBLE CLICK ON MODULE CLEAR_DATA.
write the in this module as below.
CLEAR ITAB2. REFRESH ITAB2.
DOUBLE CLICK ON MODULE MOVE_DATA.
write the code in this module as below.
APPEND ITAB1 TO ITAB2.
ACTIVATE PAI AND WRITE THE CODE AS BELOW.
CASE OK_CODE.
WHEN 'FETCH'.
SELECT * FROM KNA1 INTO TABLE ITAB1 UP TO 20 ROWS.
TABCTRL-LINES = SY-DBCNT.
WHEN 'ADD'.
GET CURSOR LINE CNT.
CNT = TABCTRL-TOP_LINE + CNT - 1.
CLEAR WA.
INSERT WA INTO ITAB1 INDEX CNT.
WHEN 'MODIFY'.
GET CURSOR LINE CNT.
READ TABLE ITAB2 INDEX CNT.
LOOP AT ITAB2.
MODIFY KNA1 FROM ITAB2.
ENDLOOP.
SELECT * FROM KNA1 INTO TABLE ITAB1.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
SAVE,CHECK AND ACTIVATE ALL.
CREATE TCODE AND EXECUTE.
contact if u hv any issues regarding this code.
reward points,if it is useful.
Thanks,
Chandu.
Maybe you are looking for
-
Main component in a JFrame?
Hi all, Just wondering, how do you set the main component in a JFrame (or JDialog). The main component being the component that gets activated when you hit the enter key. thanks, J
-
Hello, we are running WLS 6.1 SP2. The following code sometimes (rather rarely) throws a NullPointerException: Connection dbConnection = DBUtil.getDBConnection();//here we get the Connection stmt = dbConnection.createStatement(ResultSet.TYPE_FORWARD_
-
hi i've experienced a lag on phone i open my game and it displays only black screen and loading i tried this on different games but when i restart my phone it works and there is no problem. its because of the ram? btw soft reset (power+volume = res
-
Session keeps running when the query has a syntax error
I have a weird scenario. Take this query for example: select distinct physassignednum from hsi.docdeficiency where delinqlevel> 0 and dfcystatus in (1,6)); This query has a syntax error as there is an additional bracket at the end. I know that. When
-
InDesign, Adobe Acrobat & Bookmarks
I have InDesign CS4 (v. 6.0.6). All of a sudden when I export a 5 file book to a PDF file none of the index entry links work. They are created as is the TOC links, but they all take me to the front page of the book. Frustrating!!! I've unchecked