Update and delete a record
Hi all
I have a requirement in oracle forms 6i
I have a data block which is tabular
there are 5 columns
1 column is display only and other 4 are normal text fields where we can insert update and delete those records
My requirement is when a user updates a record an alert must fire and the alert should ask whether the user wants to update that particular record
if the user presses yes then the record should be updated else the record should show as it was previously shown
Similarly in case of delete an alert should fire where it should be asked for confirmation if the user presses yes then the record should be deleted from the data base
else the record should be again visible on the form as earlier
also my 3rd requirement is that
i have a item field which is normal text and the display only field is the description
when entering a new record when i enter the item field and press tab or navigate out of the item field then the description of the item should be pouplated into the decsription read only field
Please help me in the above 3 cases
I am new to forms
I am using a friends ID which has many posts
Thanks in advance
1)
your first requirement i'd do in the PRE-UPDATE trigger of the block:
DECLARE
v_alert_button NUMBER;
BEGIN
v_alert_button := SHOW_ALERT('your_alert'); -- "Do you want to update?"
IF v_alert_button = ALERT_BUTTON1 -- assuming "No"
THEN
-- reset value:
:YOUR_BLOCK.YOUR_ITEM1 := GET_ITEM_PROPERTY('YOUR_BLOCK.YOUR_ITEM1', DATABASE_VALUE);
-- optionally set item to valid if you don't want validations to fire:
SET_ITEM_PROPERTY('YOUR_BLOCK.YOUR_ITEM1', ITEM_IS_VALID, PROPERTY_TRUE);
-- do this for every item:
:YOUR_BLOCK.YOUR_ITEM2 := GET_ITEM_PROPERTY('YOUR_BLOCK.YOUR_ITEM2', DATABASE_VALUE);
-- finally reset record status:
SET_RECORD_STATUS(:SYSTEM.CURSOR_RECORD, STATUS, QUERY_STATUS);
-- interrupt PRE-UPATE trigger:
RAISE FORM_TRIGGER_FAILURE;
END IF;
END;(not tested, please try for youself)
2)
raise the alert in PRE-DELETE trigger.
3)
you can do this within the WHEN-VALIDATE-ITEM trigger or a List-of-value (LOV) that returns the description values.
Similar Messages
-
SUN TEAM: Bugs in update and delete a record with long query
Creator Team,
In my opinio there is a bug issue with update and delete a record with a complex sql query. I�m using oracleXE and ojdbc14.ar with tomcat
In just two page I�m receving the following msg (I have 12 pages doing the same thing with less complex queries)
* Number of conflicts while synchronizing: 1 SyncResolver.DELETE_ROW_CONFLICT row 2 won't delete as values in database have changed: 2006-11-29
* Cannot commit changes: Number of conflicts while synchronizing: 1 SyncResolver.UPDATE_ROW_CONFLICT row 0 values changed in database
when i tried to delete or commit the updated changes in the register...
The interesting is that this code function with jdbc of jsc...
My query is bellow:
SELECT ALL PATRIMONIO.TB_BEM.INCODIGOBEM,
PATRIMONIO.TB_BEM.VATOMBAMENTO,
PATRIMONIO.TB_BEM.VAMATERIAL,
PATRIMONIO.TB_BEM.INCODIGOSETOR,
PATRIMONIO.TB_SETOR.VANOME AS NOMESETOR,
PATRIMONIO.TB_BEM.INCODIGOFORNECEDOR,
PATRIMONIO.TB_FORNECEDOR.VANOME AS NOMEFORNECEDOR,
PATRIMONIO.TB_BEM.DACHEGADA ,
PATRIMONIO.TB_BEM.DASAIDAPREVISTA,
PATRIMONIO.TB_BEM.DASAIDAEFETIVA,
PATRIMONIO.TB_BEM.VAMARCA,
PATRIMONIO.TB_BEM.VAMODELO,
PATRIMONIO.TB_BEM.VADESBAIXABEM,
PATRIMONIO.TB_BEM.INCODIGOTIPOAQUISICAO,
PATRIMONIO.TB_TIPOAQUISICAO.VANOME AS NOMETIPOAQUISICAO
FROM PATRIMONIO.TB_BEM , PATRIMONIO.TB_TIPOAQUISICAO, PATRIMONIO.TB_SETOR, PATRIMONIO.TB_FORNECEDOR
WHERE PATRIMONIO.TB_BEM.INCODIGOTIPOAQUISICAO = PATRIMONIO.TB_TIPOAQUISICAO.INCODIGOTIPOAQUISICAO
AND PATRIMONIO.TB_BEM.INCODIGOSETOR = PATRIMONIO.TB_SETOR.INCODIGOSETOR
AND PATRIMONIO.TB_BEM.INCODIGOFORNECEDOR = PATRIMONIO.TB_FORNECEDOR.INCODIGOFORNECEDOR
AND PATRIMONIO.TB_BEM.INCODIGOBEM LIKE ?
AND PATRIMONIO.TB_BEM.VATOMBAMENTO LIKE ?
AND PATRIMONIO.TB_BEM.VAMATERIAL LIKE ?
AND PATRIMONIO.TB_SETOR.VANOME LIKE ?
AND PATRIMONIO.TB_FORNECEDOR.VANOME LIKE ?
ORDER BY PATRIMONIO.TB_BEM.VATOMBAMENTO ASC
Why this problem is happing? Did you had some solution for that? Is the problem because the query is too long?!
please help me!
Gustavo CallouHello people,
I�m doing this to try to solution that bug:
This code is working fine... but I do not understand why I�m receiving the nullpointer exception!??!!?
// create a new rowset
CachedRowSetXImpl pkRowSet = new CachedRowSetXImpl();
try {
RowKey rk = tableRowGroup1.getRowKey();
if (rk != null) {
// set the rowset to use the Patrimonio database
pkRowSet.setDataSourceName("java:comp/env/jdbc/Patrimonio");
String query = "DELETE FROM TB_BEM WHERE INCODIGOBEM = "+tb_bemDataProvider.getValue("INCODIGOBEM", rk).toString();
pkRowSet.setCommand(query);
pkRowSet.setTableName("TB_BEM");
// execute the rowset -- which will contain a single row and single column
pkRowSet.execute();
pkRowSet.next();
info("Apagado");
} catch (Exception ex) {
log("ErrorDescription", ex);
error(getApplicationBean1().trateException(ex.getMessage()));
} finally {
pkRowSet.close();
Please someone help me!!!
Gustavo Callou -
Updating and deleting records in access DB
i'm trying to make multiple updates and deletes in a access DB and it doesn't work.
my program executes lot's of updates and delete statements when saving, but I only commit in the end when I know all the statements finished ok.
I can't make it a batch update since I need to retrieve the auto-number that access issues me on some of my tables.
I know it's kinda fuzzy, but my program is SO big already, and I can't really put the code in here - it wouldn't do much good.
what I will do is write what my log shows (i issue a log output whenever there's a executeQuery/Update and before commit/rollback
DBG : 29/04/03 : UPDATE CASES_T SET CASE_office_case_id = 1 ,CASE_year = 2 ,CASE_total_debt = 10009 ,CASE_is_limited = true ,CASE_monthly_payment = 400 ,CASE_hotzlap_case_id = ' - - - ' ,CASE_status = 26 WHERE CASE_tech_id = 5
DBG : 29/04/03 : SELECT count(*) from CASES_OWEES_T where CAOW_Tech_Id = 23
DBG : 29/04/03 : UPDATE CASES_OWEES_T SET CAOW_case_tech_id = 5 ,CAOW_id_number = '046259990' ,CAOW_first_name = '���' ,CAOW_last_name = '������' ,CAOW_work_place = 'jjjjjjjjjjjjj' ,CAOW_address = '1jjjjjjjjjjjj' ,CAOW_telephone = '09-8099999' ,CAOW_pelephone = '000-000000' ,CAOW_hotzlap_case_id = ' - - - ' ,CAOW_is_valid_address = false WHERE CAOW_TECH_ID = 23
DBG : 29/04/03 : SELECT count(*) from CASES_OWEES_T where CAOW_Tech_Id = 24
DBG : 29/04/03 : UPDATE CASES_OWEES_T SET CAOW_case_tech_id = 5 ,CAOW_id_number = ' ' ,CAOW_first_name = '�����' ,CAOW_last_name = '���' ,CAOW_work_place = '����' ,CAOW_address = '��?' ,CAOW_telephone = ' - ' ,CAOW_pelephone = ' - ' ,CAOW_hotzlap_case_id = ' - - - ' ,CAOW_is_valid_address = true WHERE CAOW_TECH_ID = 24
DBG : 29/04/03 : SELECT count(*) from CASES_INNER_CASES_T where CICA_Tech_Id = 10
DBG : 29/04/03 : UPDATE CASES_INNER_CASES_T SET CICA_case_tech_id = 5 ,CICA_debt = 5000897 ,CICA_winner_name = '���' ,CICA_lawyer_tech_id = '6' ,CICA_hotzlap_case_id= '02-22122-22-2' WHERE CICA_tech_id= 10
DBG : 29/04/03 : SELECT count(*) from CASES_INNER_CASES_T where CICA_Tech_Id = 11
DBG : 29/04/03 : UPDATE CASES_INNER_CASES_T SET CICA_case_tech_id = 5 ,CICA_debt = 20008 ,CICA_winner_name = '������' ,CICA_lawyer_tech_id = '2' ,CICA_hotzlap_case_id= '02-22222-22-2' WHERE CICA_tech_id= 11
DBG : 29/04/03 : SELECT count(*) from CASES_INNER_CASES_T where CICA_Tech_Id = 14
DBG : 29/04/03 : UPDATE CASES_INNER_CASES_T SET CICA_case_tech_id = 5 ,CICA_debt = 129 ,CICA_winner_name = '' ,CICA_lawyer_tech_id = '4' ,CICA_hotzlap_case_id= '02-22222-22-2' WHERE CICA_tech_id= 14
DBG : 29/04/03 : SELECT count(*) from CASES_CUSTOMER_CARDS_T where CUCA_Tech_Id = 23
DBG : 29/04/03 : UPDATE CASES_CUSTOMER_CARDS_T SET CUCA_case_tech_id = 5 , CUCA_sum = 324 , CUCA_fee_plus_maam = -38.0 , CUCA_for_division = 285.0 , CUCA_voucher = '3222 ' , CUCA_date = '2003-04-24' , CUCA_in_or_out = true WHERE CUCA_tech_id = 23
DBG : 29/04/03 : SELECT count(*) from CASES_CUSTOMER_CARDS_T where CUCA_Tech_Id = 22
DBG : 29/04/03 : UPDATE CASES_CUSTOMER_CARDS_T SET CUCA_case_tech_id = 5 , CUCA_sum = 324 , CUCA_fee_plus_maam = -38.0 , CUCA_for_division = 285.0 , CUCA_voucher = '2222 ' , CUCA_date = '2003-04-23' , CUCA_in_or_out = true WHERE CUCA_tech_id = 22
DBG : 29/04/03 : SELECT count(*) from CASES_CUSTOMER_CARDS_T where CUCA_Tech_Id = 21
DBG : 29/04/03 : UPDATE CASES_CUSTOMER_CARDS_T SET CUCA_case_tech_id = 5 , CUCA_sum = 100 , CUCA_fee_plus_maam = -11.0 , CUCA_for_division = 0.0 , CUCA_voucher = '2222 ' , CUCA_date = '2003-04-23' , CUCA_in_or_out = true WHERE CUCA_tech_id = 21
DBG : 29/04/03 : SELECT count(*) from CASES_CUSTOMER_CARDS_T where CUCA_Tech_Id = 20
DBG : 29/04/03 : UPDATE CASES_CUSTOMER_CARDS_T SET CUCA_case_tech_id = 5 , CUCA_sum = 1000 , CUCA_fee_plus_maam = -118.0 , CUCA_for_division = 882.0 , CUCA_voucher = '1111 ' , CUCA_date = '2003-04-23' , CUCA_in_or_out = true WHERE CUCA_tech_id = 20
DBG : 29/04/03 : SELECT count(*) from CASES_INVESTIGATIONS_T where CAIN_Tech_Id = 16
DBG : 29/04/03 : UPDATE CASES_INVESTIGATIONS_T SET CAIN_case_tech_id = 5 ,CAIN_text = '' ,CAIN_was_declared_limited = false ,CAIN_date = '2003-03-01' ,CAIN_rulling_effective_date = '2003-02-01' ,CAIN_payment_amount = 400 WHERE CAIN_TECH_ID = 16
DBG : 29/04/03 : SELECT count(*) from CASES_INVESTIGATIONS_T where CAIN_Tech_Id = 12
DBG : 29/04/03 : UPDATE CASES_INVESTIGATIONS_T SET CAIN_case_tech_id = 5 ,CAIN_text = '' ,CAIN_was_declared_limited = true ,CAIN_date = '1970-01-01' ,CAIN_rulling_effective_date = '1905-03-06' ,CAIN_payment_amount = 90 WHERE CAIN_TECH_ID = 12
DBG : 29/04/03 : SELECT count(*) from CASES_INVESTIGATIONS_T where CAIN_Tech_Id = 10
DBG : 29/04/03 : UPDATE CASES_INVESTIGATIONS_T SET CAIN_case_tech_id = 5 ,CAIN_text = '' ,CAIN_was_declared_limited = false ,CAIN_date = '1970-01-01' ,CAIN_rulling_effective_date = '1990-01-30' ,CAIN_payment_amount = 89 WHERE CAIN_TECH_ID = 10
DBG : 29/04/03 : DELETE FROM CASES_INVESTIGATIONS_T where CAIN_tech_id = 9
DBG : 29/04/03 : DELETE FROM CASES_INVESTIGATIONS_T where CAIN_tech_id = 9
DBG : 29/04/03 : DELETE FROM CASES_INVESTIGATIONS_T where CAIN_tech_id = 14
DBG : 29/04/03 : DELETE FROM CASES_INVESTIGATIONS_T where CAIN_tech_id = 14
DBG : 29/04/03 : DELETE FROM CASES_INVESTIGATIONS_T where CAIN_tech_id = 13
DBG : 29/04/03 : DELETE FROM CASES_INVESTIGATIONS_T where CAIN_tech_id = 13
DBG : 29/04/03 : DELETE FROM CASES_INVESTIGATIONS_T where CAIN_tech_id = 11
DBG : 29/04/03 : DELETE FROM CASES_INVESTIGATIONS_T where CAIN_tech_id = 11
DBG : 29/04/03 : SELECT count(*) from CASES_PAYMENTS_T where CAPY_Tech_Id = 71
DBG : 29/04/03 : UPDATE CASES_PAYMENTS_T SET CAPY_case_tech_id = 5 ,CAPY_sum = 400 ,CAPY_exception_text = '' ,CAPY_is_exception = true ,CAPY_voucher = '' ,CAPY_date = '2003-04-01' ,CAPY_is_paid_in_hotzlap = false WHERE CAPY_TECH_ID = 71
DBG : 29/04/03 : SELECT count(*) from CASES_PAYMENTS_T where CAPY_Tech_Id = 70
DBG : 29/04/03 : UPDATE CASES_PAYMENTS_T SET CAPY_case_tech_id = 5 ,CAPY_sum = 400 ,CAPY_exception_text = '' ,CAPY_is_exception = true ,CAPY_voucher = '' ,CAPY_date = '2003-03-01' ,CAPY_is_paid_in_hotzlap = false WHERE CAPY_TECH_ID = 70
DBG : 29/04/03 : SELECT count(*) from CASES_PAYMENTS_T where CAPY_Tech_Id = 69
DBG : 29/04/03 : UPDATE CASES_PAYMENTS_T SET CAPY_case_tech_id = 5 ,CAPY_sum = 400 ,CAPY_exception_text = '' ,CAPY_is_exception = true ,CAPY_voucher = '' ,CAPY_date = '2003-03-01' ,CAPY_is_paid_in_hotzlap = false WHERE CAPY_TECH_ID = 69
DEV : 29/04/03 : commitsure - I don't get any exception. the data just
doesn't show in the DB. (no updating/deletion of
records)
as I wrote before - when the the programm commits the
changes and does the next select command it seems as
if the data was changed/deleted but if I check the DB
with access or if I restart the prgoram then I see
that the data didn't change.
Access/jdbc-odbc has a problem where modifications are not 'commited' when the statement completes. Instead one must do one of the following:
1. Explicit commit.
2. Simple select after statement.
3. Close the connection.
Presumably you are doing 1.
Since other than this it does work, it suggests one of the following.
1. Something is wrong with your environment. For instance you are looking at the wrong database. Or not refreshing. Or something else like that.
2. You are using something besides a simple connection - like opening it with 'scroll insensitive'.
3. The complexity is causing it to lose an error message. This can be tested by doing each statement individually and verify that none produce an error.
4. Maybe you found a bug. You can turn on ODBC tracing via the applet panel and see if digging through all of the detail provides any clues (you can also do this with 3 above.) -
Unable to update and delete record in table
Hello All,
Kindly help me regarding the below mentioned issue plz
When I want to update or delete record in table from form developed in 6i give no error message but no action and when I run same form on other system updation and deletion are successfully done.
Any suggestionHello
More explanation is as under:
1. I am working on only one table say A
2. Wants to update only one row of Table A at one time in single user envoirment.
3. My form is successfully update some rows as well but not on all rows on one PC while same form able to update all rows on other PC.
4. I drop the table and re-create the table again but problem persist.
Any advice plz. -
Questions about master-detail update and delete!!
I have created a view object with two entity objects.
These two entity objects map master-detail tables in DB.
I want to update both tables when the user input, and delete the record in detail table (keeping master table unchanged) when the user click delete button.
How can I do?did you figure this out? i have created VO made out of two updatable EOs and update works fine. But still have issue with deletion!
-
Insert, update and delete trigger over multiple Database Links
Hello guys,
first of all I'll explain my environment.
I've got a Master DB and n Slave Databases. Insert, update and delete is only possible on the master DB (in my opinion this was the best way to avoid Data-inconsistencies due to locking problems) and should be passed to slave databases with a trigger. All Slave Databases are attached with DBLinks. And, additional to this things, I'd like to create a job that merges the Master DB into all Slave DB's every x minutes to restore consistency if any Error (eg Network crash) occurs.
What I want to do now, is to iterate over all DB-Links in my trigger, and issue the insert/update/delete for all attached databases.
This is possible with the command "execute immediate", but requires me to create textual strings with textually coded field values for the above mentioned commands.
What I would like to know now, is, if there are any better ways to provide these functions. Important to me is, that all DB-Links are read dynamically from a table and that I don't have to do unnecessary string generations, and maybe affect the performance.
I'm thankful for every Idea.
Thank you in advance,
best regards
ChristophWell, I've been using mysql for a long time, yes, but I thought that this approach would be the best for my requirements.
Materialized View's don't work for me, because I need real-time updates of the Slaves.
So, sorry for asking that general, but what would be the best technology for the following problem:
I've got n globally spread Systems. Each of it can update records in the Database. The easies way would be to provide one central DB, but that doesn't work for me, because when the WAN Connection fails, the System isn't available any longer. So I need to provide core information locally at every System (connected via LAN).
Very important to me is, that Data remain consistent. That means, that it must not be that 2 systems update the same record on 2 different databases at the same time.
I hope you understand what I'd need.
Thank you very much for all your replies.
best regards
Christoph
PS: I forgot to mention that the Databases won't be very large, just about 20k records, and about 10 queriees per second during peak times and there's just the need to sync 1 Table.
Edited by: 907142 on 10.01.2012 23:14 -
Insert, update and delete on updatable join views
Hi I need to insert, update and delete data in a views. I tried the foloing example
http://download-uk.oracle.com/docs/cd/B14117_01/server.101/b10739/views.htm#i1006232
We have two tables:
CREATE TABLE dept (
deptno NUMBER(4) PRIMARY KEY,
dname VARCHAR2(14),
loc VARCHAR2(13));
CREATE TABLE emp (
empno NUMBER(4) PRIMARY KEY,
ename VARCHAR2(10),
job VARCHAR2(9),
mgr NUMBER(4),
sal NUMBER(7,2),
comm NUMBER(7,2),
deptno NUMBER(2),
FOREIGN KEY (DEPTNO) REFERENCES DEPT(DEPTNO));
and one view:
CREATE VIEW emp_dept AS
SELECT emp.empno, emp.ename, emp.deptno, emp.sal, dept.dname, dept.loc
FROM emp, dept
WHERE emp.deptno = dept.deptno
AND dept.loc IN ('DALLAS', 'NEW YORK', 'BOSTON');
this update command works successfully
UPDATE emp_dept
SET sal = sal * 1.10
WHERE deptno = 10;
but this one fails because it attempts to modify the base dept table, and the dept table is not key preserved in the emp_dept view.:
UPDATE emp_dept
SET loc = 'BOSTON'
WHERE ename = 'SMITH';
I tried to create the view with "WITH CHECK OPTION" clause but whith no success :(
My question is: how can I do this with a simple across this view. I rather not use Instead Of Trigger because it take a lot of PL/SQL code :(
thanks in advance
OperatorUPDATE emp_dept
SET loc = 'BOSTON'
WHERE ename = 'SMITH';But that doesn't make sense. You cannot just LOC for SMITH, because LOC is not an attribute of EMP. If you change the LOC in the view then you must change it for all employees in DEPT 30 (or whatever).
The key preserved thing is merely about maintaining your data integrity.
I rather not use Instead Of Trigger because it take a lot of PL/SQL code :(The problem is, your business rule is not clear. Are you wanting to change the LOC for the DEPT record which is the DEPTNO to which SMITH belongs? Or are you wanting to change SMITH's DEPTNO to be the one for the BOSTON office?
Cheers, APC -
How to perform insert, update and delete in a table component
hi all,
i am using a table component in my page. I want to retreive data from multiple tables as well as perform insertion, updation and deletion operation.The changes should be affected in the corresponding tables. can anyone provide a solution for my problem.
Thanks in advance
regards,
prasantThere is a great tutorial for insert, update and delete records in a table.
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
Hope it helps.
Thanks,
Moumita -
How to update and insert the records without using Table_comparison and Map_operation?
Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE
-
Hello
I can insert records in a table using the xsql but am unable to update and delete from tables using xsql ....
need help its urgent ..
can anyone mail me some sample code for xsql update and delete ...
thank u
nullIf you're using BC4J and XSQL together, then you can leverage the oracle.jbo.xsql.UpdateViewObject action handler that ships with BC4J for use in XSQL pages to make it easy to handle hierarchical XML documents using BC4J view objects.
BC4J view objects can both produce and consume XML documentment using the writeXML() and readXML() API's on oracle.jbo.ViewObject, respectively.
If there are view links in place, then the BC4J XML processing mechanism follows these links to nested, detail information. When you "feed" an existing XML document to the YourViewObject.readXML() method, it automatically processes inserts, updates, and deletes, as well as apply any BC4J business logic that exists in your Entity Objects (if any).
The BC4J Action Handlers make it easy to combine BC4J with XSQL pages without having to write the writeXML() and readXML() calls by hand. -
Query,insert,update and delete in forms6i
Hi
i am new to forms6i, when i tried to update or delete the record it is giving error "FRM-40508 Oracle error: unable to insert record". when i hardcode the update statement it is executing fine. i have checked my sql statement at alert box, it is fine.
is there any demo programes with insert, delete and update the database records. i have't find the these in forms6i demos. can refer some sites to check.
thanksHi,
Before inserting be sure that you are in the correct block. Tables are tied to blocks. You can issue the code
GO_BLOCK('insert blockname here');
insert ...
Hope this helps.
Regards.
Bob DJ -
Any KM which can insert , update and delete
hi everyone ,
i have a oracle target which i want to keep synchronize daily with sql server source which means if there is any deletion in source ,i want a deletion in target too . Hope iam clear .
Is there is any KM that can do insert ,update and delete . i know the other way is to truncate and load but i few tables which are millions of records doing truncating daily not possible .
is there is any way out for this issue ?
ThanksOr
1) create to load only the PK into a temp table (yellow interface as suggestion)
2) create a procedure to delete your target with a "not exists" option from the created temp table
3) create an "normal" interface with Incremental Update
Make any sense? -
How to Implement basic Insert ,Update and delete Actions
Hi all,
i want to implement 1)INSERT 2)UPDATE 3)DELETE actions in webdynpro application means i have to add a new record to my R/3 backend and update and delete records from my database
can anyone tell me how to do these actions
Regards
Padma NHi Murtuza ,
I have 2 views in my application.In the first view i enterd some purchaseorder number and clicked serarch button.The items regarding that purchaseorder gets populated in the table which is in second view.All the data is in R/3 backend system.
the code i used to get the details of that particular purchaseorder is
try {
wdcontext.currentZ_Matrls_For_Inputlement().modelObiect.execte();
catch(RFCException e){
/* Catch the Exception Here */
Here now i want to delete one record of that particular purchaseorder from the database.So Wat should be the code to delete record from R/3 Model
Regards
Padma N -
Comparing two internal tables and deleting the record not present in second
Hi All,
I have a internal table itaba with PERNR as primary key and various other columns (1000 records) and table B with PERNR as primary key and 800 records.
Now what is the best way to compare these two and delete the record from table A when its corresponding record is not present in table B?
Thanks and Regards,
MohanHI SIR
u trained us in accenture
Hi all
when ever m running this session in SM35 , M getting error as :
"LEAVE TO TRANSACTION" MARA-BISMT is not allow
in batch input
REPORT YASEC_BDC_NIK_SESSION
no standard page heading
message-id zmm
line-count 65
line-size 150.
tables : mara.
*Top includr program
INCLUDE YNEW_MAIN_TOP.
*include yasec_bdc_nik_session_top.
***********selection screen *******************
selection-screen begin of block b1 with frame title text-001.
selection-screen skip.
PARAMETERS: p_ifile(128) TYPE c .
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: rad1 TYPE c RADIOBUTTON GROUP 1 USER-COMMAND gr1,
rad2 TYPE c RADIOBUTTON GROUP 1 .
SELECTION-SCREEN SKIP.
PARAMETERS: p_sess TYPE c.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK b1.
Subroutine call***************************
INCLUDE YNEW_MAIN_F01.
*include yasec_bdc_nik_session_f01.
*********At selection event triggered *************
at selection-screen on value-request for p_ifile.
To get F4 help for the input file path
PERFORM f_f4_input_file.
AT SELECTION-SCREEN ON p_ifile.
To validate and upload the input file
PERFORM f_load_file.
AT SELECTION-SCREEN ON p_sess.
To validate the Number of Sessions field
IF rad2 IS NOT INITIAL AND sy-ucomm EQ c_onli.
PERFORM f_check_sessions.
ENDIF.
***********Start of selection *******************
start-of-selection.
*To process BDC
PERFORM f_process_bdc.
TOP OF PAGE
TOP-OF-PAGE.
Writes the report heading and for displaying line number.
PERFORM f_report_header.
TYPES : BEGIN OF t_final,
matnr(50) TYPE c,
bismt(18) type c,
end of t_final.
TYPES: BEGIN OF t_fdata,
data(256) TYPE c,
END OF t_fdata.
TYPES: BEGIN OF t_error,
message(100) TYPE c,
END OF t_error.
*Internal table declarations
*Internal table to load the data from the file that is changed throgh BDC
DATA : i_final TYPE STANDARD TABLE OF t_final,
wa_final TYPE t_final.
*Internal table to store the error messages
DATA : i_error TYPE STANDARD TABLE OF t_error,
wa_error TYPE t_error.
*Internal table to load the raw data
DATA : i_fdata TYPE STANDARD TABLE OF t_fdata,
wa_fdata TYPE t_fdata.
*Internal table to store records of BDC
DATA : i_bdcdata TYPE STANDARD TABLE OF bdcdata INITIAL SIZE 0,
wa_bdcdata TYPE bdcdata.
Internal table to store BDC messages
DATA: i_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll INITIAL SIZE 0,
wa_bdcmsgcoll TYPE bdcmsgcoll.
VARIABLE DECLARATIONS
DATA: v_ifile TYPE string,
v_input TYPE i,
c_delimiter TYPE c VALUE 'X',
v_mode TYPE c VALUE 'A',
v_sessions TYPE i.
CONSTANTS
CONSTANTS : c_flagx TYPE c VALUE 'X',
c_slash TYPE c VALUE '/',
c_onli(4) TYPE c VALUE 'ONLI',
c_vl02(4) TYPE c VALUE 'VL02',
c_s TYPE c VALUE 'A'.
FORM f_f4_input_file .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_ifile.
ENDFORM. " f_f4_input_file
*& Form f_load_file
FORM f_load_file .
v_ifile = p_ifile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_ifile
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = i_fdata
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
*Text-103-Input file does not exist.
MESSAGE e000 WITH text-103 .
ELSEIF NOT i_fdata IS INITIAL.
DELETE i_fdata WHERE data = space.
DESCRIBE TABLE i_fdata LINES v_input.
ENDIF.
IF v_input EQ 0.
Text-104 - Input file is empty.
MESSAGE e000 WITH text-104 .
ENDIF.
ENDFORM. " f_load_file
*& Form f_check_sessions
FORM f_check_sessions .
IF p_sess IS INITIAL.
MESSAGE e000 WITH text-106.
ELSE.
v_sessions = v_input DIV p_sess.
ENDIF.
ENDFORM. " f_check_sessions
*& Form f_process_bdc
text
FORM f_process_bdc.
LOOP AT i_fdata INTO wa_fdata.
SPLIT wa_fdata AT cl_abap_char_utilities=>horizontal_tab
INTO wa_final-matnr
wa_final-bismt.
APPEND wa_final TO i_final.
CLEAR wa_fdata.
ENDLOOP.
IF rad1 = c_flagx.
PERFORM f_passbdc_vl02.
ELSEIF rad2 = c_flagx.
PERFORM f_sessions_vl02.
ENDIF.
ENDFORM. "f_process_bdc
To populate the Screen information
p_program Program Name
p_dynpro Screen Number
FORM bdc_dynpro USING p_program TYPE any
p_dynpro TYPE any.
CLEAR wa_bdcdata.
Populate the BDC structure with the Screen Information.
Move the Program name PROGRAM
wa_bdcdata-program = p_program.
Move the Screen Number DYNPRO
wa_bdcdata-dynpro = p_dynpro.
Indicate the beginning of a new screen
wa_bdcdata-dynbegin = c_flagx.
APPEND wa_bdcdata TO i_bdcdata.
ENDFORM. "f_bdc_dynpro
*& Form f_passbdc_vl02
text
FORM f_passbdc_vl02.
DATA: l_lines_im TYPE i.
SORT i_final BY matnr ASCENDING.
CLEAR wa_final.
LOOP AT i_final INTO wa_final.
CLEAR: i_bdcmsgcoll[],
wa_bdcmsgcoll,
wa_bdcdata.
CLEAR: i_bdcdata[].
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
wa_final-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARA-BISMT'.
perform bdc_field using 'MARA-BISMT'
wa_final-bismt.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM02'.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM03'.
CALL TRANSACTION 'MM02' USING i_bdcdata
MODE v_mode
UPDATE c_s
MESSAGES INTO i_bdcmsgcoll.
If error occurred in call transaction 'VA02' then stores all
information of failed records into internal table i_error_im.
IF sy-subrc NE 0.
DESCRIBE TABLE i_bdcmsgcoll LINES l_lines_im.
CLEAR wa_bdcmsgcoll.
READ TABLE i_bdcmsgcoll INTO wa_bdcmsgcoll INDEX l_lines_im.
To capture success and error messages in BDC.
CALL FUNCTION 'FORMAT_MESSAGE' "#EC *
EXPORTING
id = wa_bdcmsgcoll-msgid
lang = wa_bdcmsgcoll-msgspra
no = wa_bdcmsgcoll-msgnr
v1 = wa_bdcmsgcoll-msgv1
v2 = wa_bdcmsgcoll-msgv2
v3 = wa_bdcmsgcoll-msgv3
v4 = wa_bdcmsgcoll-msgv4
IMPORTING
msg = wa_error-message
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ELSE.
WRITE: text-111 COLOR 7.
ENDIF.
CLEAR: wa_final.
REFRESH i_bdcdata.
ENDLOOP.
ENDFORM. "f_passbdc_va02
*& Form bdc_field
text
-->P_FNAM text
-->P_FVAL text
FORM bdc_field USING p_fnam TYPE any
p_fval TYPE any.
CLEAR wa_bdcdata.
Populate the Field Name
wa_bdcdata-fnam = p_fnam.
Populate the field value
wa_bdcdata-fval = p_fval.
APPEND wa_bdcdata TO i_bdcdata.
ENDFORM. "f_bdc_field
*& Form f_sessions_vl02
text
FORM f_sessions_vl02 .
DATA: l_sindex TYPE sy-tabix VALUE 1,
l_eindex TYPE sy-tabix,
l_flag TYPE c VALUE space.
l_eindex = v_input.
SORT i_final BY matnr ASCENDING.
DO p_sess TIMES.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'Y_VL02_NIK'
user = sy-uname
keep = c_flagx
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR wa_final.
CLEAR: i_bdcdata[].
LOOP AT i_final INTO wa_final FROM l_sindex TO l_eindex .
IF l_flag = v_sessions.
CLEAR l_flag.
EXIT.
ENDIF.
l_flag = l_flag + 1.
CLEAR: i_bdcdata[].
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
wa_final-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARA-BISMT'.
perform bdc_field using 'MARA-BISMT'
wa_final-bismt.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM02'.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM03'.
l_sindex = l_sindex + 1.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDDO.
ENDFORM. " f_sessions_vl02
*& Form f_report_header
FORM f_report_header .
FORMAT COLOR COL_HEADING INTENSIFIED ON.
ULINE.
text-201 - Company: Carrier
text-102- Batch Data Communication.
text-202 - System: SAP
WRITE: /1 sy-vline,
3 text-201,
50 text-102,
100 text-202,
AT sy-linsz sy-vline.
text-203 - Program:
text-204 - Date/Time:
WRITE: /1 sy-vline,
3 text-203, sy-repid ,
100 text-204,sy-datum ,c_slash, sy-uzeit,
AT sy-linsz sy-vline.
text-205 - User ID:
text-206 - Page:
WRITE: /1 sy-vline,
3 text-205, sy-uname,
100 text-206, sy-pagno,
AT sy-linsz sy-vline.
FORMAT COLOR OFF.
ULINE.
ENDFORM. " f_report_header
FORM bdc_transaction USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
TABLES
dynprotab = i_bdcdata
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE: / text-109 ,wa_final-matnr,
text-110 .
ENDIF.
ENDFORM. "bdc_transaction -
Adding update and delete buttons to a Report from SQL Query
There is an option when creating a QBE to add update and delete
links which i find quite useful, but this option doesn't seem to
be possible on a Report from SQL Query. Do i need to do
something special to add them? is the option located in a
different place?Hi,
You can only add Update ,Delete in QBE Reports,
there is no option in Portal which can be used to
have these buttons in the Reports from Query Wizard or
Report from SQL Query.
Thanks
Vineet
Maybe you are looking for
-
Server 2012 R2 VDI with profile disks not using domain default profile
I'm testing a VDI environment running on Windows Server 2012 R2. The VMs in the pool are running Windows 7. I've enabled profile disks for my test pool. I also have a domain default profile (stored under netlogon) that is used when creating profiles
-
How to enlarge picture on my hp office jet 6600 all in one printer
how do i enlarge pictures from my hp office jet 6600 all in one printer
-
When I check my boot SSD drive using Disk Utility under Mavericks, I often get "Incorrect number of extended attributes" errors. But if I boot off an external drive and check the same SSD, no errors are reported. This happens not just with the SSD
-
Bright white speck under screen... HELP?
Its been about 4 days now, I cannot get this tiny speck to go away.. It shows up really bad on a white screen. Will Apple exchange it for a good one with no problem? I love my phone, and this speck is killing me!
-
Assets balance Report(T Cd s_alr_87011964) Not Tally with GL Code in FBL3N
Hi Friends SAP Standard Assets balance Report(T Code s_alr_87011964 and s_alr_87011963 ) Not Tally with GL Code in FBL3N. In SAP report coming with Report Date but FBL3N coming with Posting Date So How I add Posting Date input parameter in Sap Standa