Assigning variable value to another variable
I want to assign value from one variable with type DATETIME to another variable which has type STRING.
E.G: I need to convert this variable P_CreatedDate of type DATETIME to STRING variable CreatedDate.
Can someone help me in C# script. Im using SSIS script task.
Thanks in advance.
ZK
I have a requirement where I need to convert following datetime variable value into the string vaiable format.
Here is the example:
7/23/2014 11:24 PM
I need above datetime to be converted into following string format
2014-01-01 03:15:01.470
yyyyMMdd HHmmssFFF
Thanks in advance.
ZK
Similar Messages
-
How to derive a variable value from another variable of a different IO?
Hi Gurus,
I am aware that using BEx variables and Customer Exit you are able to derive a variable value from another variable of the same infoobject (for example, Fiscal Year/Period (0FISCPER) and Calendar Day (0CALDAY)).
However, is is possible, using the same approach to derive a variable value from another variable that is in a different InfoObject? (for example, Input Fiscal Year/Period (0FISCPER) but derive Output of Required Start Date (0REQSTDAT))?
There are 2 BEx variables involved,
1) A user entry variable that is restricted in 0FISCPER
2) A customer exit variable that is restricted in ZREQSTDAT
In CMOD under EXIT_SAPLRRS0_001, Include ZXRSRU01, the code (I assume, correct me if I'm wrong) should perform 3 functions in I_STEP = 2,
1) After the pop up, capture user entry of Fiscal Year/Period
2) Identify or convert Fiscal Year/Period to Calendar Day range (unsure on how to code this portion)
3) Use the Calendar Day to lookup on matching Required Start Date and display all Required Start Date that matches. (unsure on how to code on this portion)
Hope to hear your thoughts soon.
Regards,
EricHi Shanthi,
I've made the necessary adjustments. The only difference in my code is,
Instead of,
If I_VNAM = 'ZREQSTDAT'
I use,
CASE I_VNAM.
Instead of,
PARAMETERS: ZFISCPER TYPE /BI0/OIFISCPER.
ZYEAR = ZFISCPER(4).
ZMM = ZFISCPER+4(3).
I use ,
This is the Customer Exit Variable in ZREQSTDAT
WHEN 'ZRSD_CX'.
The loop I use for the User Entry Variable in 0FISCPER-ZFYP_IN
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'ZFYP_IN'.
IF SY-SUBRC = 0.
CLEAR L_S_RANGE.
ZYEAR = LOC_VAR_RANGE(4).
ZMM = LOC_VAR_RANGE+4(3).
The codes were checked with no errors.
However, when I input the Fiscal Year/Periods and hit 'Execute'. The report went blank, not sure what is the cause. I've tried it several times. No error message appeared.
Regards,
Eric -
Filling up a variable value from another variable
Hi,
I have two date fields, one calmonth characteristic ZCALMON (as char) and other calmonth charactaeristic 0CALMON as time dimension (standard bw).
But at query level, I would like to user enter only one variable value 0PCALMON for 0CALMON (say only for date characteristic as time dimension). This date variable value should get copied to other date characteristic ZCALMON (as char).
I can do this by using the customer exit varibale (without writing any abap code) and using the copy variable from other variable options. But I am not able to use the offset on ZCALMON.
How can i Use offset using customer exit variable on ZCALMON.
cheers
rajHi,
you can use customer exit variable which will read the value of the 0calmonth variable and pass it to the zcalmonth.
While populating the value, do the calculation or the off-set and send the value to zvcalmonth (Variable).
WHEN 'ZVCALMON'.
IF i_step = '2'.
Loop at i_t_var_range into i_s_var_range where vnam = '0PCALMON' .
zdat = i_s_var_range-low.
endloop.
CALL FUNCTION 'GO_BACK_MONTHS' *Sample Function
EXPORTING
currdate = zdat
backmonths = '012'
IMPORTING
newdate = from_period.
CALL FUNCTION 'GO_BACK_MONTHS' *Sample Function
EXPORTING
currdate = zdat
backmonths = '000'
IMPORTING
newdate = to_period.
CLEAR l_s_range.
lyear = from_period+0(4).
lmon = from_period+4(2).
lday = from_period+6(2).
CONCATENATE lyear lmon lday INTO l_s_range-low.
Hope you got it
Regards
Happy Tony -
Variable value from another variable
Hi all,
I created a query where one variable fill nother variable with following abap code:
when 'ZODACE'.
tables: /BIC/AZSD_O0100,
/BIC/AZSD_O0200.
ranges: r_createdon for /BIC/AZSD_O0100-CREATEDON.
break-point.
if i_step = 2.
loop at i_t_var_range into loc_var_range
where vnam = 'ZDATADOC'.
clear r_createdon.
r_createdon-low = loc_var_range-low.
r_createdon-high = loc_var_range-high.
r_createdon-sign = 'I'.
r_createdon-option = 'BT'.
append r_createdon.
exit.
endloop.
select DOC_NUMBER into
/BIC/AZSD_O0100-DOC_NUMBER
from /BIC/AZSD_O0100
where /BIC/ZAUDAT in r_createdon.
select single * from /BIC/AZSD_O0200
select * from /BIC/AZSD_O0200
where refer_doc = /BIC/AZSD_O0100-DOC_NUMBER.
clear l_s_range.
l_s_range-low = /BIC/AZSD_O0200-refer_doc.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
append l_s_range to e_t_range.
endselect.
endselect.
endif.
The variable are:
ZODACE based on IO 0REFER_DOC with customer exit
ZDATADOC based on IO ZDATU with manual entry
After wich end-user digit a data in ZDATADOC popup I take ODOC_NUMBER in order item ODS ZSD_O01 where ZDATADOC=CREATEDON.
With 0DOC_NUMBER I go to delivery item ODS ZSD_O02 and I take the corresponding 0REFER_DOC and then I fill variable ZODACE.
0REFER_DOC is in row of the query.
When I start the query I receive the following error message:
Error for variable in the customer exit ZODACE
and in debug i find this message:
System error in the program CL_RSR_REQUEST and Form GET_SETXX_WA
How can I do please?
Thanks in advance
Gianmarco0DOC_NUMBER type-CHAR lenght-10
0REFER_DOC type-CHAR lenght-10
ZAUDAT type-DATS lenght-8
0CREATEDON type-DATS lenght-8
Can you help me please?
Thanks a lot -
How to use the value of a variable to set another variable
Hello Experts,
Is it possible to access the value of variable set by the user and set the default value of another variable using the user entered value for the first variable? Example:
Date variable
Week variable
Month variable
User enters one of those and the other two are automatically prefilled with the correct values?
Thanks
RadoHi Rado,
Gothrough following code
Which reads year from user input and converts it to factory calendar week , following which you should able to convert user inputs to required parameters.
DATA: v_year1 TYPE i,
v_int TYPE i,
v_week1 TYPE kweek,
v_qurt TYPE i,
v_perd TYPE /bi0/oifiscper,
v_iweek TYPE i,
v_periv TYPE periv VALUE 'Z4'.
DATA : v_vweeks TYPE /bi0/oicalweek,
v_vperd TYPE /bi0/oifiscper,
v_vperiv TYPE /bi0/oifiscvarnt VALUE 'Z4'.
DATA : vit_weeks LIKE /bi0/scalweek OCCURS 0 WITH HEADER LINE.
DATA : v_perd1 TYPE umc_y_fiscper,
v_weeks TYPE umc_ys_dimvals,
v_pweeks TYPE i.
CASE i_vnam.
WHEN 'WPIYWEEK'. "Variable name of char. in Bex
*Check for Step 2 (After user gives inputs on selection screen)
CHECK i_step = c_after. "Step:2
CLEAR : v_year1,
v_week1,
v_iweek.
*Read the value of variable which used has entered on sel. screen
READ TABLE i_t_var_range INTO wa_var_range
WITH KEY vnam = 'WPIFYEAR'.
v_year1 = wa_var_range-low.
CALL FUNCTION 'TIME_GET_LAST_WEEK'
EXPORTING
if_year = v_year1
IMPORTING
ef_week = v_week1
EXCEPTIONS
fatal_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Get the no. of week from YYYYWW format
v_iweek = v_week1+4(2).
l_s_range-low = v_iweek.
l_s_range-sign = c_include.
l_s_range-opt = c_equal.
APPEND l_s_range TO e_t_range. "This is the output structure in which u have to add the result
Endcase.
Hope that helps.
Regards
Mr Kapadia
Assigning points is the way to say thanks in SDN. -
How to check empty string and null? Assign same value to multiple variables
Hi,
1.
How do I check for empty string and null?
in_value IN VARCHAR2
2. Also how do I assign same value to multiple variables?
var_one NUMBER := 0;
var_two NUMBER := 0;
var_one := var_two := 0; --- Gives an error
ThanksMichaelS wrote:
Not always: Beware of CHAR's:
Bug 727361: ZERO-LENGTH STRING DOES NOT RETURN NULL WHEN USED WITH CHAR DATA TYPE IN PL/SQL:
SQL> declare
2 l_str1 char (10) := '';
3 l_str2 char (10) := null;
4 begin
5
6 if l_str1 is null
7 then
8 dbms_output.put_line ('oh STR1 is null');
9 elsif l_str1 is not null
10 then
11 dbms_output.put_line ('oh STR1 is NOT null');
12 end if;
13
14 if l_str2 is null
15 then
16 dbms_output.put_line ('oh STR2 is null');
17 elsif l_str2 is not null
18 then
19 dbms_output.put_line ('oh STR2 is NOT null');
20 end if;
21 end;
22 /
oh STR1 is NOT null
oh STR2 is null
PL/SQL procedure successfully completed.
SQL> alter session set events '10932 trace name context forever, level 16384';
Session altered.
SQL> declare
2 l_str1 char (10) := '';
3 l_str2 char (10) := null;
4 begin
5
6 if l_str1 is null
7 then
8 dbms_output.put_line ('oh STR1 is null');
9 elsif l_str1 is not null
10 then
11 dbms_output.put_line ('oh STR1 is NOT null');
12 end if;
13
14 if l_str2 is null
15 then
16 dbms_output.put_line ('oh STR2 is null');
17 elsif l_str2 is not null
18 then
19 dbms_output.put_line ('oh STR2 is NOT null');
20 end if;
21 end;
22 /
oh STR1 is null
oh STR2 is null
PL/SQL procedure successfully completed.
SQL> SY. -
How to use one variable as a default value for another variable?
Hi Experts,
Is it possible to use one variable as a default value for another variable?
For example:
Variable 1 = current calendar year month
Variable 2 = mandatory input ready variable for calendar year month
I want to use variable 1 as default value for variable 2, but also have the ability to change the month if required.
Thanks!
Kathrynu can use replacement path variable
in that case u can replace the values of 1 variable with the another variable...
but u cannot do this setting
u cannot make variable 2 as mandatory
u cannot enter value for variable 2
because by default it will take the value of variable 1
u have to make follow settings
variable 2
name , technical name
processing by = replacement path
infoobject = ocalmonth
next tab
replaced by another variable
variable name
offset start , offset lenght
save and hit okey -
Can we assign jython variable value into ODI variable?
Hi Team,
We are trying to save jython variable value into ODI variable so that ODI variable can use in later steps.
we are facing failure regards same.
Please suggest us so that we can use ODI variable value in later steps.
Thanks
Ankush.See if this post help you :- How to assign value for a ODI variable from Jython Script
Doc id 424579.1 on metalink should help. -
Restriction of f4 help of a bex variable based on another variable input
Hi,
Could you please let me know if there is any possibility to restriction of f4 help of a bex variable based on another variable input.
eg: when i select particular company code in one variable, i need to restrict the f4 help for another variables eg: pur. group based on selected company code.
Regards
KasiHi,
Try using replacement path option in bex with replace variable with variable selction.
Thanks. -
Assign a value to class variable
I want to define a class variable in class. And I want all subclasses of that class ot have a different value for that class variable. How can I do that?
public class BaseClass {
public static String tableName = "";
}Now if I have a ClassA and I want to assign a value like this :
public class ClassA extends BaseClass {
tableName = "location";
} I got an error message.
I can move it in a static initializer block but then it will only work when the class is loaded. In my case its possible i want to get this value without loading the class.
Ditto if i move it to constructor.
Any input? ThanksAre you saying that if i have 2 classes ClassA and
ClassB inherited from BaseClass, then both are
sharing the same copy of 'tableName' staticvariable?
If yes then I should go with an instance variable.No, I am saying that you can easily declare a
tablName in A and another tableName in B.
A.tableName will be shared between all the instances
s of A. B.tableName will be shared between all the
instances of B. And BaseClass.tableName is
irelevant. I think you try to use
BaseClass.tableName as some kind of template for
sub-classes, but this does not happen: you need to
declare tableName again and again in each subclass.
IThanks for clarifying. Each class needs to have a variable "tableName" and it needs to have one copy of this variable for all of that class's objects. 2 classes will not have the same value of this tableName variable.
Thats why I was defining it as static variable. And I define it in BaseClass so that I dont have to define it again in each subclass.
Is there any better way? Thanks -
Issue with customer exit for copying one variable value to another
Hello Gurus,
I need to copy the value of a single value variable into another single customer exit variable.
I coded as below.
WHEN 'customer_exit_var'.
IF I_STEP = 2. "after the popup
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'user_input_Variable'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = LOC_VAR_RANGE-LOW.
L_S_RANGE-HIGH = ''.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
EXIT.
ENDLOOP.
ENDIF.
I used the condition <= for the customer exit variable in the report. But, it is considering only single value, but not all the values <= to the give value.
Please help me in this regard,
Thanks,
Aarthi.Thanks for your immediate response Govind.
My report is restricted based on two dates. Date1 and Date2. Need to consider all records whose dates are <= Date1 and <= Date2.
Date1 and Date2 should have same values. But user inputs only Date1.
So, I created Date1 as Single, User Input Variable restricted the query with <=Date1.
Next I created Date2 as Single, Customer Exit Variable and restrcited the Query with <=Date2.
In CMOD I used the above code to assigne Date1 Value to Date2.
When I execute the report, say I give todays date in the report (Dec, 12, 2007). Date2 has to consider all the values <= Dec 12, 2007. But, in my case it is considering only Dec 12, 2007, but not the before dates.
So, Please help me in solving this problem.
Thanks,
Aarthi. -
How to assign a value to ODI Variable using ODI Procedure
Hi ,
Is it possible to assign a value to a ODI Variable using ODI Procedure ?
If it is possible how we can do that.
BEGIN
IF #Counter=1
Then
#Next_Increment:=#Counter+1;
End if;
END;
In my example I have 2 ODI Variables #counter and #Next_increment.
I am trying to assign VALUE TO A ODI VARIABLE #next_increment from another ODI Variable #counter.
thanks
prasannaPrasanna,
I have a similar requirement where I need to assign values to ODI variables within a procedure. How do we make use of an ODI package to accomplish this ?
Actually, I have a sequence of ODI steps, and there is a call to a procedure 'LOG ERROR' from every step which gets called in case error occurs in any step. I just need to identify from which step the error came.
Please help. -
Creating Variable with Replacement Path to get value from ANOTHER Variable
Hi all,
Is anyone has created the Variable with Replacement Path to get the value from another User Entry Variable, PLEASE ?
First created the User Entry Variable (ZV_X) and it accepts the date range like '01/01/2009 - 01/31/2009'. Next created the Characteristic variable (ZV_Y) of Replacement Path for which source variable will be ZV_X and we should get the 'FROM Date' (01/01/2009) from the selection (ZV_X) into it (ZV_Y).
While creating the Characteristic variable (ZV_Y) of Replacement Path, I didn't find my newly created ZV_X variable in the list of available variables under 'Variable' header in 'Replacement Path' tab and it is causing the error 'Source to replace variable ZV_Y is not defined'. How could I create the Characteristic variable of Replacement Path for my requirement, PLEASE ?
The following is from help.sap..com:
Replace with Characteristic Value
Text and formula variables with the processing type Replacement Path can be replaced with a corresponding characteristic value. In the variable editor, on the General tab page, you specify under Reference Characteristic the characteristic that is to be referenced by the replacement. On the Replacement Path tab page, you can choose whether the variable is replaced with the From or the To Value and with the Key or the Name of the characteristic value. You can also specify the Offset Start and Offset Length for the output.
Replace with Variable
Characteristic value variables, hierarchy variables, text variables, and formula variables with the Replacement Path processing type can take their values from a different variable.
The following prerequisites need to be fulfilled:
Variable
● The variable must not be input-ready
● The variable must represent a single value
Source Variable
● The source variable must not be a hierarchy node variable
● The source variable must be input-ready
● The source variable must be available in the query
● The source variable must represent a single value or an interval
In the variable editor, on the Replacement Path tab page, you specify the source variable from which the value is to be determined. The value is either determined from the key, the external attribute of the key, the description, or the attribute value. You can specify an Offset Start and an Offset Length for the output here. The variable is replaced on the variable screen upon each data release.
Thanks,
Venkat.Hi Eve,
It is possible to connect the 2 queries using a Replacement Path characteristic variable. You would need to create the variable on the char whose values you want to pass from Q1 to Q2. The variable will be of type replacement path and you will need to enter the name of Q1 from which it will get the values. Make sure that you include this char in the query definition of Q1 and Q2. In Q2 you will restrict the characteristic using this variable. DO not use this variable (replacement path) in Q1.
In your query properties check if you have turned on the checkmark for Release for OLE DB for OLAP (3rd tab). If the check mark is there, then remove it.
We are using the scenario in a couple of places, and it works very well.
Hope this helps... -
Error while assigning resultset value to Querytable variable in Coldfusion 10
We are upgrading from coldfusion 8 to 10. Internally we were using java function to to get the data.
In java function we have a resultset object, if we assign this resultset value to Querytable variable, we are getting below error. This code was working fine in coldfusion 8.
Detail This exception is usually caused by service startup failure. Check your server configuration.
Message The Runtime service is not available.
StackTrace coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Runtime service is not available. at coldfusion.server.ServiceFactory.getRuntimeService(ServiceFactory.java:117) at coldfusion.runtime.RequestMonitor.<clinit>(RequestMonitor.java:14) at coldfusion.sql.QueryTable.populate(QueryTable.java:358) at coldfusion.sql.QueryTable.populate(QueryTable.java:283) at coldfusion.sql.QueryTable.<init>(QueryTable.java:96) at com.myCompany.myClass.myFunct(myClass.java:627) at
Here is the function which is causing error.
static private QueryTable myFunct(String userId, SessionFactory sf) {
PreparedStatement pStmt = null;
ResultSet rs = null;
QueryTable ret = null;
try{
Query q = sf.getCurrentSession().getNamedQuery("ListUsers");
pStmt = sf.getCurrentSession().connection().prepareStatement(q.getQueryString());
rs = pStmt.executeQuery();// works fine till here
ret = new QueryTable(rs); // error line
rs.close();
}catch(Exception e){
e.printStackTrace();
throw new RuntimeException(e.getLocalizedMessage());
return ret;
Can you provide some help on this. Please let me know if you need any other details.We have found this error is logs
coldfusion.runtime.Encryptor$InvalidParamsForEncryptionException: An error occurred while trying to encrypt or decrypt your input string: The input and output encodings are not same..
at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:303)
at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:284)
at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5353)
at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5326)
at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5458)
at com.vmware.vcp.service.impl.EncryptColdFusionImpl.decrypt(EncryptColdFusionImpl.java:65)
at com.vmware.vcp.web.servlet.ApplicationConfigServlet.initEmailService(ApplicationConfigSer vlet.java:119)
at com.vmware.vcp.web.servlet.ApplicationConfigServlet.init(ApplicationConfigServlet.java:51 )
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at coldfusion.bootstrap.ClassloaderHelper.initServletClass(ClassloaderHelper.java:121)
at coldfusion.bootstrap.BootstrapServlet.init(BootstrapServlet.java:59)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5001)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5278)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722) -
Getting a variable value from another class
Is there any way to get the value of a variable from another class? I have a file that calls another that does some checking then gives a true or false. The place the checking is done is inside an ActionListener I want to use that value in the file that calls the second. Any help would be great.
in 'another class', implement a method,
public boolean isCheckedOutOK( Object obj )
do the comparison in that method (use a suitable argument)
Maybe you are looking for
-
General question: Connect to EJB
Hi, At the moment I am working on the architectural design of a new application written by J2EE technology. To study the subject I read many books and tried a large number of HelloWorld applications with EJB. As I understand it, the EJB works like th
-
Photoshop Lightroom and Photoshop CS5 .psd files compatibility
Currently I'm trying to open a .psd file for a graphic in Lightroom but I cannot see any .psd extensions. Any idea how to do so? In other words, .psd is not in the supported files extensions in Lightroom? Anybody knows how to deal with such problem?
-
Everytime I try to start photoshop, I get an error that the scrartch disks are full. I have 2 1 TB hard disks in raid 0. They are definatly not full! I tried crtl-shift-alt and deleted the presets, but get the same error. I am running win 7 64 bit!
-
Safari crashes on adobe flash player sites
Hello! My family plays on the very popular Webkinz website, but for the past week and a half, Safari keeps randomly crashing while accessing the site. Not sure if it is a site issue or a browser issue. I do have the current updates for Leopard, and I
-
Hi all, We have created a system with the following properties. Property Category : Connector Group : PUBLIC Logical system name : NWCL135 Message Server : NWCL135 Remote host type : 3 SAP Client : 135 SAP System ID