Javascript for deletion of records
hi all
i have a table on which a function acts to insert and delete records. I have to check whether the table has existing records for a particular month before deletion and if it does then a javascript popup should say that "records already exist if you continue all records will be deleted. do you wish to continue?"
how can i do that? how can i check whether records are already existing using javascript?
sam
Samd,
Why not put a computation in the Page Rendering phase which will determine whether or not any records exist. Then, you can use a simple JavaScript confirm() to determine whether or not to submit the page, and thus delete the records.
An example of this can be found here: http://apex.oracle.com/pls/otn/f?p=28534:1
The source for the JavaScript is as follows:
function deleteRows()
if (document.getElementById('P1_NUMBER_OF_ROWS').value == 0)
{doSubmit('DELETE');}
else
{alert('There are child records and this delete operation cannot proceed.');}
}There is also a computation for P1_NUMBER_OF_ROWS which will return the number of rows for a specific table/view. If it returns 0, then the process mapped to the "DELETE" button will fire; otherwise, the JavaScript will display an alert with the appropriate message.
One note - always enforce this type of logic at the data model level. Should the JavaScript fail or not fire correctly, you need to ensure that the referential integrity of your data remains in tact.
Thanks,
- Scott -
Similar Messages
-
Dynamic PL/SQL for Deletion of Records
Dear all,
I am using Dynamic PL/SQL for Deletion of Records,In that PL/SQL, i have to get the no.of records deleted and send a report with the no.of rows deleted.
Please help me on this..
Thanks,
MurugesanHi,
Try this:
SQL> SELECT * FROM T;
DT CODE
14-FEB-07 1
14-FEB-07 1
14-FEB-07 1
14-FEB-07 2
14-FEB-07 2
SQL>
SQL> ed
Wrote file afiedt.buf
1 BEGIN
2 EXECUTE IMMEDIATE ' DELETE FROM T WHERE CODE = 1';
3 DBMS_OUTPUT.PUT_LINE(' Total Deleted Rows :'||SQL%ROWCOUNT);
4* END;
SQL> /
Total Deleted Rows :3
PL/SQL procedure successfully completed.
SQL> Regards
Avinash -
Is their any function module for deleting condition record i am trying
Hi Experts,
Is their any function module for deleting condition record i am trying this way.......
DATA: TABLE (4) TYPE C.
DATA: KNUM LIKE KONH-KNUMH
DATA: K_VEWE LIKE T681-KVEWE VALUE 'A'.
DATA: T681_STR LIKE T681.
DATA: LV_NUM TYPE I.
GET PARAMETERS
PARAMETERS: TABNO LIKE T681-KOTABNR.
PARAMETERS: TESTMODE DEFAULT 'X' AS CHECKBOX.
REFRESH INT_KNUMH.
Select single * from T681 into T681_STR
where kvewe = K_VEWE AND
KOTABNR = TABNO.
IF SY-SUBRC NE 0.
WRITE: / 'No entry in T681 for number ', TABNO.
WRITE: / 'Check whether corresponding condition table exists.'.
EXIT.
ENDIF.
TABLE = T681_STR-KOTAB.
SELECT KNUMH FROM (TABLE) INTO KNUM.
SELECT SINGLE * FROM KONH WHERE KNUMH = KNUM.
IF SY-SUBRC NE 0.
INT_KNUMH-KNUMH = KNUM.
COLLECT INT_KNUMH.
ENDIF.
ENDSELECT.
DESCRIBE TABLE INT_KNUMH LINES LV_NUM.
IF LV_NUM EQ 0.
WRITE: / 'No inconsistent entries found.'.
WRITE: / 'Each record in the condition table has a corresponding.'.
WRITE: / 'entry in the KONH table.'.
EXIT.
ENDIF.
LOOP AT INT_KNUMH.
IF TESTMODE IS INITIAL.
DELETE FROM (TABLE) WHERE
KNUMH = INT_KNUMH-KNUMH.
IF SY-SUBRC = 0.
WRITE: / 'KNUMH =', INT_KNUMH-KNUMH(10), ' deleted from table ' ,TABLE.
ELSE.
WRITE: / 'DELETE: SY-SUBRC is', SY-SUBRC , ' FOR KNUMH = ' .
WRITE: INT_KNUMH-KNUMH(10).
ENDIF.
ELSE.
WRITE: / 'TESTRUN: KNUMH =', INT_KNUMH-KNUMH(10).
ENDIF.
ENDLOOP.
is their any Standerd Function module for comparing tables if the condition record not exist in it has to exit if it is their then compare those two tables if not exist in one table also that has to be delete the condition record
Please let me know .....Hi,
You can use Function module PRICING_CHECK to check condition record. Do a where-used list on it to see how to call it.
Regards
Kiran Sure -
Customized delta data source for deleting data record in the source system.
Hello Gurus,
there is a customized delta data source, how to implement delta function for deleting data record in the source system?
I mean if there is record deleted in the source sytem, how to notify SAP BW system for this deleting change by this customized delta
data source?
Many thanks.Hi,
when ever record deleted we need to write the code to insert the record in Z table load this records into BW in a cube with similar structure.while loading into this cube multiply the Keyfigure by -1.
add this cube in the Multi Provider.The union of the records in the orginal cube and the cube having deleted records will result in zero vale and will not be displayed in report .
Regards, -
ODI package - how to watch for delete of records in a table
Hello,
Using ODI package, I am using ODIWaitForData on a table. This works for Inserts/Update, but what do I need to do in a package to do Change Data Capture for Delete?
Thank you.If your data store is in CDC and you are setting the property named Journalized data only at the interface level then you can set the IKM property named synchronous_jrn_delete . It will take care of the delete operation .
-
Creating a Trigger for Deleting the records from a parent Table
I am new to creating Trigger
We will need several small tables that will be used to store any records that are deleted by the owner of the table. These will likely need a trigger where we would Delete from the parent table and on that Delete populate the child table with the previous record's data.
Please give me a pseudo code for this
Thanks
John
Edited by: user10750995 on Dec 30, 2008 9:06 AMSomething like this:
CREATE OR REPLACE TRIGGER trg_my_table_hist
AFTER DELETE
ON my_table
FOR EACH ROW
BEGIN
INSERT INTO Hist_MyTable
( column1, column2, ..., DELETION_DATE)
VALUES
(:OLD.column1, :OLD.column2, ...., SYSDATE);
END;
/My_Table is your main table. When a row is deleted, the trigger will be fired and copy the deleted row to another table called Hist_My_Table. I'm supposing that the history table has all columns as they are defined in main tables plus a column named DELETION_DATE.
My experience indicates that, probably, it's a good idea maintain update history and the user. But it depends on your requests.
Regards,
Miguel -
How to create BDC for Deletion of Records in Table Control in BDC for PFCG
I have transcation PFCG and have to go to roles of users there.We will upload the users who has to be deleted and it should delete it from the PFCG in one go .Howcan I create a program to delete from the table .If i delete directly from DB table it doesnt show in SAP log how or Who deleted it and the client wants this log which is needed for accountability.
Pls HELP.
GeorgeHi
You can only indicate the user and all profiles of the user will be deleted.
DATA: BEGIN OF T_DEL_USR OCCURS 0,
USERNAME LIKE BAPIBNAME-BAPIBNAME,
END OF T_DEL_USR.
DATA T_RESULT TYPE STANDARD TABLE OF BAPIRET2
WITH HEADER LINE.
After loading the users to be deleted:
LOOP AT T_DEL_USR.
CALL FUNCTION 'SUSR_BAPI_USER_PROFILES_DELETE'
EXPORTING
USERNAME = T_DEL_USR-USERNAME
TABLES
RETURN = T_RESULT.
ENDLOOP.
I'm not sure but perhaps u have to use bapi for commit too: BAPI_TRANSACTION_COMMIT
Max -
Query for deleting the minimum updated record.
Hello Everybody,
I have table USER_RECENT_PROJECTS which has SIX columns USER_NAME,PROJECT_ID,CREATED_BY,CREATED_ON,UPDATED_BY
and UPDATED_ON.The purpose of having this table to get 5 recent PROJECTS
on which user has worked on.
I have trigger called RECENT_PRJ_TRIGG which IS FIRED when the data is inserted or updated on PROJECT table.After this trigger calls procedure PROC_USER_RECENT_PRJ and that procedure puts the data in this table.
It is inserting the data upto 5 records when the six records comes it deleting the record which is least UPDATED_ON from the table USER_RECENT_PROJECTS but the problem is it is deleting
the record from other user that i don't want.I want to delete the the record which is
least UPDATED_ON from particular user.
Please help me on this issue.
Here is the trigger
CREATE TRIGGER RECENT_PRJ_TRIGG
AFTER INSERT OR UPDATE ON PROJECT
FOR EACH ROW
DECLARE
NUMBER_OF_PROJECTS NUMBER:=0;
EXISTING_PROJECT_ID NUMBER:=0;
BEGIN
SELECT COUNT(*) INTO NUMBER_OF_PROJECTS FROM USER_RECENT_PROJECTS WHERE USER_NAME=:NEW.UPDATED_BY;
SELECT PROJECT_ID INTO EXISTING_PROJECT_ID FROM USER_RECENT_PROJECTS WHERE PROJECT_ID=:NEW.PROJECT_ID AND USER_NAME=:NEW.UPDATED_BY;
NVLX.PROC_USER_RECENT_PRJ(NUMBER_OF_PROJECTS,:NEW.PROJECT_ID,EXISTING_PROJECT_ID,:NEW.UPDATED_BY,:NEW.CREATED_BY,:NEW.CREATED_ON);
EXCEPTION
WHEN NO_DATA_FOUND THEN
NVLX.PROC_USER_RECENT_PRJ(NUMBER_OF_PROJECTS,:NEW.PROJECT_ID,0,:NEW.UPDATED_BY,:NEW.CREATED_BY,:NEW.CREATED_ON);
END;
And this is the procedure which is inserting the data
CREATE OR REPLACE PROCEDURE PROC_USER_RECENT_PRJ (
NUMBER_OF_PROJECTS IN NUMBER,
NEW_PROJECT_ID IN PROJECT.PROJECT_ID%TYPE,
EXISTING_PROJECT_ID IN USER_RECENT_PROJECTS.PROJECT_ID%TYPE,
USER_NAME IN CONTENT_USER.USER_NAME%TYPE,
CREATED_BY IN PROJECT.CREATED_BY%TYPE,
CREATED_ON IN PROJECT.CREATED_ON%TYPE)
IS
MAX_RECENT_PROJECTS NUMBER := 5;
BEGIN
IF NUMBER_OF_PROJECTS<=MAX_RECENT_PROJECTS AND EXISTING_PROJECT_ID=NEW_PROJECT_ID THEN
UPDATE USER_RECENT_PROJECTS SET USER_RECENT_PROJECTS.UPDATED_ON=SYSDATE,USER_RECENT_PROJECTS.UPDATED_BY=USER_NAME WHERE PROJECT_ID=EXISTING_PROJECT_ID
AND USER_RECENT_PROJECTS.USER_NAME=USER_NAME;
ELSE IF NUMBER_OF_PROJECTS<MAX_RECENT_PROJECTS AND EXISTING_PROJECT_ID!= NEW_PROJECT_ID THEN
INSERT INTO USER_RECENT_PROJECTS VALUES (USER_NAME,NEW_PROJECT_ID,CREATED_BY,CREATED_ON,USER_NAME,SYSDATE);
ELSE IF NUMBER_OF_PROJECTS=MAX_RECENT_PROJECTS AND EXISTING_PROJECT_ID!= NEW_PROJECT_ID THEN
DELETE FROM USER_RECENT_PROJECTS WHERE USER_RECENT_PROJECTS.PROJECT_ID IN(
SELECT PROJECT_ID FROM USER_RECENT_PROJECTS
WHERE UPDATED_ON=(SELECT MIN(UPDATED_ON) FROM USER_RECENT_PROJECTS
WHERE USER_RECENT_PROJECTS.USER_NAME=USER_NAME));
INSERT INTO USER_RECENT_PROJECTS VALUES (USER_NAME,NEW_PROJECT_ID,CREATED_BY,CREATED_ON,USER_NAME,SYSDATE);
END IF;
END IF;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NVLX.PROC_USER_RECENT_PRJ(NUMBER_OF_PROJECTS,NEW_PROJECT_ID,0,USER_NAME,CREATED_BY,CREATED_ON);
END PROC_USER_RECENT_PRJ;
Please help me on this issue.
Thanks in advance.....Thanks for your suggestion....
I am using the trigger for populating the data in USER_RECENT_PROJECTS.This
trigger is fired when data is INSERTED or UPDATED in PROJECT table.And that trigger will call the procedure PROC_USER_RECENT_PRJ.This is used
to put data in USER_RECENT_PROJECTS table.I am getting the problem in procedure the problem is upto five records it is inserting the record when i go for insert sixth record it should delete least UPDATED_ON and insert new record.But it is deleting the record from other user that i don't want.I want to delete the record from the paarticular user.I am using this query for deleting the record..
DELETE FROM USER_RECENT_PROJECTS WHERE USER_RECENT_PROJECTS.PROJECT_ID=(
SELECT PROJECT_ID FROM USER_RECENT_PROJECTS
WHERE UPDATED_ON=(SELECT MIN(UPDATED_ON) FROM USER_RECENT_PROJECTS WHERE USER_RECENT_PROJECTS.USER_NAME=USER_NAME)
AND USER_RECENT_PROJECTS.USER_NAME=USER_NAME
) AND USER_RECENT_PROJECTS.USER_NAME=USER_NAME;
when i fire this query individually it is deleting the proper record,but when i use it
inside procedure it is creating the problem it is deleting the record from other user.
Please suggest me other query for deletion.
Thanks in advance....... -
To delete duplicate records from internal table
hi friends,
i have to delete records from internal table based on following criterion.
total fields are 7.
out of which if 4 fields are same and 5th field is different,then both records must be deleted.
in case all five fields are same,the program should do nothing.
for example.
if there are 3 records as follows
a1 b1 c1 d1 e1 f g
a1 b1 c1 d1 e2 w r
a1 b1 c1 d1 e1 j l
then first two records should be deleted as four fields are same but fifth(e) field differs.
but third record should remain as it is evenif first five fields are same for first and third record.
values of last two fields need not to be consider for deleting the records.LOOP AT ITAB.
V_FILED5 = ITAB-F5. "to compare later
V_TABIX = SY-TABIX. "used to delete if condition not matches
READ TABLE ITAB WITH KEY F1 = ITAB-F1
F2 = ITAB-F2
F3 = ITAB-F3
F4 = ITAB-F4.
IF SY-SUBRC = 0.
IF ITAB-F5 <> V_FIELD5.
*--both the records to be deleted,as Field5 is different.
DELETE ITAB INDEX SY-TABIX. "deletes that record
DELETE ITAB INDEX V_TABIX. "deletes the current record
ENDIF.
ENDIF.
ENDLOOP.
Message was edited by: Srikanth Kidambi
added comments
Message was edited by: Srikanth Kidambi -
DELETING THE RECORDS IN THE FORM
Dear Friends
I have a problem for deleting the records in my form
on the form I have button for deleting the record
and this button has
when-button-pressed trigger
And it has this contains
Do_Key('DELETE_RECORD');
COMMIT_FORM;
The system displayed this message after pressing the delete button
FRM-40400 : transaction complete: 1 record applied and saved
But when I inquiry, about this record it is not deleted .
Can any one tell me why the record is not deleted .
I am using this version of form
Forms [32 Bit] Version 6.0.8.11.3 (Production)
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining
waiting for your valuable replay.
Best regards
JamilDear Pavel
Yes the ON-DELETE trigger , it is exists in the block ,and because of that, it was not saving the deleted record and this code was in the
on-delete trigger
DECLARE
V_LOC VARCHAR(25);
BEGIN
SELECT CAR_NO INTO V_LOC
FROM CAR_FILE
WHERE CAR_NO = :J_CAR_NO ;
IF V_LOC IS NOT NULL THEN
UPDATE CAR_FILE
SET CAR_STATUS =2
WHERE CAR_NO = :J_CAR_NO;
ELSE
NULL;
END IF;
END ;
Why it is not working with ON-DELETE TRIGGER
But it is working with POST-DELETE TRIGGER.
Best regards
jamil -
Alert Button for delete record ASP
Hello I have a delete record and have added a javascript
alert box. I have 2 options. The first is OK and the second is to
cancel. The problem is that I having trouble with the cancel part.
It deletes the record regardless. I tried to pass information such
as if they click cancel <% TH_Proceed = "" %> and in the
delete Dreamweaver code put an if statement to see if the
TH_Proceed <> "" to proceed.
It seems like once it is clicked the information from the
form to delete is passed and it forgets about what I try to send.
Sorry I am not to experienced with this.
Thanks for any help<form, not </form
onSubmit = "return confirm_entry()"
If you don't return anything from the function call, the
submit will of
course go through since that's the default behavior.
The function itself must be altered, too. After your alert
saying the file
will be deleted, return true. After your alert saying the
file will not be
deleted, return false.
"Pixel Pusher" <[email protected]> wrote in
message
news:e8k38f$mtt$[email protected]..
> Thank you. But still not completely understanding. I
have details. Thank
> you
> again for the help.
>
> This is the form tag:
>
> </form id="frm_delete" name="frm_delete"
method="POST"
> onSubmit="confirm_entry()"
action="<%=MM_editAction%>">
>
> This is the submit button:
> <input type="submit" name="Submit" value="Delete This
File!" />
>
> This is the JavaScript:
>
> <script language="JavaScript">
> <!--
> function confirm_entry()
> {
> input_box=confirm("Click OK or Cancel to Continue");
> if (input_box==true)
>
> {
> // Output when OK is clicked
> alert ("The File Will be deleted");
> }
>
> else
> {
> // Output when Cancel is clicked Option
>
> alert ("The File Has Not Been Deleted");
> }
>
> }
> -->
> </script>
> -
Info records flagged for deletion don't update purchase orders
Hi, I would like to know how I can customize SAP-MM in order to avoid that the info records flagged for deletion update the purchase orders.
When I create a PO from a Purchase requisition (which have data with texts like "Vendor material number"), the Info record flagged for deletion update this data.
Thank youHello
I think inforecords flagged for deletion is not being considered for PO updation. Could you please check again.
It might be posible that 'Vendor material number' is spcified in Purchase requisition and when you create PO from Purchase requisition, it is copied from there to PO.
I hope it will resolve your issue.
Best regards
Avinash -
Writing a store procedure for deleting records
how can i write a store procedure for deleting records from a table.
i have a table called employees
empid
empname
deptid
and table department
deptid
dept
floor
how can i write a store procedure which would delete records of employees from employees table for particular department when i delete that department from department table.
thanks872959 wrote:
how can i write a store procedure for deleting records from a table.
i have a table called employees
empid
empname
deptid
and table department
deptid
dept
floor
how can i write a store procedure which would delete records of employees from employees table for particular department when i delete that department from department table.
thanksDoes not seem to be a sound design, to me.
Employees do not go missing when organization change is made & department is eliminated.
If you insist such nonsense, write TRIGGER to issue desired DML -
Purchasing info record 5300000013 flagged for deletion
Hi,
While changing the Purchasing info record , we get the following message:
Purchasing info record 5300000013 flagged for deletion as a warning
We want to convert this message as error. For that we changed the System message category, purchasing as "E" in Materials Management-> Purchasing-> Environment Data-> Define Attributes of System Messages, but after that also the System gives a warning message in T Code ME12.
Where do I need to change to get the error message? As per understanding, the system should always warning message so that we can change the deletion flag, if required in future.
Please guide.
Regards,
PKhi,
Try to understand the importance of the message. PIR document is not must to make or create any PO...
but in case if req. or for copying few parameters from old/latest PIR, we use it...
Its always better to have the PIR for the PO, which may be made before or after the generation PO...as it stores the PO price history, conditions etc...which may get updated and pulled whenever required...
So, due to such reasons system has made this message as warning message...because you can use it just for record maintainance, but it will be of no use if thinking practically...
Normally we make these settings at SPRO >> IMG>>MM Purchasing>>Environment data>> Define attributes of system messages...
Regards
Priyanka.P -
Purchasing Info Record marked for deletion
Hi experts,
I need some explanation on Purchasing Info Records and more precisely on the deleted ones.
Could you tell me why a Purch. Info Record that is marked for deletion is still set when a PO is created?
In ME13 I have the following warning message : 06-718 (Purchasing info record & & & & flagged for deletion).
In ME21N the same message is displayed as warning and users are able to save the PO with the deleted Info Record.
I don't understand why SAP still retrieves Info Records that are marked for deletion...
Is there a way to prevent SAP from using deleted info records?
Thank you for your help.
Regards,
PhilippeHi Philippe,
The message 06718 can be set as an error or warning in customising.
If message 06718 is set as error then system will not allow to save
the document with that info record.
The deletion indicator is the reservation to delete this record. But
this is not comparable with the deletion of the record from the database
This has to be done within the archiving run for the object MM_EINA.
Untill this inforecord is not archived the data is taken as usual."
Online documentation provides the following information
"You cannot delete obsolete info records immediately. You can
only flag them for subsequent deletion. Info records earmarked for
deletion in this way are not actually deleted until the archiving
program is run. This is done at regular intervals by your system
administrator. You can flag an individual info record for deletion,
or create a list of deletion proposals and choose the relevant records
that are to be deleted from this list."
Kind regards,
Lorraine
Maybe you are looking for
-
Table of contents links won'T work in reader
Hi all, Im using Adobe Reader XI 11. and I noticed that in my pdf file, table of contents links wonT work in reader I browsed the internet and saw that I need to turn off reading in PDF/A mode. but that doesnt work either. Any help would be appreciat
-
How I can fix this???
When I shake the The New iPad, I hear rattling in the camera!
-
To find whether current user has SAP_ALL profile or not.
Hi all, Can anyone tell me that whether is there any method by which I can pass the user id and can know whether that user has the SAP_ALL profile or not. The above is done by using the transaction SU01,but I need the ABAP code that is being used in
-
Can't get past set up assistant welcome screen on new MacBook Pro
Just finished charging up my brand new out of the box MacBook. I've toured the voice over and I've selected US. Any action I take except to go back over Voice Over, which I don't care about or want to use, gets me the usual error noise. HELP!
-
Hi All, In our application, we have our own version of "org.apache.myfaces.trinidad.model.XMLMenuModel" and we override "setWrappedData()". But when we try to loop through the "treeModel" object's wrappedData or children and try to cast them to "org.