How to write a job
The functionality of job to delete data for every one week or whenever it count reaches greater than 10,000 and how should we configure it
Edited by: 812809 on Feb 24, 2011 3:30 AM
hi there
here in this procedure checks the data if the numbers of rows is greater than or equal to 10,000 then it will delete
the table and also check on daily basis
i am checking on the daily basis because if in the 6th day if data reaches more that 10000 then it should delete it
create or replace procedure delete_date_jobs
V_COUNT NUMBER := 0;
V_DATE DATE := TO_DATE ('02/FEB/2011');
BEGIN
SELECT COUNT (1) INTO V_COUNT FROM EMP;
DBMS_OUTPUT.put_line (v_date);
IF V_COUNT >= 10000
THEN
DELETE FROM HITESH;
ELSIF MOD (SYSDATE - V_DATE, 7) = 0
THEN
DELETE FROM HITESH;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
END delete_date_jobs;after that create a job which runs on daily basis
BEGIN
SYS.DBMS_JOB.REMOVE(277);
COMMIT;
END;
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'begin delete_date_jobs exception when no_data_found then null; end;'
,next_date => to_date('24/02/2011 18:05:07','dd/mm/yyyy hh24:mi:ss')
,interval => 'SYSDATE+1'
,no_parse => FALSE
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
COMMIT;
END;
/regards
Hitesh
Edited by: Hitesh Nirkhey on Feb 24, 2011 6:50 PM
Similar Messages
-
Hello. I want to write certain information in a background job log of my ABAP. Because the job last several hours, I need to inform the user the step the job is in.
Does anyone know how to do that?
TIAThis is weird. With your solution the Job log registers an event without description.
Example:
11.03.2006 23:09:06 Job started
11.03.2006 23:09:06 Step 001 started (program XXXX, variant &0000000000000, user name xxxx)
11.03.2006 23:09:06
11.03.2006 23:09:10
11.03.2006 23:09:13
11.03.2006 23:09:16
11.03.2006 23:09:16
11.03.2006 23:09:16
11.03.2006 23:09:18
11.03.2006 23:09:18 -
How to write a job parameter?
hi all:
at OEM I create a job,
there are some information about job:
type is process,
then
at parameter table:
owb_rt loc_wf process flow1 system parameter cust parameter
I do not know what is system parameter and cust parameter?
my workflow have a input parameter is : "2004-05-26"
please help thanks!cust parameter is constant,how to setup cust parameter to variable?
-
How to write log information into SM37 batch job log
Hi,
I have a report running in batch mode, and I would like to log the start time and end time for some part of the code (different Function modules). I need to write this log information into the batch job log. Therefore I can check the time frame of my FMs.
After search the SDN, I can only get some information on how to write log into the application log displayed in SLG1, but that's not I want. I want to write batch log information, and check it in SM37.
If you have some solution or code to share, please. Thanks a lot.
Best Regards,
BenHi Nitin
Thanks for the reply. Could you explain it with some code ?
I tried to use the write statement , but it did not wrok. I could not see the result in SM37.
write : "start of the FM1 processing".
FM1 code
write : "end of the FM1 processing".
but those two statement did not show in SM37..
1) how to use a information message ?
2) how to use NEW PAGE PRINT ON and PRINT OFF command. ?
I would appreciate if you can write some code ,that I can use directly.
Thanks a lot.
Best Regards,
Ben -
How to schedule a job in another system.
Hi,
Now i have an ABAP program, which run in system ABC, client 001. i want to schedule a job in the program, with the function modules JOB_OPEN, JOB_SUBMIT, and JOB_CLOSE. But this job should run in ABC/002.
How to write code?
Who can help me on the requirement, or provide me another new solution except event trigger?
Thanks & Best Regards,
JohnneyHere is the code. It works fine..
FUNCTION Z_F_TRIGGER_REPORT.
""Local Interface:
*" IMPORTING
*" VALUE(I_PROG) TYPE D010SINF-PROG
*" VALUE(I_VARIANT) TYPE VARIS-VARIANT
*" VALUE(I_MODE) TYPE CHAR01
*" EXPORTING
*" VALUE(E_SUBRC) TYPE SYST-SUBRC
*" VALUE(E_MSG) TYPE CHAR80
Functio ID : Z_F_TRIGGER_REPORT
TITLE : Report Trigger Tool
Create Date: 15.03.2004
Author : Denis Vieira
Ownership : For the exclusive use of the Procter & Gamble Company
Description:
The purpose of this function module is to trigger programs
requested remotely.
AUTHORIZATION CHECKS
OBJECT AUTHORITY FIELDS ABAP FIELDS
| |
CHANGE HISTORY *
DATE | Name | Description | Reference *
29.Jun.2006 | BA4513 | Unicode conversion and upgrade | SPK290606
| | to My SAP ERP |
**eject.
Check if selected program exists in the destination file
SELECT SINGLE SUBC
FROM D010SINF
INTO D010SINF-SUBC
WHERE PROG EQ I_PROG
AND R3STATE EQ C_A.
IF SY-SUBRC NE C_0.
MOVE C_2 TO E_SUBRC.
MOVE 'Report does not exist in destination system'(M01) TO E_MSG.
EXIT.
ENDIF.
Check if program request is an executable program
IF D010SINF-SUBC NE C_1.
MOVE C_2 TO E_SUBRC.
MOVE 'Report is not an executable program'(M02) TO E_MSG.
EXIT.
ENDIF.
Check if selected variant exists in the destination file
SELECT COUNT( * )
FROM VARIS
INTO W_COUNT
WHERE REPORT EQ I_PROG
AND VARIANT EQ I_VARIANT
AND DYNNR EQ C_1000.
IF W_COUNT EQ C_0.
MOVE C_2 TO E_SUBRC.
MOVE 'Variant does not exist in destination system'(M03) TO E_MSG.
EXIT.
ENDIF.
IF I_MODE EQ C_B.
PERFORM 0100_BACKGROUND USING I_PROG I_VARIANT
CHANGING E_MSG E_SUBRC.
ELSE.
PERFORM 0200_FOREGROUND USING I_PROG I_VARIANT
CHANGING E_MSG E_SUBRC.
ENDIF.
ENDFUNCTION.
*eject
*& Form 0100_background
Executes Selected program in BackGround Mode VIA JOB
*Block commented from here SPK290606
*FORM 0100_BACKGROUND USING L_PROG L_VARIANT
CHANGING L_MSG L_SUBRC.
*Block commented till here SPK290606
*Block added from here SPK290606
FORM 0100_BACKGROUND USING L_PROG LIKE D010SINF-PROG
L_VARIANT LIKE VARIS-VARIANT
CHANGING L_MSG TYPE CHAR80
L_SUBRC TYPE SYST-SUBRC.
*Block added till here SPK290606
CONCATENATE C_AREA
C_UND
L_PROG
C_UND
SY-DATUM
C_UND
SY-UZEIT
INTO W_JOBNAME.
Create a JOB and Get the Number for further execution
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = W_JOBNAME
IMPORTING
JOBCOUNT = W_JOBCOUNT.
IF SY-SUBRC NE C_0.
MOVE C_2 TO L_SUBRC.
MOVE 'Error opening job'(M07) TO L_MSG.
EXIT.
ENDIF.
Submit program
SUBMIT (L_PROG)
USING SELECTION-SET L_VARIANT
VIA JOB W_JOBNAME NUMBER W_JOBCOUNT
AND RETURN.
IF SY-SUBRC NE C_0.
MOVE C_2 TO L_SUBRC.
MOVE 'Error Submitting Job'(M06) TO L_MSG.
EXIT.
ENDIF.
Closes job to start its processing
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = W_JOBCOUNT
JOBNAME = W_JOBNAME
STRTIMMED = 'X'.
IF SY-SUBRC NE C_0.
MOVE C_2 TO L_SUBRC.
MOVE 'Error closing job'(M08) TO L_MSG.
EXIT.
ENDIF.
MOVE C_0 TO L_SUBRC.
MOVE 'Program Submitted in Background Mode'(M09) TO L_MSG.
ENDFORM.
*eject
*& Form 0200_foreground
Executes Selected program in ForeGround Mode VIA Submit
*Block commented from here SPK290606
*FORM 0200_FOREGROUND USING L_PROG L_VARIANT
CHANGING L_MSG L_SUBRC.
*Block commented till here SPK290606
*Block added from here SPK290606
FORM 0200_FOREGROUND USING L_PROG LIKE D010SINF-PROG
L_VARIANT LIKE VARIS-VARIANT
CHANGING L_MSG TYPE CHAR80
L_SUBRC TYPE SYST-SUBRC.
*Block added till here SPK290606
SUBMIT (L_PROG) USING SELECTION-SET L_VARIANT
EXPORTING LIST TO MEMORY AND RETURN.
IF SY-SUBRC EQ C_0.
MOVE C_0 TO L_SUBRC.
MOVE 'Report submitted successfully'(M04) TO L_MSG.
ELSE.
MOVE C_2 TO L_SUBRC.
MOVE 'Error submitting report'(M05) TO L_MSG.
ENDIF.
ENDFORM. -
How to schedule a job in portal ?
Hi,
How can we schedule job in portal just like we have in SAP ?
thanks,
BHi Mayank,
Thank you for the response.
I followed your points and in schedular task wizard, I selected Eclipse project instead of Generation directory. Here I gave a simple webdynpro project. (with the intention of writing my code in it) But I face foll problems.
When I deployed this webdynpro project, I am not able to see it in the portal scheduler tasks. how should I locate it ?
I should select Generation directory or Eclipse project ? if generation directory, which directory should I give ?
Where should I write the code ?
thanks,
B -
Can anyone share with me how you write Javadoc?
Can anyone share with me how their companies write Javadoc?
Are your developers solely responsible for it? Do your technical writers own it or review it? How do you make sure it's good?
Right now, my software developers are mostly responsible for writing all the API info and it's of poor quality and really lacking details. I don't mean spelling/grammar-type problems. My developers just don't seem to "get" what information to include, no matter how many guidelines or checklists I give them.
A very simple example is:
* Gets the status
public java.lang.Integer getStatus() {...}With no indication of what status values may be returned and what the values might mean.
How do you ensure that what you write is actually useful? Please help!
I'm aware of the method Sun recommends, but I want to know what others do.
Thank youHi,
Well, concerning the question what a good API documentation should be. Just imagine, you are a programmer and you want to use that API. You need to know how it works. There can be only three ways to find it:
(1) The API documentation
(2) Probing experiments. Even a good documentation may not describe everything. Sometimes, the only way to understand certain things you particularly need may be guessing something, writing a code basing on it and see how it works. Then, guessing something again, more precisely now, and so on. Even a very good documented API (for instance, javax.swing) may require that sort of approach to be able to use it eventually.
(3) At last, when source codes are available, one may look at them and try to understand precisely, what a particular method actually does.
I think the better the API documentation the less one may need to endeavor those two last steps. There is actually a limit about it. Without any proper explanation at all, one may never be able to use a particular API, neither after probing it nor after looking at source codes (that is not to say the sources may be simple unavailable at all).
Concerning how to write the API documentation, that's mostly the question of managing your team. I think, basically, the original source of the ultimate information about everything implemented in the projects are those very programmers (developers) and, probably, some software architects. But those guys normally are not especially eager to write any documentation (especially developers). That your example just demonstrates it. It seems, your programmers just wrote that "Gets the status" for you to make them leave in rest after that. In addition, the programmers normally have such a sort of work and activity that does not match particularly well with the writing literature and doing their main job simultaneously. You should not enforce them to do that!
To write a good documentation, you will need to engage a technical writer. That's normally a guy with some programming background. However, writing some literature is actually what he does the best. (Sometimes, such people do something else about written word beyond the technical writing.) The job of that guy would be to write the documentation. This will take from him (or her) two basic things:
(1) The ability to understand the whole software system (that's where his programming background will be needed!);
(2) To communicate with the programmers who have developed the stuff and to obtain from them all the necessary information they know. That may require some personal (verbal) communication with them, because asking them to write everything again will only result in the same "Gets the status" explanations. However, to be successful in this, the technical writer needs to have some explicit management approval behind him. Otherwise, some of the guys will avoid speaking to him at all (saying they lack the time). So, the management should assign them the necessary priority for such communications.
Particularly big projects may even need to have the whole team of technical writers.
Anyway, writing docs is a hard work. But it is extremely important! The good documentation may both increase your sales and eliminate lots of expense on further support of your customers.
Regards,
Leonid Rudy
http://www.docflex.com -
How to write the oracle data as XML format. (.XML file)
create or replace procedure pro(p_number )
is
cursor c1 is select *from emp where empno=p_number;
v_file utl_file.file_type;
begin
v_file := utl_file.fopen('dirc','filename.txt','w');
for i in c1 loop
utl_file.put_line(v_file,i.ename || i.empno ||i.job);
end loop;
closef(v_file);
end;
Now my client want instead of .txt file he need .xml files
File should contains xml tags. can any one help regarding this.. with one example.
How to write the oracle data as XML format. (.XML file)hi,
hope this example will do something....
SQL> select employee_id, first_name, last_name, phone_number
2 from employees where rownum < 6
EMPLOYEE_ID FIRST_NAME LAST_NAME PHONE_NUMBER
100 Steven King 515.123.4567
101 Neena Kochhar 515.123.4568
102 Lex De Haan 515.123.4569
103 Alexander Hunold 590.423.4567
104 Bruce Ernst 590.423.4568
SQL> select dbms_xmlgen.getxml('select employee_id, first_name,
2 last_name, phone_number from employees where rownum < 6') xml
3 from dual;
*<?xml version="1.0"?>*
*<ROWSET>*
*<ROW>*
*<EMPLOYEE_ID>100</EMPLOYEE_ID>*
*<FIRST_NAME>Steven</FIRST_NAME>*
*<LAST_NAME>King</LAST_NAME>*
*<PHONE_NUMBER>515.123.4567</PHONE_NUMBER>*
*</ROW>*
*<ROW>*
*<EMPLOYEE_ID>101</EMPLOYEE_ID>*
*<FIRST_NAME>Neena</FIRST_NAME>*
*<LAST_NAME>Kochhar</LAST_NAME>*
*<PHONE_NUMBER>515.123.4568</PHONE_NUMBER>*
*</ROW>*
*<ROW>*
*<EMPLOYEE_ID>102</EMPLOYEE_ID>*
*<FIRST_NAME>Lex</FIRST_NAME>*
*<LAST_NAME>De Haan</LAST_NAME>*
*<PHONE_NUMBER>515.123.4569</PHONE_NUMBER>*
*</ROW>*
*<ROW>*
*<EMPLOYEE_ID>103</EMPLOYEE_ID>*
*<FIRST_NAME>Alexander</FIRST_NAME>*
*<LAST_NAME>Hunold</LAST_NAME>*
*<PHONE_NUMBER>590.423.4567</PHONE_NUMBER>*
*</ROW>*
*<ROW>*
*<EMPLOYEE_ID>104</EMPLOYEE_ID>*
*<FIRST_NAME>Bruce</FIRST_NAME>*
*<LAST_NAME>Ernst</LAST_NAME>*
*<PHONE_NUMBER>590.423.4568</PHONE_NUMBER>*
*</ROW>*
*</ROWSET>*
ask if you want more assistance.
thanks. -
I am new in indesign scripting, please tell me how to write a script to get content of a element in xml and then sort all the content
Hi,
May the below code is useful for you, but I dont know how to sort.
Edit the tag as per your job request.
alert(app.activeDocument.xmlElements[0].contents)
//Second alert
var xe = app.activeDocument.xmlElements[0].evaluateXPathExpression("//marginalnote");
alert(xe.length)
for(i=0; i<xe.length; i++)
alert(xe[i].texts[0].contents)
Regards
Siraj -
How to monitor background jobs automatically
Hello,
How to monitor background jobs automatically
(we have more then 100+ jobs in a month and some jobs are repeating 4 - 5 times in a same day ) Now i am searching any salutation for monitor background jobs automatically
Let me know the options
Thanks,
SureshHi,
If your batch job is creating a file in SAP and sending it to another system. These are some things you could do, if you have tools and resources available.
1) When the job ( SAP program ) runs to create the file, ensure there is no file already existing in the landing zone ( AL11), if it does then do not over write, just throw an error, because the last file created did not leave the landing zone, because the other system or middle were did not pick it up. Usually when the middleware or third party system picks up your file from the landing zone, it may delete the file, so next time fresh file can be picked up. It is always good to have date and time stamp on the file that you create on the landing zone, so we could uniquely track which files were creates, when it was created and transmitted.
2) Lets say your job created the file in the landing zone, the FTP program or what ever service or tool that you use to pick the file, if it is running as per design, then it should pick it up, if not you need to see why it is not running, usually the FTP softwars like GIS will throw an error if no file is found, and we could track them.
I am sure there are many other ways to handle if the file really left the landing zone or not. Something to think about. thanks -
How to write program to list the system directory(content of pc)
how to write a program that will display all the folder n directory of the pc like:
+My Computer
+c:
+d:Copy this line and save it in a file named "dirlist.bat":
for %%* in (%1) do dir /b %2 %1To use it, change to the directory it's in and at the command prompt type
dirlist directory [/s] directory is the name of the directory that you want listed.
/s is optional and will list the contents of all subdirectories also.
(You didn't say it had to be Java - use the right tool for the job) -
How to write a query for the given scenario ?
Hi All ,
I am having two tables EMP, DEPT with the below data.
EMP TABLE :--
EID ENAME JOB SAL DEPID
111 RAM MANAGER 1500 10
222 SAM ASST MANAGER 2000 20
333 KALA CLERK 2500 10
444 BIMA MANAGER 3000 20
555 CHALA MANAGER 3500 30
666 RANI ASST MANAGER 4000 10
777 KAMAL MANAGER 2400 10
DEPT TABLE :--
DEPID DNAME
10 XX
20 YY
30 ZZ
Q1 : I want the sum of salary of each department and for the particular job . Here in each departmant manager, asst. manager, clerk posts are there .
I want to display the result like below ....
JOB 10 20 30
MANAGER 3900 3000 3500
ASST MANAGER 4000 2000 NULL
CLERK 2500 NULL NULL
please tell me how to write a sql query ?
Thanks
SaiIn general case, you cannot write this query.
This is one of the limits of relational database concepts. The number of columns must be known up-front. In the SELECT clause, you have to list and name all columns returned by the query. So you have to know number of departments. (There are some workarounds - you can return one column with concatenated values for all departments, separated by space character).
If you know that you have 3 departments then you qurey will return 4 columns:
SELECT
e.job,
SUM ( CASE WHEN d.deptid = 10 THEN e.sal ELSE NULL END) d10,
SUM ( CASE WHEN d.deptid = 20 THEN e.sal ELSE NULL END) d20,
SUM ( CASE WHEN d.deptid = 30 THEN e.sal ELSE NULL END) d30
FROM dept d, emp e
WHERE d.deptno = e.deptno
GROUP BY e.job -
How to write query to list all the employees of deptno 20
Hi ,
I am new to Oracle...Recently I got job.... Could you please help me....
How to write a query for
1) List all the Clerks of Deptno 20 and
2) List the emps along with their exp and whose daily salary is more than 100rsits not wrong that you ask , but this is basic question and my suggestion is to start reading some manual specially since you got job , Read oracle documentation gogole what you want if you didn't find any answer post here and we will help you .
Check this link
http://www.oracle-dba-online.com/sql/oracle_sql_tutorial.htm
http://www.w3schools.com/sql/default.asp
http://www.java2s.com/Tutorial/Oracle/CatalogOracle.htm
And you will find more & more .. create your own vmware oracle provide with learning database called XE (express edition) test it and hope this information is useful for you -
How to Save Background job report out put in local / Network Drive?
Hello Techies,
How to Save Background job report out put in local / Network Drive.
Actually we have option to send mail aftr complete but i need to save in local drive or network drive .Hi ,
Background job runs in application server , and your local /network drive is basically presentation server. So you cant save it in local /network drive from the job itself. But to download files, you can write the files to the application server using DATASET, in the background and then use the transaction CG3Y in the foreground to download the file. -
How to create a job card and how to add waranty card in sales order
I have one scenario for CS.the scenario is realted to automotive industry. Basically its a trading industry of HCV,MCV,LCV apart from that they will do servicing also. First the customer comes for a service.he is having free services. he will have waranty for spare parts of the vehicle. once he comes for servicing first the executive will take complains from the customer after that a Job card will be issued to the customer. there his chasis no ,engine no and registration no will be there. once enter the chasis no entire customer details has to come. how many free services he is having for how many kilo meters.then job card will go to the spare parts dept.that dept will issue the spare parts.then they will invoice the customer. he will pay the payment.and finally the gate pass will be given to the customer to deliver the vehicle.
painful area is how to create a job card and how to add waranty in sales order.
Regards,
VenkatHi,
Have u resolved it then Please let me know !!! It is a very interesting problem and owuld like to know the solution...
Regards
Krishna
Maybe you are looking for
-
SRM Standalone Java Stack Installation
Hi gurus Please help me as subject itsself describe i am facing the problem in SRM JAVA stack installation I have alredy completed SRm ABAP stck installation now when i am doing the java stack installation its giving me the error WARNING[E] 2010-12-
-
Lightroom 5 freezes when I try to open it.
Lightroom 5 opens in the Develop module, and the last picture I edited is up. Across the pic is a banner that reads "The file could not be found." The spinning pinwheel just keeps spinning and I can't click on anything. I have to force a quit. An
-
Extract User List from Security Manager
Hi, How to extract or export the list of users created in MII under Security Manager to some document like Excel. Regards, Adarsh
-
How to View Transport Log in DEV SAP Portal System
Hi All, Kindly help me by giving me the path of where is the Import, Export and Transport Log maintained in SAP Portal. And is it posible to view the Log of other systems from DEV system? If yes then how. Thanks in Advance. Regards, Disha.
-
I am on 10.7.5 and whenever I share my screen with someone else all they see is a white screen. When I share their screen I see everything fine. What is the problem?