Defaulting vo attribute with system date
hie
looking for defaulting every new row in my vo with current date-time.
I guess there would be some groovy to insert in default value.
any idea what is that?
Vik
you can use Groovy expresions
adf.currentDate
adf.currentDateTime
To get the system date from the database, you can use the following Groovy expression at the entity level:
DBTransaction.currentDbTime
In entity you can also set attribute as history column Created On if attribute is not to be changed by the user.
Similar Messages
-
Scheduling a report with System Date as prompt
Hi Experts,
We have came across a requirement where users want to have a date prompt.
While scheduling the report, by default prompt is to be populated with system date and it (prompt) should also allow us to select a different date.
This report is used for regular run and also for scheduling.
We need a single report with single prompt which allows us to run for any random date when prompted and also to be scheduled for the latest date.
Please give us advice/ suggestion.
Thanks
UttamHi Neil,
We have tried both the approaches given by you, but it is not working for my requirement.
Let me explain it with the below scenario.
scenario:
we have developed the report by using 2 data providers,
Dp1: It is a custom Query with date as follows ( it is a Transaction data) which brings the data from 1st day of month(user prompt) to user's prompt date.
TRANSACTION_DATE BETWEEN last_day(ADD_MoNTHS(@Prompt('As Of Date :','DT','ABC\plant\Transaction Date',Mono,Free,Persistent,,User:0)
Dp2: It is also Custom Query, but it has only data on month ends.
DIMV_plant_EOP.TRANS_END_OF_MONTH_DATE = last_day(ADD_MoNTHS(@Prompt('As Of Date :','DT','ABC\plant\EOP plant Attributes\EOP Date',Mono,Free,Persistent,,User:0),-1))
Report is having 3 prompts, namely
1) As of date (prompt)
2) Plant (prompt)
3) Country (Prompt)
For example: if my report is ran on 06-june-2014,
DP1: Brings the data from 1st of June to 6th of june.
DP2: Brings the Data from Inception to last month(say 30-may-2014) because it has only month end data.
Upto this it is fine.... but
My requirement is to schedule the report daily......
Example: User want to schedule a report today(10-July-2014), tomorrow(11-July-2014) and so on...
Scheduling should be done daily i.e, it has to fetch the data 10-Jul-2014, 11-july-2014,12-july-2014.... so on.
Automatically scheduling has to take the current date.
Thanks,.. -
Unable to use transactions with System.Data.OracleClient data provider
I am using VS2008, System.Data.OracleClient, Oracle 10g, and ODAC 10.2.0.20. I haven't been able to get transactions to work. When I use 'connection.BeginTransaction()', the rollback doesn't work. When I use TransactionScope, the output parameter is always DBNull. Any ideas/comments?
Here's the sample code:
// #define ENABLE_TRANSACTION // failure is 'rollback not working'
#define ENABLE_TRANSACTION_SCOPE // failure is 'no output parameter value'
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Data.OracleClient;
#if ENABLE_TRANSACTION_SCOPE
using System.Transactions;
#endif
namespace TestOracleTransaction
class Program
static void Main(string[] args)
#if ENABLE_TRANSACTION_SCOPE
using (TransactionScope scope = new TransactionScope())
#endif
string connectionString = "Data Source=ORADEV;User ID=user;Password=pwd";
using (OracleConnection connection = new OracleConnection(connectionString))
try
connection.Open();
#if ENABLE_TRANSACTION
using (OracleTransaction transaction = connection.BeginTransaction())
#endif
try
#if ENABLE_TRANSACTION_SCOPE
if (Transaction.Current == null)
throw new ArgumentException("no ambient transaction found for OracleClient");
#endif
OracleCommand command = connection.CreateCommand();
#if ENABLE_TRANSACTION
command.Transaction = transaction;
#endif
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "TIS.P_TIS_GATEWAY_INFO_ADD";
OracleParameter param = command.CreateParameter();
param.ParameterName = "p_gateway_id";
param.Direction = ParameterDirection.Input;
param.DbType = DbType.Int64;
param.Value = 18;
command.Parameters.Add(param);
param = command.CreateParameter();
param.ParameterName = "p_info_id";
param.Direction = ParameterDirection.Input;
param.DbType = DbType.Int64;
param.Value = 79;
command.Parameters.Add(param);
param = command.CreateParameter();
param.ParameterName = "p_user";
param.Direction = ParameterDirection.Input;
param.DbType = DbType.String;
param.Value = "spms";
command.Parameters.Add(param);
param = command.CreateParameter();
param.ParameterName = "p_gateway_info_id";
param.Direction = ParameterDirection.Output;
param.DbType = DbType.Int64;
param.Size = sizeof(Int64);
command.Parameters.Add(param);
int count = command.ExecuteNonQuery();
object value = command.Parameters["p_gateway_info_id"].Value;
long id = (value == DBNull.Value) ? -1 : Convert.ToInt64(value);
if (id < 0)
// FAILURE - no output parameter value when TransactionScope enabled
throw new ArgumentException("no return value");
#if ENABLE_TRANSACTION
// FAILURE - rollback doesn't work when Transaction enabled
transaction.Rollback();
#endif
#if ENABLE_TRANSACTION_SCOPE
scope.Complete();
#endif
catch (Exception ex)
System.Console.WriteLine("ERROR: " + ex.Message);
#if ENABLE_TRANSACTION
transaction.Rollback();
#endif
finally
if (connection.State == ConnectionState.Open)
connection.Close();
}Hi,
First, this is not the place for questions with System.Data.OracleClient, this is the Oracle Data Provider for .NET forum. Having said that I went ahead and tested your code with some slight modifications because you did not provide the stored procedure information. I am assuming your stored procedure is doing some sort of DML since you are using transactions and attempting to commit and rollback.
I tested the following with both Transaction scope and a local transaction object and it worked fine with System.Data.OracleClient. I provided the create table and stored procedure I used.
Observations
========
When using transaction scope, a distributed transactions was executed and the data was inserted and returned in the output variable.
From console
p1 value is Hello World
From SQL Plus
SQL> select * from foo;
C1
Hello World
When using a local transaction, the DML was not inserted when calling rollback and when I changed it to commit, the row was inserted successfully.
Maybe you can test the simple foo example below to see if it works for you. Maybe there is something going on in your SP that is causing your specific observations.
The code I posted at this point is using local transaction and calling transaction.commit(), rollback is commented out. But I tested all scenarios and they worked as expected.
HTH
Jenny
#define ENABLE_TRANSACTION // failure is 'rollback not working'
//#define ENABLE_TRANSACTION_SCOPE // failure is 'no output parameter value'
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Data.OracleClient;
#if ENABLE_TRANSACTION_SCOPE
using System.Transactions;
#endif
create table foo (c1 varchar2(50));
create or replace procedure getstr (p1 out varchar2) as
begin
insert into foo(c1) values ('Hello World') returning c1 into p1;
end;
namespace TestOracleTransaction
class Program
static void Main(string[] args)
#if ENABLE_TRANSACTION_SCOPE
using (TransactionScope scope = new TransactionScope())
#endif
string connectionString = "Data Source=orcl;User ID=scott;Password=tiger";
using (OracleConnection connection = new OracleConnection(connectionString))
try
connection.Open();
#if ENABLE_TRANSACTION
using (OracleTransaction transaction = connection.BeginTransaction())
#endif
try
#if ENABLE_TRANSACTION_SCOPE
if (Transaction.Current == null)
throw new ArgumentException("no ambient transaction found for OracleClient");
#endif
OracleCommand command = connection.CreateCommand();
#if ENABLE_TRANSACTION
command.Transaction = transaction;
#endif
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "SCOTT.GETSTR";
OracleParameter param = command.CreateParameter();
param.ParameterName = "p1";
param.Direction = ParameterDirection.Output;
param.DbType = DbType.AnsiString;
param.Size = 20;
command.Parameters.Add(param);
int count = command.ExecuteNonQuery();
object value = command.Parameters["p1"].Value;
Console.WriteLine("p1 value is {0}",value.ToString());
#if ENABLE_TRANSACTION
// FAILURE - rollback doesn't work when Transaction enabled
transaction.Commit();
//transaction.Rollback();
#endif
#if ENABLE_TRANSACTION_SCOPE
scope.Complete();
#endif
catch (Exception ex)
System.Console.WriteLine("ERROR: " + ex.Message);
#if ENABLE_TRANSACTION
transaction.Rollback();
#endif
finally
if (connection.State == ConnectionState.Open)
connection.Close();
} -
Given date time is in yyyyMMddHHmmss format, want to compare with system date time.
ie given date time is greater than zero then go inside if block otherwise else block.I am using below code which always greater than zero. But I want to use compare to method to compare given date with system date and goto if or else condition:
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String delaytimeFormat = sdf.format(new Date("10/10/2009"));
System.out.println("delaytimeFormat: "+delaytimeFormat);
long timeDiff = Long.parseLong(delaytimeFormat) - System.currentTimeMillis();
System.out.println("timeDiff->"+timeDiff);
String newCallbackUrl = null;
if(timeDiff > 0){
s = s+" new URL"+"test" ;
System.out.println("if:->"+s);
else{
System.out.println("else");
} -
VF11 - Billing Date should be defaulted with system date
Hi All,
My requirement is to default the System date in Billing Date for the transaction VF11.
Please let me know whether any Exits/BADI exist for this.
I tried to create the field exit but the problem is for this Billing Date field there is no Parameter ID , so how can I assign the todays date to Billing date field in VF11 else is there any other way to do this ????.
Please do the needful.
Thanks in advancehi ,
below are the exits available for vf11. choose the most apprapriate one
Transaction Code - VF11 Cancel Billing Document
Exit Name Description
SDVFX007 User exit: Billing plan during transfer to Accounting
SDVFX008 User exit: Processing of transfer structures SD-FI
SDVFX009 Billing doc. processing KIDONO (payment reference number)
SDVFX010 User exit item table for the customer lines
SDVFX011 Userexit for the komkcv- and kompcv-structures
V05I0001 User exits for billing index
V05N0001 User Exits for Printing Billing Docs. using POR Procedure
V60A0001 Customer functions in the billing document
V60P0001 Data provision for additional fields for display in lists
V61A0001 Customer enhancement: Pricing
SDVFX001 User exit header line in delivery to accounting
SDVFX002 User exit for A/R line (transfer to accounting)
SDVFX003 User exit: Cash clearing (transfer to accounting)
SDVFX004 User exit: G/L line (transfer to accounting)
SDVFX005 User exit: Reserves (transfer to accounting)
SDVFX006 User exit: Tax line (transfer to accounting)
regads, -
How to use Db Provider Factories with System.Data.SqlServerCe
I'm using SQL Server Compact Edition, but in the future I would like to be able to switch to another SQL Server Edition or even a different database. To achieve this, Microsoft recommends using DB Provider Factories (see: Writing Provider Independent Code in ADO.NET, http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=674426&SiteID=1).
I enumerated the available data providers on my PC with:
Code Snippet
System.Reflection.Assembly[] myAssemblies = System.Threading.Thread.GetDomain().GetAssemblies();
The important entry is:
"SQL Server CE Data Provider"
".NET Framework Data Provider for Microsoft SQL Server 2005 Mobile Edition"
"Microsoft.SqlServerCe.Client"
"Microsoft.SqlServerCe.Client.SqlCeClientFactory, Microsoft.SqlServerCe.Client, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
When executing:
Code SnippetdataFactory = DbProviderFactories.GetFactory("System.Data.SqlServerCe");
I got at first this error run time message:
Failed to find or load the registered .Net Framework Data Provider.
I added a reference to "Microsoft.SqlServerCe.Client" at C:\Programme\Microsoft Visual Studio 8\Common7\IDE\Microsoft.SqlServerCe.Client.dll and the program runs.
Of course, it uses "Microsoft.SqlServerCe.Client" instead of "System.Data.SqlServerCe". Laxmi Narsimha Rao ORUGANTI from Microsoft writes in the post "SSev and Enterprise Library" that "Microsoft.SqlServerCe.Client" is not meant to be used and that we should add the following entry to the machine.config file:
Code Snippet<add name="SQL Server Everywhere Edition Data Provider" invariant="System.Data.SqlServerCe" description=".NET Framework Data Provider for Microsoft SQL Server Everywhere Edition" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
After changing the code to:
Code Snippet
dataFactory = DbProviderFactories.GetFactory("Microsoft.SqlServerCe.Client");
I get the same error message as before, even after adding a reference to "System.Data.SqlServerCe" at C:\Programme\Microsoft Visual Studio 8\Common7\IDE\System.Data.SqlServerCe.dll.
Any suggestion what I should do ? Just use "Microsoft.SqlServerCe.Client" ? Anyway, I don’t like the idea that I have to change the machine.config file, since I want to use click once deployment.It seems there is no DbProviderFactory for System.Data.SqlServerCe. At least I couldn’t find one, no matter how hard I searched on the Internet. I only found Microsoft.SqlServerCe.Client.SqlCeClientFactory. But we are not supposed to use Microsoft.SqlServerCe.Client and the 2 classes do have quiet some differences among their members. So I decided to write my own factory:
Code Snippet
public class SqlCeClientFactory: DbProviderFactory {
public static readonly SqlCeClientFactory Instance = new SqlCeClientFactory();
public override DbCommand CreateCommand() {
return new SqlCeCommand();
public override DbCommandBuilder CreateCommandBuilder() {
return new SqlCeCommandBuilder();
public override DbConnection CreateConnection() {
return new SqlCeConnection();
public override DbDataAdapter CreateDataAdapter() {
return new SqlCeDataAdapter();
public override DbParameter CreateParameter() {
return new SqlCeParameter();
That was easy enough, right ? I spent 1 week investigating the problem, 10 minutes solving it. I wonder why Microsoft didn’t include this class, because they have already the code in Microsoft.SqlServerCe.Client. I guess they have their reasons, but of course, they don’t tell us. After wasting one more month, I probably can tell. Oh, how I hate this.
Or has anyone an idea what might be the problem ? -
Purchase Order Creation with System Date but not Server Date???
Dear Experts,
We have server Located in USA and User is working from India when user is Recording the PO system is taking Server Date but as per requirement it has to take system date (i.e User system date - India time).
How to achieve this please let me know
is there any profile option or setup need to done??
Thanks in Advance!!
Regards
BharathHi,
Please check the release strategy. Check if your Purchase requisiton is released at all the levels.
Thanks,
Chinmay -
How to fill date key figure with system date?
Dear All,
We would like to set on specific action (button press) to assign current system date top a date key figure within our infocube.
Any idea how to achieve this?many thanks in advance for any idea!
Kind Regards
Olivier DESFOURDear Khaja,
I'm not exactly using an update rule, i'm using Integrated Planning component.
Customer would like to set this key figure on user action; ie for example
user validate a step within planning process by pressing a button on workbook.
then system is stamping system date within cube.
Hope it helps
Kind regards
Olivier -
Create directory with system date for export files
Hello,
I have a requirement to add the system date folder automatically, as the exports files dumps get into to d:\oracle\exp\..... this should be d:\oracle\exp\03182009. for each day it should create these date folder to dump the export files.
here I am sending two of my scirpts .
first one is
set ORACLE_SID=%1
set PATH=D:\ORACLE\ora102\bin;C:\WINNT\system32;C:\WINNT
set LOCAL=2:%1
net use h: /delete
net use login
sqlplus test/test@%1 @d:\oracle\dba\apps\expfull\buildfile < d:\oracle\dba\apps\expfull\enter.txt
exp parfile=h:\admin\%1\exp\%1_FULL.par
call h:\admin\%1\exp\%1_FULL.cmd
this is the buildfile script
set term on
set head off
set feed off
set ver off
set lines 159
set pages 0
set wrap on
set concat off
clear columns
clear computes
clear breaks
clear buffer
ttitle off
btitle off
col dbnm new_value sid_dir noprint
col parnm new_value parfil noprint
col dmpnm new_value dmpfil noprint
col lognm new_value logfil noprint
col lstnm new_value lstfil noprint
col zipnm new_value zipfil noprint
col cmdnm new_value cmdfil noprint
col ownr new_value ownername noprint
col tabnm new_value tabname noprint
col partnm new_value partname noprint
col datest new_value datestmp noprint
-- Load the sid_dir, ownername, tabname, partname, and datestmp substitution variables.
select
name dbnm
, to_char(sysdate,'YYYYMMDD')||'_'||'N' datest
, upper('&1') ownr
, upper('&2') tabnm
, upper('&3') partnm
from v$database;
-- Load the filename substitution variables.
select
'&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'.par' parnm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'_'||'&datestmp'||'.dmp' dmpnm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'_'||'&datestmp'||'.log' lognm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'_'||'&datestmp'||'.zip' zipnm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'.lst' lstnm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'.cmd' cmdnm
from dual;
-- Build the export parameter file.
spool h:\admin\&sid_dir\exp\&parfil
prompt userid=test/test@&sid_dir
prompt buffer=4194304
prompt direct=Y
prompt recordlength=65535
prompt consistent=Y
prompt file=h:\admin\&sid_dir\exp\&dmpfil
prompt log=h:\admin\&sid_dir\exp\&logfil
prompt tables=(&ownername.&tabname:&partname)
spool off
Please help out...>
I have a requirement to add the system date folder automatically, as the exports files
dumps get into to d:\oracle\exp\..... this should be d:\oracle\exp\03182009. for each
day it should create these date folder to dump the export files.OK - well, you will (AFAICR) have to create the directory, then cd into it,
then run your script - I don't see what the problem is?
You could* do something like -
at 00:01 run a cron job that simply does something like this
(I'm just giving outline - not a particular implementation)
runs date
gets the day, month and year from that -
export MyDay=day
export MyMonth=month
export MyYear=year
mkdir /path/to/dir/oracle/exp/$MyDay$MyMonth$MyYear
At the beginning of your script, before going into SQLPlus
----Your usual stuff------------
set ORACLE_SID=%1
set PATH=D:\ORACLE\ora102\bin;C:\WINNT\system32;C:\WINNT
set LOCAL=2:%1
net use h: /delete
net use login
++++plus
cd /path/to/dir/oracle/exp/$MyDay$MyMonth$MyYear
Maybe this will be a help to get you started - it could probably be much more elegant in
Python or whatever, but if shell-scripting is the way you want to go...
I'd be interested to see if this can provide the basis for a solution.
HTH and TIA.
Paul... -
How to compare a given date with System date?
The date input for me is of type String and it is in the format
String s = "1900-00-00 00:00:00.000";
I need a helper method that will take the above string as input and it should return Boolean value depending on the following condition.
Date should be less than or equal to current date and greater than the date prior to the date 50 years of current date.
Thanks in advance...I got it.
String date = "3000-03-19 12:34:56.000";
Calendar c = Calendar.getInstance();
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
Date d = new Date();
Date d1 = new Date();
Date d2 = new Date();
c1.set(Integer.parseInt(date.substring(0,4)),Integer.parseInt(date.substring(5,7)),Integer.parseInt(date.substring(8,10)),Integer.parseInt(date.substring(11,13)),Integer.parseInt(date.substring(14,16)),Integer.parseInt(date.substring(17,19)));
c2.set(1,c.get(1)-125);
d = c.getTime();
d1 = c1.getTime();
d2 = c2.getTime();
System.out.println(d1.compareTo(d));
System.out.println(d2.compareTo(d1));
System.out.println(".....");
System.out.println(d1.compareTo(d));
System.out.println(d1.compareTo(d2));
if(d1.compareTo(d)<=0 && d2.compareTo(d1)<=0)
System.out.println("Success");
} -
Attributes with junk data using ldapsearch utility
Hi,
We have Enterprise Directory 5.1 V2 installed on HP-UX.
We have a issue when viewing data through ldapsearch utility.
1. some attributes for employees have blank values(one space),this we can see from the console. This was added manually through a perl script as a part of a fix.
But when it is viewed through a ldapsearch utility it shows as some junk characters for this blank valued attrributes.
eg: email address ::==RHWA
I have few questions
1. Can we add a blank space value for the attributes
2. how can i retrieve a meaningful data( even a blank data) from a ldapsearch utility without any junk characters.Since most users use this utility.
This is a production issue. I would greatly appreciate for a good solution.
Thanks a lot.Identify which attributes? Binary encoded attributes? You could do a regular ldapsearch, specifying a list of the attributes which might have space or binary values. These attributes will be in the form
^name::
You could use a perl script to look for these, then use ldapmodify to delete those values or replace them. -
Load Master data attribute with Text Data (Urgent Please)
Hello Experts,
I created a new navigational attribute to one of the master data object and now I want to load that particular new navigational Attribute from the Master data Text (Medium description).
In brief, I need first 4 letter of master data text (medium description) to load in to the navigational attribute. How
How is this possible? Can you please help me to get it solved.
Thanks and Regards,
Harish MulakaHi Apparrao,
Add this attribute to your infoobject's attributes list.
Make sure it comes in the communication structure for the infoobject.
Then in the transfer rules write a routine. You will have to read the text table to get the medium text(field TXTMD) and pull the 4 characters from the beginning and populate your new attribute.
Do a full load and run the attrbute change run.
Hope that helps.
Regards. -
Change New To Do default to open with due date = today's date
Anyone know whether this can be done, and how to do it ?
Have the same problems since 6 month. Although the problem doesn't appear permanently but regulary. A simple reboot helps for me.
-
How can I get System dates with time scheduler using threads
how can I get System dates with time scheduler using threads.is there any idea to update Date in my application along with system Date automatic updation...
What the heck are you talking about and whatr has it to do with threads?
Current time: System.currentTimeMillis. Date instances are not supposed to be updated. -
How to take System Date format
Hai,
DateFormat class has various date format like DEFAULT, SHORT, MEDIUM, LONG. These format will display the date in a particular format. As well as Using SimpleDateFormat class we can give our own format.
I want to display the date with system date format. In our system we can set any date format using control panel. But how can we take that format from our program.
If any one know give me idea..
Thanks.The default locale should be enough to set the correct date format for you. You can check the currently set locale with java.util.Locale.getDefault(). java.text.DateFormat.getDateInstance() generates the proper date format for that locale.
The other poster is right, though. You're asking for an OS dependant function which Java, rightly, does not do.
Maybe you are looking for
-
How can I set my time capsule to back-up only once a day?
How can I set my time capsule to only back-up once a day. It appears to be backing up several times a day. Not sure there is a set schedule for the back-ups and they take a great deal of time; over an hour each.
-
Why is it taking so long to copy a folder?
Friends, I'm trying to copy my Aperture library to a different location on my computer to facilitate accessing it on another computer. The library size is 237GB. It's taking approximately five seconds per megabyte which, at this rate, will take app
-
Hi Gurus, The process in Depot to Depot STO process. Say Depot A is importing a material and transferring to another Depot B. Depot B raised an PO and A sent the goods via outboun delivery along with the Excise inv generated thru J1IJ. Now when we do
-
Hi, I need to add Purchase order, vendor, vendor name, customer, customer name and ar invoice field as a special field for FAGLL03. I am able to add vendor, customer and purchasing number fields but I am not able to find name field for customer and v
-
Hai Experts, A query is working on one cube 1. and i we have created the cube 2 with the same properties and i want to work this query on that cube 2 also. Can we copy the query and work the query on the Cube 2 How can i do this? Thanks, Vikram