How to update data in af:table
Part Database:
1. I create 2 table in database
- tb_closed_order - id
- closed_date
- lot
- tb_order - id
- order_number
- title
- detail
- lot
- status_closed_order
2. At tb_closed_order, I create trigger type after insert
When I insert new record, This trigger is fire to update tb_order
update tb_order
set status_closed_order = 1
where lot = :NEW.lot
Part Application
1. I create a simple page
2. ListPage : list all of tb_order, that display in af:table
| id | order_number | title | detail | status |
| 1 | 001 | xxxxx | xxxxxx | 0 |
| 2 | 002 | xxxxx | xxxxxx | 0 |
| 3 | 003 | xxxxx | xxxxxx | 0 |
| 4 | 004 | xxxxx | xxxxxx | 0 |
3. When I want to close order, I click commandButton
TbClosedOrder obj = new TbClosedOrder()
obj.setClosedDate(...);
obj.setLot(new Integer(251));
persist(obj);
4. When I come back to ListPage, I want to see column status contain data equal 1
But it show 0
I already force re-execute iterater, but I show status 0
What can I do ??
Please help me..
Hi,
if you use ADF BC then the first test is to run the VO in the ADF BC tester to see if this works. If it does work here then this means that the business logic is functioning. If using ADF Faces with ADF, then its not enough to re-execute the iterator if this isn't done through ADF .The UI needs to be partially refreshed using PPR. So when you press a command button, this should trigger a refresh of the table component
Frank
Similar Messages
-
How to update date in a table from another database
Hello,
I am trying to code a way to Update my Testing database from another database. In the coding below the database that has the updated data ends in Restore.
Use ClientDB_MASTER_Restore
Truncate Table ClientDB_MASTER_Testing.dbo.Activity_Tracking_AZ
GO
SELECT * INTO ClientDB_Master_Testing.dbo.Activity_Tracking_AZ
FROM Activity_Tracking_AZ
Go
I know with this Technique the table must be truncated if not deleted first. There is probably a better way to do this which I'm very open to. I'm also looking for coding that will roll back any changes made should an error occur.
As always, any help is greatly appreciated.
David92595USE ClientDB_MASTER_Testing
go
SET XACT_ABORT ON
BEGIN TRANSACTION
Truncate Table dbo.Activity_Tracking_AZ
-- SET IDENTITY_INSERT dbo.Activity_Tracking_AZ ON
INSERT dbo.Activity_Tracking_AZ (col1, col2, ...)
SELECT col1, col2,
FROM ClientDB_MASTER_Restore.dbo.Activity_Tracking_AZ
-- SET IDENTITY_INSERT dbo.Activity_Tracking_AZ OFF
COMMIT TRANSACTION
If you find it boring to type the column lists, just find the table in Object Explorer, and drag the columns node to where you want the column list.
You need the SET IDENTITY_INSERT command if the table has an IDENTITY column.
By wrapping the code in a transaction, you are not left with an empty table if the INSERT fails. The command SET XACT_ABORT ON makes sure that the batch is aborted and rolled back in case of an error.
Erland Sommarskog, SQL Server MVP, [email protected] -
Hi
how to create a external content type for Read and Update data from two tables in sqlserver using sharepoint designer 2010
i created a bcs service using centraladministration site
i have two tables in sqlserver
1)Employee
-empno
-firstname
-lastname
2)EmpDepartment
-empno
-deptno
-location
i want to just create a list to display employee details from two tables
empid firstname deptno location
and same time update in two tables
adilWhen I try to create an external content type based on a view (AdventureWorks2012.vSalesPerson) - I can display the data in an external list. When I attempt to edit it, I get an error:
External List fails when attached to a SQL view
Sorry, something went wrong
Failed to update a list item for this external list based on the Entity (External Content Type) 'SalesForce' in EntityNamespace 'http://xxxxxxxx'. Details: The query against the database caused an error.
I can edit the view in SQL Manager, so it seems strange that it fails.
Any advice would be greatly GREATLY appreciated.
Thanks,
Randy -
Efficient way of updating data to database table
what is the efficient way of updating data to database table .
i have huge amount of data in my internal table , how to use update statement in this case .
1. database table having 20 fields ,
2. one is key field and suppose 20 th field i want to change .
3. I have data for only 2 fields , i.e for ( 1 st and last 20 th field ) .
i can't use update statement in loop , as it is not good practice(hits database several times ) .
do it effects all the 20 fields for particular record .Hi,
Use UPDATE statement , check below description from SAP help.
UPDATE dbtab FROM TABLE itab. or UPDATE (dbtabname) FROM TABLE itab.
Effect
Mass update of several lines in a database table.Here, the primary key for identifying the lines tobe updated and the values to be changed are taken from the lines of theinternal table itab.
The system field SY-DBCNT contains the number of updated lines,i.e. the number of lines in the internal table itab which havekey values corresponding to lines in the database table.
Regards
L Appana -
How to updated matrix into related table?
hi, can anyone help me below coding how to updated matrix into related table?
Thank you.
For rowNum = 0 To oMatrix.RowCount
oRecordset.Fields.Item("Code").Value = oMatrix.Columns.Item("DSCode").Cells.Item(rowNum).Specific.Value
oRecordset.Fields.Item("Name").Value = oMatrix.Columns.Item("DSName").Cells.Item(rowNum).Specific.Value
oRecordset.Fields.Item("U_RPTC").Value = oMatrix.Columns.Item("DSReport").Cells.Item(rowNum).Specific.Value
oRecordset.Fields.Item("U_USRC").Value = oMatrix.Columns.Item("DSUser").Cells.Item(rowNum).Specific.Value
oRecordset.MoveNext()
NextFor Fast Matrix Loading you can user some thing like this.
Dim Column As SAPbouiCOM.Column
Dim Matrix As SAPbouiCOM.Matrix
Dim Table As SAPbouiCOM.DataTable
Table = oForm.DataSources.DataTables.Add("Documents")
Table.Columns.Add("Code", SAPbouiCOM.BoFieldsType.ft_Integer)
Table.Columns.Add("Name", SAPbouiCOM.BoFieldsType.ft_Integer)
Table.Columns.Add("U_RPTC", SAPbouiCOM.BoFieldsType.ft_AlphaNumeric, 255)
Table.Columns.Add("U_USRC", SAPbouiCOM.BoFieldsType.ft_AlphaNumeric, 255)
Matrix = oForm.Items.Item("MatrixUID").Specific
Column = Matrix.Columns.Item("Code")
Column.DataBind.Bind("Documents", "Code")
Column = Matrix.Columns.Item("Name")
Column.DataBind.Bind("Documents", "Name")
Column = Matrix.Columns.Item("U_RPTC")
Column.DataBind.Bind("Documents", "U_RPTC")
Column = Matrix.Columns.Item("U_USRC")
Column.DataBind.Bind("Documents", "U_USRC")
Table.ExecuteQuery(SQLQuery)
Matrix.LoadFromDataSource() 'Load The Data to the Matrix
To pull the data form the display back to the Table you can use this
Matrix.FlushToDataSource() -
How to refine data in Aggregate tables in Oracle BI
Hello!
How to refine data in aggregates tables (created by "create aggregates ..." statement) after the data in corresponding database tables was updated?
It is unable to use the "delete aggregates" statement and then "create aggregates" again, because "delete aggregates" eliminates all aggregates in a model, but there are several aggregates in our model, that are intended for refining in different time moments and periods.
Thanks903830 wrote:
Hi folks,
suppose we have table emp01, have 10 records & we create another table emp02 as
create table emp02 as select * from emp01;
now both the table have identical data.
How to find "data" in two tables are identical?Why wouldn't they be identical? You've just created one table as a copy of the other. They are identical in data terms. -
How to fetch data from cluster tables
hi
i need to know how to fetch data from cluster tables please update me if any
i know that we cannot use joins in cluster table we use view etc
but i need detailed inforation on methods for fetching data from cluster tables
regards
NishantHi,
Check the following links
http://fuller.mit.edu/hr/cluster_tables.html
The specified item was not found.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33 -
How to send data from internal table to the shared folder in ABAP
Hi experts,
My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is "
xxx\y\z....".
I do not have any idea on how to send data from internal table to the shared folder path.
can anybody please help me out how to do this?
Thanks & Regards
Sireesha.Where that folder is located, its on presentation server i.e. desktop or application server.
If its on presentation server, use FM GUI_UPLOAD.
If its on application server, then use DATASET functions. Have a look at below link.
[File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
I hope it helps.
Thanks,
Vibha
Please mark all the useful answers -
How to select data from a table using a date field in the where condition?
How to select data from a table using a date field in the where condition?
For eg:
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = '31129999'.
thanks.Hi Ramesh,
Specify the date format as YYYYMMDD in where condition.
Dates are internally stored in SAP as YYYYMMDD only.
Change your date format in WHERE condition as follows.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = <b>'99991231'.</b>
I doubt check your data base table EQUK on this date for the existince of data.
Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and <b> bdatu <= '99991231'.</b>
Thanks,
Vinay
Thanks,
Vinay -
How to select data from a table by passing document number from another tab
How to select data from a table by passing document number from another table.
for eg:-
I want to display name, adres, region from ADRC table
by using field delivery document number
Kind Regards,
Shanbagavalli.SHi Shanbagavalli,
There are multiple solutions to this questions a few i will try to answer and then you can take the best required for your requirements.
**Consider that you have a Internal table having document number from other table..
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
FOR ALL ENTRIES IN IT_DOC
WHERE DOCUMENT_NO = IT_DOC-DOCUMENT_NO.
**Consider that you have 1 document number then
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
WHERE DOCUMENT_NO = W_DOCUMENT_NO.
Hope this solves your problem.
Regards,
Kunjal -
How to update data when primary key is set through for update cursor
Dear friends,
I have tried to update data in the table through forms using cursor for update and i have given the plsql i have used please help me where i do mistake.
DECLARE CURSOR EMP IS
SELECT EMPNO,EMPNAME,FATHERNAME,COMMUNITY,SEX,BILLUNIT,BIRTHDATE,RLYJOINDATE,RETIREMENTDATE
FROM PRMAEMP WHERE BILLUNIT=:CTRL.BILLUNIT AND SERVICESTATUS='SR'ORDER BY DESIGCODE,SCALECODE
FOR UPDATE;
BEGIN
GO_BLOCK('EMP_DETAILS');
SYNCHRONIZE;
FOR I IN EMP
LOOP
I.BILLUNIT:=:EMP_DETAILS.BILLUNIT;
I.EMPNO:=:EMPNO;
I.EMPNAME:=:EMPNAME;
I.FATHERNAME:=:FATHERNAME;
I.COMMUNITY:=:COMMUNITY;
I.SEX:=:SEX;
I.BIRTHDATE:=:BIRTHDATE;
I.RLYJOINDATE:=:RLYJOINDATE;
I.RETIREMENTDATE:=:RETIREMENTDATE;
DOWN;
END LOOP;
COMMIT;
END;
your help is needed immediatelyDECLARE CURSOR ABC IS
SELECT EMPNO,
EMPNAME,
FATHERNAME,
COMMUNITY,
SEX,
BILLUNIT,
BIRTHDATE,
RLYJOINDATE,
RETIREMENTDATE
FROM PRMAEMP
WHERE BILLUNIT=:CTRL.BILLUNIT
AND SERVICESTATUS='SR'
ORDER BY DESIGCODE,SCALECODE
FOR UPDATE OF COMMUNITY;
V_EMPNO PRMAEMP.EMPNO%TYPE;
V_EMPNAME PRMAEMP.EMPNAME%TYPE;
V_FATHERNAME PRMAEMP.FATHERNAME%TYPE;
V_COMMUNITY PRMAEMP.COMMUNITY%TYPE;
V_SEX PRMAEMP.SEX%TYPE;
V_BILLUNIT PRMAEMP.BILLUNIT%TYPE;
V_BIRTHDATE PRMAEMP.BIRTHDATE%TYPE;
V_RLYJOINDATE PRMAEMP.RLYJOINDATE%TYPE;
V_RETIREMENTDATE PRMAEMP.RETIREMENTDATE%TYPE;
BEGIN
GO_BLOCK('EMP');
SYNCHRONIZE;
OPEN ABC;
LOOP
FETCH ABC INTO .... /*yOU NEED TO MENTION YOUR VARIABLES HERE*/;
UPDATE PRMAEMP
SET BILLUNIT= :EMP.BILLUNIT,
EMPNO= :EMPNO,
EMPNAME= :EMPNAME,
FATHERNAME= :FATHERNAME,
COMMUNITY= :COMMUNITY,
SEX= :SEX,
BIRTHDATE= :BIRTHDATE,
RLYJOINDATE= :RLYJOINDATE,
RETIREMENTDATE= :RETIREMENTDATE
WHERE CURRENT OF ABC;
EXIT WHEN ABC%NOTFOUND;
END LOOP;
CLOSE ABC;
END;
COMMIT;
END;Cheers
Sarma. -
How to update Records from Internal table to u2018Zu2019 table?
Hi Friends,
How to update Records from Internal table to u2018Zu2019 table.
I have records in Internal table , that records want to update on u2018Zmarau2019 Table.
( my internal table & u2018 Zu2019 table structures are same.)
Thanking you.
Regards,
SubashHi,
loop at internal table.
modify <Z- table > from values < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
endloop.
or
UPDATE <Z- table > from table < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
Prabhudas -
How to update duplicate row from table
Hi,
how to update duplicate row from table?
First to find duplicate row then update duplicate row with no to that duplicate row in oracle.
can you give me suggestion on it?
Thanks in advance.
your early response is appreciated...In order to find a duplicate row, see:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004
(or search this forum, your question has been asked before)
In order to update it, just create and use an Oracle sequence, have it start and increment at a value that doesn't exist in your table.
If that doesn't get you going, post some CREATE TABLE + INSERT INTO statements, and the results you want from them, in other words: a complete testcase. -
Its very urgent:how to insert data into database tables
Hi All,
I am very new to oaf.
I have one requirement data insert into database tables.
here createPG having data that data insert into one custom table.
but i dont know how to insert data into database tables.
i wrote the code in am,co as follows.
in am i wrote the code:
public void NewoperationManagerLogic()
ManagerCustomTableVOImpl vo1=getManagerCustomTableVO1();
OADBTransaction oadbt=getOADBTransaction();
if(!vo1.isPreparedForExecution())
vo1.executeQuery();
Row row=vo1.createRow();
vo1.insertRow(row);
in createPG processrequest co:
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
am.NewoperationManagerLogic();
process form request:
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
if(pageContext.getParameter("Submit")!=null)
ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
am.getOADBTransaction().commit();
please help with an example(sample code).
its very urgent.
thanks in advance
Seshu
Edited by: its urgent on Dec 25, 2011 9:31 PMHi ,
1.)You must have to create a EO based on custom table and then VO based on this EO eventually to save the values in DB
2.) the row.setNewRowState(Row.STATUS_INITIALIZED); is used to set the the status of row as inialized ,this is must required.
3.) When u will create the VO based on EO the viewattributes will be created in VO which will be assigned to the fields to take care the db handling .
You must go thtough the lab excercise shipped with you Jdeveloper ,there is a example of Create Employee page ,that will solve your number of doubts.
Thanks
Pratap -
How to select data from cluster table
hi experts,
I have a report which picks data from bseg (cluster table ) for a month report it is taking around 4 minutes to process.I feel it is not good when take the report after some months.
how to select data from these table???how to declare itab for these cluster tables????can we include any search condition or any other kind of internal table???
please advice.
maniHi Manikandan,
The following code may be helpful to understand how to select the data from cluster table.
Types: Begin of ty_kna1,
Kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_kna1,
begin of ty_bseg,
belnr type bseg-belnr,
kunnr type bseg-kunnr,
end of ty_bseg,
begin of ty_final,
belnr type bseg-belnr,
kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_final.
Data: it_kna1 type table of ty_kna1,
wa_kna1 type ty_kna1,
it_bseg type table of ty_bseg,
wa_bseg type ty_bseg,
it_final type table of ty_final,
wa_final type ty_final.
Select kunnr adrnr from kna1 into table it_kna1 where....
if sy-subrc = 0.
select belnr kunnr into table it_bseg for all entries in it_kna1 where kunnr = it_kna1-kunnr.
endif.
sort it_kna1 by kunnr.
Loop at it_bseg into wa_bseg.
move wa_bseg-belnr to wa_final-belnr.
read table it_kna1 into wa_kna1 with kunnr = wa_bseg-kunnr binary search.
if sy-subrc = 0.
move: wa_kna1-kunnr to wa_final-kunnr,
wa_kna1-belnr to wa_final-belnr.
endif.
append wa_final to it_final.
clear wa_final.
endloop.
Loop at it_final into wa_final.
write: / wa_final-belnr, wa_final-kunnr, wa_final-adrnr.
endloop.
Reward if useful.
Thankyou,
Regards.
Maybe you are looking for
-
No Data Found Option in BI Publisher Report
Hi All, Could you please help me. I am looking for NO DATA FOUND OPTION in BIP Report. Ex - In the body of the report, I will write simple select statement Select * from emp; If the table do not contain data the out put should display " NO DATA FOUND
-
My old computer, which had CS3 installed, crashed and I had to replace the computer. We re-installed the CS3 program on the new computer, and the prompt calls for a serial number, which we do not have. I obtained the original CS3 while registered a
-
IPhone 4s 6.1.3 problems with 3g,In and Outgoing Calls
Hi Everybody! I got a factory unlocked (originally was Vodafon locked) iPhone 4s with firmware 6.1.3.When I insert my sim (Hungarian Telenor) when only EDGE is on it founds the signal and seems like everything is working.After a few hours or sometime
-
Sales Office and Sales Group Automatic Determination based on the Sold to P
Hello every one We need determine sales office and sales group based on sold to party master data in Activity Management in SAP CRM 2007. I want to know if there is a way to do it when we save the document. Any ideas???
-
How to delete a single entry from GUI History
All, I want to delete a single line of GUI history. This is my scenario. During the installation of SAPGui in the user system , we usually send the preconfigured MDB files also along with distribution. But by mistake i tyoed the administrator passwo