Last Execution Date at source
Hi Guru Sankar
Sometime back i had some requirement to get last update date of target tables .
I had changed the IKM and added the step as per your suggestion
i.e insert into xxsm_audit_table (SESS_NO, SESS_NAME,TARGET_TABLE_NAME, DATE_UPDATED) (SELECT <%=odiRef.getSession("SESS_NO")%>, '<%=odiRef.getSession("SESS_NAME")%>','<%=odiRef.getTargetTable("RES_NAME")%>',sysdate FROM dual)
Now my requirement is similar but this time i want the same at source database and source tables
I am using ODI 10.1.3.5.
I have created a table at source DB.i.e xxsm_odi_audit_table and tried the modified query as below
with the above step but at Command on Source
insert into xxsm_audit_table (SESS_NO, SESS_NAME,TARGET_TABLE_NAME, DATE_UPDATED) (SELECT <%=odiRef.getSession("SESS_NO")%>, '<%=odiRef.getFrom("SESS_NAME")%>','<%=odiRef.getTargetTable("RES_NAME")%>',sysdate FROM dual)
But i am getting error invalid SQL Statement.
My source is having multiple source tables/views/synonyms
can you tell me what i am doing wrong???
regards
Gourisankar
Hi Gourisankar,
If u need to capture SOURCE table list then ur customization should be at LKM level not at IKM level. For capturing source table list in spite of multiple tables (views, synonyms, tables etc) u can do it using a API called getSrcTablesList.
Do the following steps.
Step 1:
Create a new step in ur LKM (LKM SQL To SQL) after Load Data Step.
Step Name: Insert Audit Log
Command On Source:
Technology: Oracle
Logical Schema : <whichever schema points to ur xxsm_audit_table table>
Command:
SELECT '<%=odiRef.getSrcTablesList("", "[RES_NAME]", ", ", "")%>' as SrcTable FROM dual
Command On Target:
Technology : Jython
Command:
import java.sql as sql
import java.lang as lang
#Get the log table connection information by using getJDBCConncetion("SRC")
myCon =odiRef.getJDBCConnection("SRC")
MyStmt=myCon.createStatement()
#Assigning Source Table List to a Jython variable
JSrcTable='#SrcTable'
#Insert into xxsm_audit_table with the source table/tables list
LogInsert= MyStmt.executeQuery("insert into xxsm_audit_table (SESS_NO, SESS_NAME,TARGET_TABLE_NAME, DATE_UPDATED) (SELECT <%=odiRef.getSession("SESS_NO")%>, '<%=odiRef.getSession("SESS_NAME")%>','"@JSrcTable@"',sysdate FROM dual)")
P.S: Replace @ with plus sign the above line.
That's it.
Please note, if u have multiple source table used in ur interface then those will be inserted with comma (,) separated in to audit table.
Also, make sure u need to add this in ALL the LKM wherever u require to capture the source table names.
Let me know how it works.
Thanks,
Guru
Similar Messages
-
Function Module to find the Last Execution date of Back ground Job
Hi,
Is there any function module to find the <b>last execution date of back ground job</b>.
So that I can transfer the data from SAP to Legacy system based on the document creation date should be in between last execution date and current date.
thanks in advance.
Eswar.Don't know of a function module, but you should be able to use the information in table TBTCO to get the last start date and time of the job you are interested in.
-
Last execution date and time of a transaction
Hi,
Could anyone let me know the procedure to find the last execution date and time of a transaction (for example MM01/MM02). We are currently working on ECC6.0
RajaHi Raja,
Check table CDHDR, fetch data against T code MM01/MM02 and get MAX(UDATE) and MAX(UTIME).
You will get last execution date and time.
Please reqward ponits if it useful.
Regards
Krish -
Hi SAP Minds,
How can we find out the last execution date of a report? Is there any F.M available to serve this, or any system tables are there?
Please help me out.
Thanks in advance.Vamsi,
check the below t codes and tables...
Table TRDIR
tcode SM22
ST03N Transaction
try this program RSSTAT20
Definetly u will find the info -
Last Execution Date of a Query
Hi Exparts
Can any one tell me, how to see the execution of the BI Queries ? My problem is I want to check that when did my end user
has last seen the report,This statstics will give me an insight on BI reports usability. Top mangement is interested in this type of statstics
Thanks
ShivaniHi,
Use the standard SAP query USER STATS(Z0TCT_MC01_Q003) built on Multiprovider:0TCT_MC01.
Here you will get a seperate record/row for each and every navigation of report i.e drilldown/remove drill down...etc,also for execution of report as a record/row in the out put.
Hope this helps.
thanks,
rahul -
How to track the Last Execution of a Custom Program
Hi all,
I want to know the last execution date of a Cutom Z program. Kindly tell me as where do we see the same. Is there any table where this is being saved.Hello Nikesh,
EXIT_SAPLS38E_001 is related to the user exits for the ABAP editor (Please read the documentation for details)
EXIT_SAPLSABE_010 is triggered everytime the report is started, i mean before INITIALIZATION (i laymans terms before selection-screen is displayed).
Please have a look @ [How to find First Program run in the Current Month in Foreground?|How to find First Program run in the Current Month in Foreground?]. You can very well implement this methodology as well
BR,
Suhas
Edited by: Suhas Saha on Jan 15, 2010 2:11 PM -
Program execution date record or log
Hi:
We've been requested by Development team, to discover if there is any report or program or log that trace the date and/or time that a program has been executed.
I guess that there is not exactly a report like these, but if anyone can give us an idea of how to get these information, we will apprecciate it.
Thanks a lot, abrahamdelgadovAbraham,
Certain information pertaining to your requirement are available in Table REPOSRC.
Try REPOSRC in SE11.
Other way is
Check the system log. Use the transaction ST03 and click on Performance database (Push button). Hit the target system and select period (you want to analyse ...this is system log and you may not be able to read if the last execution date of the transaction is more than 90 days..not sure how it is configured in your system) and click on "Transaction Profile".
This holds the complete list of Programs / transaction codes executed during last three months. Only painful thing is, we need to browse the list to nail down to the requirement.
Vinodh Balakrishnan -
How to get the last run date.
We intend to develop an incremental data load mapping using this strategy:
1) The mapping reads the date it was last run from an auxiliary table.
2) It selects from the source only those rows that were inserted or updated after said date.
3) Then, a post-mapping process updates the last run date in the auxiliary table, using SYSDATE.
The problem with this logic is that there is a gap: if the mapping starts running at 1:00 and ends at 2:00, the rows that are inserted in between will never be loaded.
Is there any way to get the value when the mapping started running? Is there a better way to do this?
Any help would be appreciated.
Juan AlgabaThere is always the possibility of some record updates slipping through the crack if you are depending on dates unless you are very carefull. All of the audit tasks that the OWB-generate code performes take time. Any pre- or post- process that needs to run takes time. So which date is the best cuttoff point to equate to "when the last run of the merge (or insert or update) statement completed"?
Plus, how do you handle reloads if the previous load failed and your mapping had incremental commits?
Is your source on another server? If so, are the dates in perfect synch? The audit tables populate with sysdate of your runtime schema. Is that the same as the sysdate on your source remote database?
I would qualify my query to look for all updates since the start of the last run that finished successfully - adjusted if neccesary for sysdate differences if it is on a remote schema. And make sure that your code handles any reloads gracefully in the event that this brings back data that you have already loaded once. .
Because we use Oracle Streams to load a local staging area, we also have custom code to dump the primary keys of all data changes to utility staging tables while streams is updating the local copy. So, our Person table has an st_Person_delta table that just holds the primary keys that have been updated by Streams since the last ETL run.
During datamart load we disable the streams apply to stabilize our environment, and join these lists of pk's to their source tables to drive our ETL. So we only select data where Streams has performed an update to the row since our last run. When we are done our ETL, we truncate the primary key staging tables, and then turn streams back on to start loading up our new delta into our staging tables again..
The ETL gets pretty complex though when many tables join together in one mapping and you need to check all possible source table deltas to see if any of them got updated to determine the delta for a given dimension or fact record, but it works great once you get it all done. -
How can we show the last consumption dates?
Hi BEx Gurus,
I have consumption dates and quantites for a material and a time interval in my query.
In the selection screen i specify a time interval. Then i execute query. I can see last consumption quantity due to calculated key figure(enhancement> last quantity due to calendar day(consumption date)).
Up to now eveything is OK. But i want to see also last consumption date. I tried formula variable with key "date", set it to the last . I drag it to the calculated key figure. Put it to the colums. But when i executed i saw that last date is the date that i specified in selection screen. It is not the date that last consumption is exist.
Could you please help me?var letter:Number = Number(new Number(0x2714).toString(10));
trace(String.fromCharCode(letter))
Source : Adobe Website
If you cannot still cannot display it, just change the font family,
simple way is by copying the character into the text field, then change the font family until the character show up correctly, then just input that code i give to u to the script
PS : Just done it -
Need to know how to find the last execution time for a function module
HI all
I need to know
1) How to find out the last execution time of the function module ?
say for eg. I have executed a func. module at 1:39pm. How to retrieve this time (1:39pm)
2) I have created 3 billing document in tcode VF01 i.e 3 billing doucment no. would be created in SAP TABLE "VBRP" b/w 12am to 12:30 am.
How to capture the latest SAP database update b/w time intervals?
3) Suppose I am downloading TXT file using "GUI_DOWNLOAD" and say in 20th record some error has happened. I can capture the error using the exception.
Is it possible to run the program once again from 21st records ? All this will be running in background...
Kindly clarify....
Points will be rewarded
Thanks in advance1.Use tcode STAT input as Tcode of Fm and execute .
2. See the billing documents are created in table VBRk header and there will always be Creation date and time.
VBRk-Erdat "date ., u can check the time field also
So now if u talk the date and time we can filter then display the records in intervals.
3. with an error exeption how is my txt download finished .
once exception is raised there will not be a download .
regards,
vijay -
Program for the last execution of a program or a TC
Hello,
DO you know a program or a TC (Transaction) to edit the date and the hour of the last execution of a program or a TC.
Thank you for the help
Denis CorminboeufHi Denis,
I attached below parts of a program I created a couple of years ago to get use statistics on (customer) reports and transactions.
Maybe you can reuse parts of it for your needs.
Regards
Ferdi
<pre>
internal tables for use counter
data: begin of list occurs 5.
include structure sapwlserv.
data: end of list.
data: begin of applicat occurs 0.
include structure sapwlustcx.
data: end of applicat.
data: begin of applica_ occurs 0.
include structure sapwlustcx.
data: end of applica_.
data: begin of applicau occurs 0,
entry_id like sapwlustcx-entry_id,
account like sapwlustcx-account,
count like sapwlustcx-count,
: end of applicau.
data: wa_applicau like applicau.
*& Form MONI
form moni.
data: l_host like sapwlserv-hostshort.
m_start = p_usedt.
get server
call function 'SAPWL_SERVLIST_GET_LIST'
tables
list = list.
do.
loop at list.
loop on server
check not list-instshort is initial.
l_host = list-instshort.
get statistics per month and server
perform workload using m_start l_host.
endloop.
add 31 to m_start.
if m_start > sy-datum.
exit.
endif.
enddo.
sort applica_ by entry_id.
sort applicau by entry_id count descending.
endform. " MONI
*& Form WORKLOAD
form workload using p_start like sy-datum
p_host like sapwlserv-hostshort.
refresh: applica_.
read application statistic from MONI
call function 'SAPWL_WORKLOAD_GET_STATISTIC'
exporting
periodtype = 'M'
hostid = p_host
startdate = p_start
only_application_statistic = 'X'
tables
application_statistic = applica_
exceptions
unknown_periodtype = 1
no_data_found = 2
others = 3.
sort applica_ by entry_id account.
loop at applica_ where entry_id(1) ge 'Y'. "#EC PORTABLE
clear wa_applicau-entry_id.
wa_applicau-entry_id(25) = applica_-entry_id.
wa_applicau-account = applica_-account.
wa_applicau-count = applica_-count.
collect wa_applicau into applicau.
endloop.
sort applicau by entry_id count descending.
applica_-ttype = space.
applica_-account = space.
modify applica_ transporting ttype account
where ttype ne space.
collect only enhancements statistic
if p_temp = 'X'.
loop at applica_.
applica_-entry_id+25(48) = space.
collect applica_ into applicat.
endloop.
else.
loop at applica_ where entry_id(1) ge 'Y'. "#EC PORTABLE
applica_-entry_id+25(48) = space.
collect applica_ into applicat.
endloop.
endif.
endform. " WORKLOAD
</pre> -
Eliminate duplicate while fetching data from source
Hi All,
CUSTOMER TRANSACTION
CUST_LOC CUT_ID TRANSACTION_DATE TRANSACTION_TYPE
100 12345 01-jan-2009 CREDIT
100 23456 15-jan-2000 CREDIT
100 12345 01-jan-2010 DEBIT
100 12345 01-jan-2000 DEBITNow as per my requirement, i need to fetch data from CISTOMER_TRANSACTION table for those customer which has transaction in last 10 years. In my above data, customer 12345 has transaction in last 10 years, whereas for customer 23456, does not have transaction in last 10 years so will eliminate it.
Now, CUSTOMER_TRANSACTION table has approximately 100 million records. So, we are fectching data in batches. Batching is divided into months. Total 120 months. Below is my query.
select *
FROM CUSTOMER_TRANSACTION CT left outer join
(select distinct CUST_LOC, CUT_ID FROM CUSTOMER_TRANSACTION WHERE TRANSACTION_DATE >= ADD_MONTHS(SYSDATE, -120) and TRANSACTION_DATE < ADD_MONTHS(SYSDATE, -119) CUST
on CT.CUST_LOC = CUST.CUST_LOC and CT.CUT_ID = CUST.CUT_IDThru shell script, months number will change. -120:-119, -119:-118 ....., -1:-0.
Now the problem is duplication of records.
while fetching data for jan-2009, it will get cust_id 12345 and will fetch all 3 records and load it into target.
while fetching data for jan-2010, it will get cust_id 12345 and will fetch all 3 records and load in into target.
So instead of having only 3 records, for customer 12345 it will be having 6 records. Can someone help me on how can i eliminate duplicate records from getting in.
As of now i have 2 ways in mind.
1. Fetch all records at once. Which is impossible as it will give space issue.
2. After each batch, run a procedure which will delete duplicate records based on cust_loc, cut_id and transaction_date. But again it will have performance problem.
I want to eliminate it while fetching data from source.
Edited by: ace_friends22 on Apr 6, 2011 10:16 AMYou can do it this way....
SELECT DISTINCT cust_doc,
cut_id
FROM customer_transaction
WHERE transaction_date >= ADD_MONTHS(SYSDATE, -120)
AND transaction_date < ADD_MONTHS(SYSDATE, -119)However please note that - if want to get the transaction in a month like what you said earlier jan-2009 and jan-2010 and so on... you might need to use TRUNC...
Your date comparison could be like this... In this example I am checking if the transaction date is in the month of jan-2009
AND transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27) AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)) Your modified SQL...
SELECT *
FROM customer_transaction
WHERE transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27) AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27))Testing..
--Sample Data
CREATE TABLE customer_transaction (
cust_loc number,
cut_id number,
transaction_date date,
transaction_type varchar2(20)
INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2009','dd-MON-yyyy'),'CREDIT');
INSERT INTO customer_transaction VALUES (100,23456,TO_DATE('15-JAN-2000','dd-MON-yyyy'),'CREDIT');
INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2010','dd-MON-yyyy'),'DEBIT');
INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2000','dd-MON-yyyy'),'DEBIT');
--To have three records in the month of jan-2009
UPDATE customer_transaction
SET transaction_date = TO_DATE('02-JAN-2009','dd-MON-yyyy')
WHERE cut_id = 12345
AND transaction_date = TO_DATE('01-JAN-2010','dd-MON-yyyy');
UPDATE customer_transaction
SET transaction_date = TO_DATE('03-JAN-2009','dd-MON-yyyy')
WHERE cut_id = 12345
AND transaction_date = TO_DATE('01-JAN-2000','dd-MON-yyyy');
commit;
--End of sample data
SELECT *
FROM customer_transaction
WHERE transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27) AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27));Results....
CUST_LOC CUT_ID TRANSACTI TRANSACTION_TYPE
100 12345 01-JAN-09 CREDIT
100 12345 02-JAN-09 DEBIT
100 12345 03-JAN-09 DEBITAs you can see, there are only 3 records for 12345
Regards,
Rakesh
Edited by: Rakesh on Apr 6, 2011 11:48 AM -
Storing the last modified date for files in a HashMap
This method gets a list of all the .java files in the source subdirectory, gets the last modified date for them and stores the file name and last modified date in a HashMap.
import java.util.HashMap;
import java.io.FilenameFilter;
import java.io.File;
import java.util.ArrayList;
public class myClass
public static void main(String[] args)
HashMap result = getLastModified();
static FilenameFilter javaFilter = new FilenameFilter()
public boolean accept(File dir, String name)
return name.endsWith(".java");
public HashMap getLastModified()
HashMap lastModified = new HashMap();
ArrayList javaFiles = new ArrayList();
File sourceDir = new File(".\\Source");
File currentFile;
long lLastModified;
//get a list of all the .java files in the source directory
javaFiles=listFiles(javaFilter);
//for all .java files get and store the last modified date
for(int i=0; i<javaFiles.size(); i++)
currentFile=(File)javaFiles.get(i);
lLastModified=currentFile.lastModified();
lastModified.put(currentFile, lLastModified);
return lastModified;
}The problems I am getting are:
>
The method listFiles(FilenameFilter) is undefined for the type myClass
and
>
The method put(Object, Object) in the type HashMap is not applicable for the arguments (File, long)
can anyone help? What's the best way to go aobut this?Thanks for the replies abenstex I modified it so that javaFiles is now a File[] and made the change you suggested but I still have the second problem, here's the code so far:
import java.util.HashMap;
import java.io.FilenameFilter;
import java.io.File;
import java.util.ArrayList;
public class myClass
public static void main(String[] args)
HashMap result = getLastModified();
static FilenameFilter javaFilter = new FilenameFilter()
public boolean accept(File dir, String name)
return name.endsWith(".java");
public HashMap getLastModified()
HashMap lastModified = new HashMap();
File[] javaFiles = {};
File sourceDir = new File(".\\Source");
File currentFile;
long lLastModified;
//get a list of all the .java files in the source directory
javaFiles=sourceDir.listFiles(javaFilter);
//for all .java files get and store the last modified date
for(int i=0; i<javaFiles.length; i++)
currentFile=(File)javaFiles;
lLastModified=currentFile.lastModified();
lastModified.put(currentFile, lLastModified);
return lastModified; -
Hi Friends I have a Source system as a Flat File..
All data Packets are loaded but last 3 data packets are not updated and it is still running, and they did not use PSA. In transfer ruls/Update Rules all are showing updated in Monitor, but 3 Data Packets are in Yellow what is the reason, but in Status it is showing No Errors the request is still running and " <b>Processing arriwed in BW Processing selected number doesn't agree with Transfer number"</b> this is the message in Transfer Idocs in Monitor.
What is the problem?. and how to solve it. <b>Here No PSA.</b>
Thankshi,
we had similar problems.
In our it was the database. The folder for the archive logs was simply on it limit.
Hope I could help you,
best regards,
christian -
Hyperion Planning Last Login Date
Hello Everyone,
I have a requirement where in I need to track the usage of the Hyperion Planning application. I need to build a list of inactive or dormant users and clean them up from the application.
In order for me to achieve this, I need the Last Login date into the Hyperion Planning application.
I read about something called Usage Tracking that needed to be turned on. A records gets added into the hsp_audit_records table.
Can someone throw some more light on this ? My requirement is to track the planning apps usage and clean up inactive users.
Thanks
RSHi,
we have the same issue: some new users every week and a lot of users not using planning anymore- depending on their always changing role in the company.
only helpful logfile we use to identify inactive/old users is: hbrlaunch.log - it logs the username and the businessrules, they execute.
maybe you regard this approach as a helpful workaround (provided your users run businessrules at all)
users, who run only financial reporting or who open only planning forms to passively review budgets (we have that a lot) , we would delete accidentially by this approach, because if you never save data, you never execute a businessrule attached to a webform.
but what about following approach:
you create a very small webform called "Confirm my user access", add a very small businessrule named "Confirm user access", which calculates almost nothing and you attach the rule to the form, give access to all users AND use option: "run on load"
by this, the rule get's executed on opening the webform already - you could even show a member in the webform with name "Thanks for confirming your user account - it will remain active"
Only disadvantage: you need to write a mail to all users and explicitly ask them to open that webform and confirm the user access. (Maybe you like that approach)
Alternative might me that you attach the businessrule to the/those webform(s) - especially read-only webforms, where people don't save data or execute businessrules and which are opened most often by all users and don't tell them about that method at all.
You then should get a pretty complete overview of your active users (userid's only I am afraid ) in hbrlaunch.log
in addition, financial reporting has a logfile as well, so you could combine the usage of financial reporting and planning (provided you use it)
pls. note, that the early 9.3.1 financial reporting versions have a bug and the logfile is empty= useless
Assuming you use shared services, you probably have to attach your users into several groups- it maybe helpful to first remove the user from one central group, which blocks their access to planning application or takes the right to open planning forms- you then start your forecast, wait for their complaints and delete them 3 months later completely from all security groups - could save you some work on re-creating their access.
We use the apache http-webserver - you can modify it, so that it's logging all datatransfer - you get there the IP-Adress and the requested application (Hyperion Planning) and the requested webforms logged - but no username.
In the eas console, we see the last logindate, which seems to show the last date, a user requested a financial report against essbase.
We use that information in combination with hbrlaunch.log form businessrules.
we have the hsp_audit_trail switched on for all options-
data: it stores all member, user and time information for every single saved value in the database - so we have between 500.000 and 1 Mio entries - it's especially useful, when your essbase crashes and your backup is a few hours old- you then can use that information to upload the remaining data-entries via smartview/exceladdin - provided you have some hours time to prepare the values in excel.
hspaudittrail useful as well when it comes to discussion, who entered which numbers when.
tracking of businessrule execution: should deliver same results as hbrlaunch.log
other changes being tracked should be meaningless for your requirement, as it tracks the work of the admin-person (Dimensions, Members, Usergroups, Webforms)
regards
Rodian
Edited by: Rodian Abel on 01-Apr-2010 12:20
Edited by: Rodian Abel on 01-Apr-2010 12:33
Maybe you are looking for
-
Hi All, SAP BW report in eprocurement not updated after PO change. Purchase order has 2 values, old value and new value, New value have to be show for the purchase order in BW report. The values are showing correctly for all PO's except two PO's it
-
Rating Scale (Likeart) question slide
Hello cp experts! I wish to use the Question slide 'Rating Scale (likert)' at the end on the presentation to provide a feedback. Is it possible to report the student selection to LMS and view statistics over time? if so, how do I do that? I didn't ma
-
Condition judgement in Query Designer
Hi,gurus. I want to realize the function as follows: If VALUE <= 0 then display VALUE as 0. if VALUE >0 then display VALUE. How to realize that in query designer? I've tried to create a formular but I can not find IF condition in Functions. Thanks,fo
-
"libsmime3.dylib" in use blocks deleting Firefox from Trash
Tried to install the new download of Firefox 3.6.16 When I did, it said it couldn't install because the libsmime3.dylib was in use. I trashed the Firefox application and profiles folder by dragging box into the Trash. But when I go to empty trash, th
-
Regarding real time java packages
Hi, I am relatively new to java. can anybody tell me about real time java, and where can i find the implementation of javax.realtime package?