Duplicate Record Button
We are trying to duplicate a record and give it a new Key Id. We have created a new button with the following information. IT will not compile. Can you see any reasoning why we cannot do this? We have also tried using a Cursor, but that still will not work. The user will query on a key id and then click this button to duplicate that record. We want to call the new record up in the window. The trigger is on the table that creates the new key id.
DECLARE
v_ref_tracking_no number := p_session.get_value_as_number
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_ref_tracking_no');
v_bldg varchar2(15) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_bldg');
v_room_area varchar2(20) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_room_area');
v_disc_desc varchar2(250) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_disc_desc');
v_fac_manager varchar2(35) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_fac_manager');
v_reported_by varchar2(35) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_reported_by');
v_reported_date date := p_session.get_value_as_date
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_reported_date');
v_fac_manager_code varchar2(10) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_fac_manager_code');
v_disc_type varchar2(10) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_disc_type');
v_mod_date date := p_session.get_value_as_date
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_mod_date');
v_mod_by varchar2(30) := portal.wwctx_api.get_user;
v_FAC_STATUS VARCHAR2(4) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_FAC_STATUS');
v_FAC_CLOSE_date date := p_session.get_value_as_date
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_FAC_CLOSE_date');
v_BMAR_NO varchar2(8) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_BMAR_NO');
v_INSPECTION_TYPE varchar2(5) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT', p_attribute_name => 'A_INSPECTION_TYPE');
v_RAC VARCHAR2(15) := p_session.get_value_as_VARCHAR2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_RAC');
v_FAC_MGR_ACTION varchar2(500) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT', p_attribute_name => 'A_FAC_MGR_ACTION');
v_FAC_ADMIN_COMMENTS varchar2(500) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT', p_attribute_name => 'A_FAC_ADMIN_COMMENTS');
v_hazard_group varchar2(40) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_hazard_group');
v_location varchar2(20) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_location');
v_FAC_SYSTEM varchar2(10) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_FAC_SYSTEM');
v_work_order varchar2(10) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_WORK_ORDER');
v_WORK_STATUS varchar2(8) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_WORK_STATUS');
v_TARGET_START DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_TARGET_START');
v_TARGET_COMP DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_TARGET_COMP');
v_ACT_COMP_DATE DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_ACT_COMP_DATE');
v_BMAR_COMP_DATE DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_BMAR_COMP_DATE');
v_CREATE_DATE DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_CREATE_DATE');
v_CREATE_BY varchar2(30) := portal.wwctx_api.get_user;
v_WOPRIORITY NUMBER := p_session.get_value_as_NUMBER
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_WOPRIORITY');
v_BMAR_STATUS varchar2(1) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_BMAR_STATUS');
l_url varchar2 (2000);
V_NO NUMBER;
BEGIN
INSERT INTO FAC_DISCREPANCY
( BLDG,
ROOM_AREA,
DISC_DESC ,
FAC_MANAGER,
REPORTED_BY ,
REPORTED_DATE,
FAC_MANAGER_CODE ,
DISC_TYPE ,
WORK_ORDER ,
WORK_STATUS ,
TARGET_START ,
TARGET_COMP ,
ACT_COMP_DATE ,
BMAR_NO ,
BMAR_COMP_DATE ,
MOD_BY ,
MOD_DATE ,
CREATE_DATE ,
FAC_STATUS ,
FAC_CLOSE_DATE ,
CREATE_BY ,
INSPECTION_TYPE ,
RAC ,
FAC_MGR_ACTION,
FAC_ADMIN_COMMENTS,
WOPRIORITY ,
BMAR_STATUS ,
HAZARD_GROUP ,
REF_TRACKING_NO ,
LOCATION ,
FAC_SYSTEM )
values
( V_BLDG ,
V_ROOM_AREA,
V_DISC_DESC ,
V_FAC_MANAGER,
V_REPORTED_BY ,
V_REPORTED_DATE,
V_FAC_MANAGER_CODE ,
V_DISC_TYPE ,
V_WORK_ORDER ,
V_WORK_STATUS ,
V_TARGET_START ,
V_TARGET_COMP ,
V_ACT_COMP_DATE ,
V_BMAR_NO ,
V_BMAR_COMP_DATE ,
V_MOD_BY ,
V_MOD_DATE ,
V_CREATE_DATE ,
V_FAC_STATUS ,
V_FAC_CLOSE_DATE ,
V_CREATE_BY ,
V_INSPECTION_TYPE ,
V_RAC ,
V_FAC_MGR_ACTION
V_FAC_ADMIN_COMMENTS ,
V_WOPRIORITY ,
V_BMAR_STATUS ,
V_HAZARD_GROUP ,
V_REF_TRACKING_NO ,
V_LOCATION ,
V_FAC_SYSTEM );
SELECT MAX (TRACKING_NO) INTO V_NO
FROM PORTAL_PUBLIC.FAC_DISCREPANCY;
l_url:= PORTAL.wwv_user_utilities.get_url ('FACILITY_MANAGER.LINK_DUPLICATEâ, âTRACKING_NO', V_NO, '_TRACKING_NO_cond', '=');
portal.wwa_app_module.set_target(l_url);
END;
Thanks
Jeannie
We got it to work. We placed this code in the button Custom PL/SQL event handler. It will insert the record and pull the new record up in the screen and the user can modify any fields needed. Hope this helps someone.
DECLARE
v_tracking_no number := p_session.get_value_as_number
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_tracking_no');
v_ref_tracking_no number := p_session.get_value_as_number
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_ref_tracking_no');
v_bldg varchar2(15) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_bldg');
v_room_area varchar2(20) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_room_area');
v_disc_desc varchar2(250) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_disc_desc');
v_fac_manager varchar2(35) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_fac_manager');
v_reported_by varchar2(35) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_reported_by');
v_reported_date date := p_session.get_value_as_date
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_reported_date');
v_fac_manager_code varchar2(10) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_fac_manager_code');
v_disc_type varchar2(10) := p_session.get_value_as_varchar2
(p_block_name => 'DEFAULT'
, p_attribute_name => 'A_disc_type');
v_mod_date date := p_session.get_value_as_date
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_mod_date');
v_mod_by varchar2(30) := portal.wwctx_api.get_user;
v_FAC_STATUS VARCHAR2(4) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_FAC_STATUS');
v_FAC_CLOSE_date date := p_session.get_value_as_date
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_FAC_CLOSE_date');
v_BMAR_NO varchar2(8) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_BMAR_NO');
v_INSPECTION_TYPE varchar2(5) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT', p_attribute_name => 'A_INSPECTION_TYPE');
v_RAC VARCHAR2(15) := p_session.get_value_as_VARCHAR2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_RAC');
v_FAC_MGR_ACTION varchar2(500) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT', p_attribute_name => 'A_FAC_MGR_ACTION');
v_FAC_ADMIN_COMMENTS varchar2(500) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT', p_attribute_name => 'A_FAC_ADMIN_COMMENTS');
v_hazard_group varchar2(40) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_hazard_group');
v_location varchar2(20) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_location');
v_FAC_SYSTEM varchar2(10) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_FAC_SYSTEM');
v_work_order varchar2(10) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_WORK_ORDER');
v_WORK_STATUS varchar2(8) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_WORK_STATUS');
v_TARGET_START DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_TARGET_START');
v_TARGET_COMP DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_TARGET_COMP');
v_ACT_COMP_DATE DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_ACT_COMP_DATE');
v_BMAR_COMP_DATE DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_BMAR_COMP_DATE');
v_CREATE_DATE DATE := p_session.get_value_as_DATE
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_CREATE_DATE');
v_CREATE_BY varchar2(30) := portal.wwctx_api.get_user;
v_WOPRIORITY NUMBER := p_session.get_value_as_NUMBER
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_WOPRIORITY');
v_BMAR_STATUS varchar2(1) := p_session.get_value_as_varchar2
( p_block_name => 'DEFAULT'
, p_attribute_name => 'A_BMAR_STATUS');
l_url varchar2 (2000);
V_NO NUMBER;
BEGIN
IF V_TRACKING_NO IS NOT NULL
then
INSERT INTO FAC_DISCREPANCY
( BLDG, ROOM_AREA,DISC_DESC,FAC_MANAGER, REPORTED_BY,REPORTED_DATE,FAC_MANAGER_CODE,
DISC_TYPE,WORK_ORDER,WORK_STATUS,TARGET_START,
TARGET_COMP,ACT_COMP_DATE,BMAR_NO,BMAR_COMP_DATE,
MOD_BY,MOD_DATE,CREATE_DATE,FAC_STATUS,FAC_CLOSE_DATE, CREATE_BY,INSPECTION_TYPE,RAC,FAC_MGR_ACTION,
FAC_ADMIN_COMMENTS,WOPRIORITY,BMAR_STATUS,HAZARD_GROUP,
REF_TRACKING_NO,LOCATION,FAC_SYSTEM )
values
(V_BLDG,V_ROOM_AREA,V_DISC_DESC,V_FAC_MANAGER,
V_REPORTED_BY, V_REPORTED_DATE, V_FAC_MANAGER_CODE,
V_DISC_TYPE,V_WORK_ORDER,V_WORK_STATUS, V_TARGET_START,
V_TARGET_COMP,V_ACT_COMP_DATE,V_BMAR_NO, V_BMAR_COMP_DATE,V_MOD_BY,V_MOD_DATE,V_CREATE_DATE,
V_FAC_STATUS, V_FAC_CLOSE_DATE, V_CREATE_BY,
V_INSPECTION_TYPE,V_RAC,V_FAC_MGR_ACTION, V_FAC_ADMIN_COMMENTS,V_WOPRIORITY,V_BMAR_STATUS,
V_HAZARD_GROUP,V_REF_TRACKING_NO, V_LOCATION,
V_FAC_SYSTEM );
end if;
BEGIN
SELECT MAX (TRACKING_NO) INTO V_NO
FROM PORTAL_PUBLIC.FAC_DISCREPANCY;
l_url:= PORTAL.wwv_user_utilities.get_url ('FACILITY_MANAGER.LINK_DUPLICATE','TRACKING_NO', V_NO, '_TRACKING_NO_cond', '=');
portal.wwa_app_module.set_target(l_url);
END;
END;
Similar Messages
-
Step how to create a duplicate record button in APEX
HI,
Where do i find out the document step by step with the code behind on how to create a button to copy a record with master and detail in APEX. My email address is [email protected] Thanks.
Thu TranIf you are using ADF BC you can also try this
http://adftips.blogspot.com/2010/10/adf-model-creating-duplicate-row.html
Regards
Nicolas -
To insert duplicate records in VO
Hi,
I have a button Duplicate Record on page.
All the existing details on the page are read only except a checkbox for all rows.
When i select the checkbox and click on 'duplicate Record' button, an editable row with the same data as the selected checkbox row should be created on page. This row is getting created but the issue is that the row from which it has been dupliacted also becomes editable. And the changes made to new row gets reflected in Old Row as well.
Any solutions to have the old row read only and only new row as editable?ok..what i understand is as follows..
In the VO, i create a transient variable 'RowRef' and select it in my VO query.
In my results table, i create a form value "evtSrcRowRef" with View attribute as 'RowRef'.
In CO, i write,
String rowReference = pageContext.getParameter("evtSrcRowRef");
Please correct me if i am wrong or missing somethimg..also please detail how do i use this row refernce to make my original row read only.. -
Problem with duplicate records..
Hi..I am trying to insert the records to the database based on a button click from a Swing frame..I have succeeded in that...But when i try to insert a duplicate record it is showing com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 1
My code is
import java.awt.event.*;
import java.sql.*;
public class BarcodeReader extends javax.swing.JFrame implements ActionListener {
static Connection con;
static String url = "jdbc:mysql://localhost:3306/";
static String db = "mynewdatabase";
static String driver = "com.mysql.jdbc.Driver";
static String user = "uname";
static String pass = "pwd";
static Statement stmt;
/** Creates new form BarcodeReader */
public BarcodeReader() {
initComponents();
nb.addActionListener(this);
public static Connection getConnection(){
try{
Class.forName(driver);
con = DriverManager.getConnection(url + db, user, pass);
stmt=con.createStatement();
System.out.println("jdbc driver for mysql : " + driver);
System.out.println("Connection url : " + url + db);
}catch (Exception ex)
ex.printStackTrace();
return con;
private void ActionPerformed(java.awt.event.ActionEvent evt) {
Connection con=getConnection();
String t=newtxt.getText();
int t1=Integer.parseInt(t);
try{
PreparedStatement p=con.prepareStatement("INSERT INTO machine(barcode) values(?)");
ResultSet rs=stmt.executeQuery("SELECT * FROM MACHINE");
while(rs.next()){
String s=rs.getString("barcode");
if(s.equals(t))
System.out.println("this id exists....");
rs.last();
p.setInt(1, t1);
p.executeUpdate();
new NewJFrame().setVisible(true);
}catch(Exception e){
e.printStackTrace();
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new BarcodeReader().setVisible(true);
}When i insert a new record is ok, but when i am inserting the same record again it shows the following exception..
jdbc driver for mysql : com.mysql.jdbc.Driver
Connection url : jdbc:mysql://localhost:3306/mynewdatabase
this id exists....
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1957)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2107)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2086)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2371)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2289)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2274)
at project.BarcodeReader.ActionPerformed(BarcodeReader.java:276)
at project.BarcodeReader.access$000(BarcodeReader.java:17)
at project.BarcodeReader$1.actionPerformed(BarcodeReader.java:138)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)Thanks.shelton141 wrote:
Hi..I am trying to insert the records to the database based on a button click from a Swing frame..I have succeeded in that...But when i try to insert a duplicate record it is showing com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 1Of course it is. That is what it is suppossed to do.
Try inserting the same record twice, manually, and see what happens.
There is however, if I remember right, an "IGNORE" "clause/option/whatever" that you can use on INSERT statements in MySQL. Check the manual, if that is what you really want. -
Duplicate records in input structure of model node
Hi,
Following is the way, I am assigning data to a model node:
//Clearing the model input node
for (int i = wdContext.nodeInsppointdata().size(); i > 0; i--)
wdContext.nodeInsppointdata().removeElement(wdContext.nodeInsppointdata().getElementAt(i - 1));
//Creating element of the input model node
IPrivateResultsView.IInsppointdataElement eleInspPointData;
//START A
Bapi2045L4 objBapi2045L4_1 = new Bapi2045L4(); //Instance of the input structure type
//Populating data
eleInspPointData = wdContext.nodeInsppointdata().createInsppointdataElement(objBapi2045L4_1);
wdContext.nodeInsppointdata().addElement(eleInspPointData);
eleInspPointData.setInsplot(wdContext.currentContextElement().getInspectionLotNumber());
eleInspPointData.setInspoper("0101");
//Inspection_Validate_Input is the model node. Adding instance to main node
wdContext.currentInspection_Validate_InputElement().modelObject().addInsppointdata(objBapi2045L4_1);
//STOP A
//Now executing the RFC
Above code seems to be fine. Works very well for the first time. But, when the user clicks on the same button for the second time, I can see duplicate records getting passed to RFC [Debugged using external breakpoint]. When I am sending 4 records, I can see there are total of 6 records. The number keeps increasing when clicked on the button.
I am adding multiple records to input model node using the code from START A to STOP A. Does the code look fine? Why do I see multiple records?
Thanks,
ShamIssue solved.
After executing RFC, I used following code to clear the input model node:
try
wdContext.current<yourBAPI>_InputElement().modelObject().get<yourinputnode>().clear();
catch (Exception e1) -
How to make a duplicate record in oracle fomr
Hi,
I have a custom master-detail form in ebs. User wants to query a record and store a duplicate record in the database with modification of some column values.
I am using custom tables in data blocks.
Please guide me how can I do it.
Regards
Farooqcreate a button and then insert a record based on the records queried:
when button-pressed:
insert into t_x() values();
commit; -
Duplicate records in TABLE CONTROL
Hi folks,
i am doing a module pool where my internal table (itab) data is comming to table ontrol(ctrl).then i need to select one record in table control & then i press REFRESH push button.
after putting the refresh button, some new records are comming to that same internal table.then i need to display the modified internal table (some new records are added) data in the table control.
The modified internal table data is comming to the table control but to the last of table control, some records are repeating.
before comming to table control, i checked the modified itab. it contains correct data.i.e it contains 15 records.(previously i have 5 records.after REFRESH button 10 more records are added.). but when this table is comming to table control, it contains some 100 record.i should get only 15 record.
why these records r repeting. how to delete the duplicate records from table control?
plz suggest me where i am doing mistake.
correct answer will be rewarded
Thanks & RegardsHi ,
Thanks for ur help. but i should not refresh the internal table as some records r already present.after putting the REFRESH button, some new records r appending to this existing table.then i am going to display the previous records & the new records as well.
i checked the internal table after modification.it contains actual number of records. but after comming to table control , more records r comming.
is this the problem with scrolling or waht?
plz suggest where i am doing mistake.i am giving my coding below.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
module tc_shelf_change_tc_attr.
loop at object_tab1
with control tablctrl
cursor tablctrl-current_line.
module tc_shelf_get_lines.
endloop.
PROCESS AFTER INPUT.
module set_exit AT EXIT-COMMAND.
loop at object_tab1.
chain.
field: object_tab1-prueflos,
object_tab1-matnr.
module shelf_modify on chain-request.
endchain.
field object_tab1-idx
module shelf_mark on request.
endloop.
module shelf_user_command.
module user_command_0200.
***INCLUDE Y_RQEEAL10_STATUS_0200O01 .
*& Module STATUS_0200 OUTPUT
text
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module tc_shelf_change_tc_attr OUTPUT
text
MODULE tc_shelf_change_tc_attr OUTPUT.
delete adjacent duplicates from object_tab1 comparing prueflos matnr.
describe table object_tab1 lines tablctrl-lines.
ENDMODULE. " tc_shelf_change_tc_attr OUTPUT
*& Module tc_shelf_get_lines OUTPUT
text
MODULE tc_shelf_get_lines OUTPUT.
data: g_tc_shelf_lines like sy-loopc.
if tablctrl-current_line > tablctrl-lines.
stop.
endif.
g_tc_tablctrl_lines = sy-loopc.
*refresh control tablctrl from screen 0200.
ENDMODULE. " tc_shelf_get_lines OUTPUT
***INCLUDE Y_RQEEAL10_SHELF_MODIFYI01 .
*& Module shelf_modify INPUT
text
MODULE shelf_modify INPUT.
modify object_tab1
index tablctrl-current_line.
ENDMODULE. " shelf_modify INPUT
*& Module set_exit INPUT
text
module set_exit INPUT.
leave program.
endmodule. " set_exit INPUT
*& Module shelf_mark INPUT
text
MODULE shelf_mark INPUT.
data: g_shelf_wa2 like line of object_tab1.
if tablctrl-line_sel_mode = 1
and object_tab1-idx = 'X'.
loop at object_tab1 into g_shelf_wa2
where idx = 'X'.
g_shelf_wa2-idx = ''.
modify object_tab1
from g_shelf_wa2
transporting idx.
endloop.
endif.
modify object_tab1
index tablctrl-current_line
transporting idx plnty plnnr plnal.
ENDMODULE. " shelf_mark INPUT
*& Module shelf_user_command INPUT
text
MODULE shelf_user_command INPUT.
ok_code = sy-ucomm.
perform user_ok_tc using 'TABLCTRL'
'OBJECT_TAB1'
changing ok_code.
sy-ucomm = ok_code.
ENDMODULE. " shelf_user_command INPUT
*& Module user_command_0100 INPUT
text
MODULE user_command_0200 INPUT.
data:v_line(3).
case OK_CODE.
when 'LAST'.
read table object_tab1 with key idx = 'X'.
if sy-subrc = 0.
select * from qals
where enstehdat <= object_tab1-enstehdat
and plnty ne space
and plnnr ne space
and plnal ne space.
if sy-dbcnt > 0.
if qals-enstehdat = object_tab1-enstehdat.
check qals-entstezeit < object_tab1-entstezeit.
move-corresponding qals to object_tab2.
append object_tab2.
else.
move-corresponding qals to object_tab2.
append object_tab2.
endif.
endif.
endselect.
sort object_tab2 by enstehdat entstezeit descending.
loop at object_tab2 to 25.
if not object_tab2-prueflos is initial.
append object_tab2 to object_tab1.
endif.
clear object_tab2.
endloop.
endif.
when 'SAVE'.
loop at object_tab1 where idx = 'X'.
if ( not object_tab1-plnty is initial and
not object_tab1-plnnr is initial and
not object_tab1-plnal is initial ).
select single * from qals into corresponding fields of wa_qals
where prueflos = object_tab1-prueflos.
if sy-subrc = 0.
wa_qals-plnty = object_tab1-plnty.
wa_qals-plnnr = object_tab1-plnnr.
wa_qals-plnal = object_tab1-plnal.
update qals from wa_qals.
if sy-subrc <> 0.
Message E001 with 'plan is not assigned to lot in sap(updation)'.
else.
v_line = tablctrl-current_line - ( tablctrl-current_line - 1 ).
delete object_tab1.
endif.
endif.
endif.
endloop.
when 'BACK'.
leave program.
when 'NEXT'.
call screen 300.
ENDCASE.
***INCLUDE Y_RQEEAL10_USER_OK_TCF01 .
*& Form user_ok_tc
text
-->P_0078 text
-->P_0079 text
<--P_OK_CODE text
form user_ok_tc using p_tc_name type dynfnam
p_table_name
changing p_ok_code like sy-ucomm.
data: l_ok type sy-ucomm,
l_offset type i.
search p_ok_code for p_tc_name.
if sy-subrc <> 0.
exit.
endif.
l_offset = strlen( p_tc_name ) + 1.
l_ok = p_ok_code+l_offset.
case l_ok.
when 'P--' or "top of list
'P-' or "previous page
'P+' or "next page
'P++'. "bottom of list
perform compute_scrolling_in_tc using p_tc_name
l_ok.
clear p_ok_code.
endcase.
endform. " user_ok_tc
*& Form compute_scrolling_in_tc
text
-->P_P_TC_NAME text
-->P_L_OK text
form compute_scrolling_in_tc using p_tc_name
p_ok_code.
data l_tc_new_top_line type i.
data l_tc_name like feld-name.
data l_tc_lines_name like feld-name.
data l_tc_field_name like feld-name.
field-symbols <tc> type cxtab_control.
field-symbols <lines> type i.
assign (p_tc_name) to <tc>.
concatenate 'G_' p_tc_name '_LINES' into l_tc_lines_name.
assign (l_tc_lines_name) to <lines>.
if <tc>-lines = 0.
l_tc_new_top_line = 1.
else.
call function 'SCROLLING_IN_TABLE'
exporting
entry_act = <tc>-top_line
entry_from = 1
entry_to = <tc>-lines
last_page_full = 'X'
loops = <lines>
ok_code = p_ok_code
overlapping = 'X'
importing
entry_new = l_tc_new_top_line
exceptions
others = 0.
endif.
get cursor field l_tc_field_name
area l_tc_name.
if syst-subrc = 0.
if l_tc_name = p_tc_name.
set cursor field l_tc_field_name line 1.
endif.
endif.
<tc>-top_line = l_tc_new_top_line.
endform. " COMPUTE_SCROLLING_IN_TC
Thanks -
Duplicate records in Infoobject
Hi gurus,
While loading in to a infoobject itz throwing an error as 150 Duplicate records are found in the details tab. My doubt is about temporary correction i.e in the infopackage either we can increase the error handling number and load or we can five the third option(valid records update) and update to infoobject.
My question is when error occurs i can find that that some records are there in added. After the error occured i forced the request to red(Delta) and deleted it and gave 3rd option(valid records update) and updated to infoobject. The load was successful all the records are transferred but in added the number of records is 0.And also i read in one article that the error records will be stored as seperate request in PSA even i cannot find that. I want to know when or how i will get the news records added.Hi Jitu,
If its only Infoobject,then under processing tab select only PSA and check the first option.After this relrun the infopackge.Go to monitor and see whether u got the same no of records including duplicates.After this follow the below steps,
1.Go to RSRV- tcode, expand Master data and double click on second option.
2.Click on the option that is present on right side of the panel. A pop-up window will appear and give the name of the infobject that is failed.
3.select that particular infoobject and click on Delete button,
if necessary then save it and click on execute----do this action only if necessary. Usually by deleting , the problem will be resolved. So, after clicking on Delete button, go back to the monitor screen and process the data packet manually by clicking on the wheel button.
4.Select the request and click on the read manually button (wheel button).
Dont forget to save the infopackge back by selecting only infoobject.
hope this works.Let me know if u have doubts.
Assign points if u r able to find the solution
Regards,
Manjula -
Duplicate Records in InfoProvider
Hi,
I am loading the Transaction Data from the flat files in to the Data Sources.
Initially I have One Request (data from one flat file) loaded in to PSA and InfoCube that has say 100 records.
Later, I loaded another flatfile in to PSA with 50 records (without deleting the initial request). Now in PSA, I have 150 records.
But I would like to load only 50 New records in to the Infocube. When I am executing the DTP, its loading 150 records. i.e. Total 100 (initial records) + 150 = 250 records.
Is there any option by which I can avoid loading the duplicate records in to my InfoCube.
I can find an option that says "Get Data by Request" in DTP. I tried checking that, but no luck.
How can I solve this issue and what exactly the check on "Get Data by Request" does?
Thanks,Hi Sesh,
There is an option in DTP where you can load only the new records. I think you have to select "Do not allow Duplicate records" radio button(i guess)... then try to load the data... I am not sure but you can research for that option in DTP...
Regards,
Kishore -
I am facing an issue when trying to create a Duplicate Record.
Ist time when I create a record, its created Successfully.
I have Attribute validations which should not accept duplicate values, So to check that I tried to create the record with same values to display proper warning message.
After entering all the values (same values which i already entered in 1st record), when I tab out its showing as Red color border for that field, its expecting behaviour so no problem with that...
Then I click on Submit or Next button, now it's showing pop-up with expected warning message along with unexpected Exception message.
oracle.jbo.AttrValException: Attribute test in TestEO is required
The test field is mandatory in EO, VO and .jsff. Could any body please help me what i missed here.
My JDEV version: 11.1.17.0
Regards
GowreenathHi Popz,
Thanks for your reply.
I am using fnd:applicationsPanel next button as nextAction="next", so i didn't find immediate property in fnd:applicationPanel.
So, I tried 2 things based on your comment.
1. nextPartialSubmit ="true"... this option is also not worked.
2. In my Test attribute added immediate="true" this is also not worked.
If you have any id how to set immediate property or related property in fnd:applicationPanel for nextAction. Please let me know.
Thanks
Gowreenath -
Implementing Duplicate record functionality
Hi,
In my application, there is one master table (T1) and 11 model specific details tables(MT1-MT11). They are related by a PK/FK relationship on config_id in both the tables. Depending on the value of a particular field in the details table, one of the 11 table is populated with some data.
Now, i have a search page which is based on the details table(T1). I need to provide a 'duplicate record' functionality on the search page itself, such that when the user selects a particular record and presses 'Duplicate' button, the record in T1 and its corresponding table (say MT1) should be duplicated. He should also have to facility to change some data in the T1 table before committing the changes.
The following is my flow of thoughts:
* From the search page, find out the record that has been selected (config_id is PK).
* redirect to another page (based on a new VO) where the current record is again queried and some fields made updateable (others remain the same). A new config_id is generated from a sequence.
* A new record for the details table (MT1) should be created having the new config_id, but all other data remain the same as before.
Is this the correct approach? How should i go about doing this??
THanks
AshishHi,
This is what i have done till now.
My search is based on VO1. I select one of the records (using a singleSelect radio button), and press 'Copy' button. In the Controller of this search page, i check for button press and then invoke a method in the AM where i get the confif_id (PK) of the record that has been selected.
Then i query another VO (VO2) for this config_id. I get the current row. I create another row from VO2 and assign each attribute from the oldRow to the newRow. I then alter some values in the newVO (such as a new ConfigId) and nullify the WHO columns.
The code i have written in the AM is:
SketchDetailsCopyVOImpl vo = (SketchDetailsCopyVOImpl)getSketchDetailsCopyVO1();
vo.initQuery(ConfigId);
OARow oldRow = (OARow)vo.getRowAtRangeIndex(0);
vo.insertRow(vo.createRow());
OARow newRow = (OARow)vo.first();
for (int i=1; i<oldRow.getAttributeCount(); i++)
System.out.println(i+" -- "+oldRow.getAttribute(i));
newRow.setAttribute(i,oldRow.getAttribute(i));
OADBTransaction txn = getOADBTransaction();
Number newConfigId = txn.getSequenceValue("NRCONFIG_DETAILS_S");
newRow.setAttribute("ConfigId",newConfigId);
newRow.setAttribute("SiteName",null);
newRow.setAttribute("PointNumber",null);
newRow.setAttribute("ConfigStatusFlag","D");
newRow.setAttribute("CreationDate",null);
newRow.setAttribute("CreatedBy",null);
newRow.setAttribute("LastUpdateDate",null);
newRow.setAttribute("LastUpdatedBy",null);
newRow.setAttribute("LastUpdateLogin",null);
vo.setCurrentRow(newRow);I then re-direct to another page where the user can fill in the other required fields (such as SiteName and PointNumber). On the 'Apply' button, i have simply called transaction.commit();
Although this works, but the WHO columns are not automatically populated.
Is this the correct way of doing it?
Souns fine, when you said new Vo I am assuming that represents MT1 and you are just >querying up the current record from T1 and pushing the values to the new record of MT1. Table MT1 contains some additional data that the user dosent see in the search page, nor is his intervention required while querying. So, once the record in T1 has been duplicated, I will simply duplicate the record in MT1 repalcing the config_id with the new config_id.
Thanks
Ashish -
Multiple form submissions - Duplicate Records
I have a standard form that is 'posted' with a submit button.
The program has a validation portion at the head and on re-entry
(post-submit) the data is validated and if there are problems it
falls back through display page code, otherwise it writes the data
to the database and then moves off to a different location
(header("Location: prog.php");).... BUT ... if you keep hitting the
submit button you end up with duplicate records! before you move
on!? Does anyone know hoew to inhibit this multiple submission?
Regards.
PatrickNormally it works fine but if you click the submit button
more than once in quick succession this seems to happen .... it's
as if there is a time lag between when you click the button and the
system recognising the button has been clicked (or rather as the
form data is being validated, the submit button is still 'live') so
effectively it fires up more than one loop around the code if that
makes sense. -
While loading master data to infoobject Load failed due to Duplicate record
Hi Experts,
While loading master data to the infoobject load failed .
The error it is showing is 24 Duplicate record found. 23 recordings used in table.
Pls help me to solve this issue
Thanks in Advance.
Regards,
Gopal.In infopackage settings u will find a checkbox for 'delete duplicate records'.
I think it appears beside the radio button for 'To PSA',and also tick checkbox for 'subsequent update to data targets'.
This will remove the duplicate records(if any) from the PSA before they are processed further by transfer and update rules.
Use this and reload master data.
cheers,
Vishvesh -
How to suppress duplicate records in rtf templates
Hi All,
I am facing issue with payment reason comments in check template.
we are displaying payment reason comments. Now the issue is while making batch payment we are getting multiple payment reason comments from multiple invoices with the same name and it doesn't looks good. You can see payment reason comments under tail number text field in the template.
If you provide any xml syntax to suppress duplicate records for showing distinct payment reason comments.
Attached screen shot, template and xml file for your reference.
Thanks,
Sagar.I have CRXI, so the instructions are for this release
you can create a formula, I called it cust_Matches
if = previous () then 'true' else 'false'
IN your GH2 section, right click the field, select format field, select the common tab (far left at the top)
Select the x/2 to the right of Supress in the formula field type in
{@Cust_Matches} = 'true'
Now every time the {@Cust_Matches} is true, the CustID should be supressed,
do the same with the other fields you wish to hide. Ie Address, City, etc. -
After iOS 7 update, my iPhone 4s Voice Memo App has 5 second delay when the record button is pressed. When it starts recording, it goes from 0 seconds to 5 or so seconds that it shows has recorded. This happens randomly and often, sometimes it will have the 5+ second delay but starts recording at zero seconds. Besides the delay it has been working fine as far as saving and playback is concerned. I have plenty of storage on the phone itself and it NEVER had this problem before I updated to iOS 7. I've reset the phone a couple times by holding down the power and home buttons at the same time. The reason I have an issue with this is that I'm always recording song ideas, melodies, and scratch takes; what I'm saying is when I come up with an idea I need to be able to know that when I hit record it will start right then so I don't forget anything that has just popped in my mind.
Does anyone have a solution or suggestion?
ThanksAfter iOS 7 update, my iPhone 4s Voice Memo App has 5 second delay when the record button is pressed. When it starts recording, it goes from 0 seconds to 5 or so seconds that it shows has recorded. This happens randomly and often, sometimes it will have the 5+ second delay but starts recording at zero seconds. Besides the delay it has been working fine as far as saving and playback is concerned. I have plenty of storage on the phone itself and it NEVER had this problem before I updated to iOS 7. I've reset the phone a couple times by holding down the power and home buttons at the same time. The reason I have an issue with this is that I'm always recording song ideas, melodies, and scratch takes; what I'm saying is when I come up with an idea I need to be able to know that when I hit record it will start right then so I don't forget anything that has just popped in my mind.
Does anyone have a solution or suggestion?
Thanks
Maybe you are looking for
-
How do you remove an e-mail account?
I just updated to iOS 6.0. During setup, it asked if I wanted my me.com e-mail to come to my iPad. I said yes but have changed my mind. I can't figure out how to remove it. It does not show as an e-mail account. Any suggestions?
-
OIM 11g: Error while prepopulating process form
I have a custom resource, with 4 child tables. When trying to provision the resource to a user when I click through to start populating data, I get the following error: Target Class = com.thortech.xl.util.adapters.tcUtilDateOperations <Mar 17, 2012 9
-
Premiere Timelines - Best Practice and Workflows
Hello all, I am wondering if you can offer some advice. I have been a Final Cut Pro 7 user my whole life - and more recently FCP X. We are currently looking into the possibility of switching some of our programs over to Premiere because it seems to h
-
RFC sender adapter not running
Hi there, I have following scenario: R3 -(rfc)-> XI -(ftp)-> LEGACY. In R3, i created a RFC DESTINATION (type T) : with Program_ID & GW options (hostname= R3 hostname & service= sapgwXX where XX means sys number). This RFC currently works!! In the RF
-
Font size in PDF form (text boxes)
Hi! I have an application form as a PDF which I have to print and send back. But the text isn't fitting into the text box, so I get a scroll bar. Now I either have to change the font size or change the size of the text box. But I couldn't find out ho