Sum into Variable
Hi, i'm trying to make a sum from an user defined table, and retrieve this value into a variable, the problem is when don't satisfy the conditions (where), the variable sy-subrc never goes to 4, i need to know when the select retrieves me a value and where is not.
The select statement is this:
SELECT SUM( cant )
FROM zcmtt_envase
INTO v_cant
WHERE docsap = p_tipo
AND ref = p_ti_zcmtt_envase-ref
AND matnr = ti_sumlips-matnr.
sy-subr it's always 0 !!!
HI ,
check the value of variable.
if v_cant is not initial. " means sy-subrc eq 0.
else.
endif.
Mahesh
Similar Messages
-
Trying to get sysdate- 2yrs and sysdate+2yrs value into variable
Hi,
iam Trying to get sysdate- 2yrs and sysdate+2yrs value into variable.But facing the following issue. Please help me out .
Error :
p_start_date := select add_months(max(sysdate), -24) from dual;
ERROR at line 6:
ORA-06550: line 6, column 25:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
continue avg count current exists max min prior sql stddev
sum variance execute forall merge time timestamp interval
date <a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternat
ORA-06550: line 7, column 3:
PLS-00103: Encountered the symbol "P_END_DATE"
Code
declare
p_start_date date;
p_end_date date;
begin
select add_months(max(sysdate),-24) into p_start_date from dual;
dbms_output.put_line('p_start_date' |p_start_date);
dbms_output.put_line('p_end_date' | p_end_date);
end;Hi, try:
SQL> declare
2
3 p_start_date date;
4 p_end_date date;
5
6 begin
7
8 select add_months(sysdate,-24) into p_start_date from dual;
9 select add_months(sysdate, 24) into p_end_date from dual;
10
11 dbms_output.put_line('p_start_date: ' ||to_char(p_start_date, 'dd-mm-yyyy hh24:mi:ss'));
12 dbms_output.put_line('p_end_date: ' ||to_char(p_end_date, 'dd-mm-yyyy hh24:mi:ss'));
13 end;
14 /
p_start_date: 14-04-2007 17:41:34
p_end_date: 14-04-2011 17:41:34
PL/SQL procedure successfully completed. -
Need to validate file Name,split the file name and store the splited values into Variables
Dear All,
Below is the my requirement.
I have a folder, in that folder I have bunch of text files. The file name is below format
ACA_122_pay_20140430_001
Initially the file name start with ACA code,groupid,group name and date time stamp. This is the standard structure of file name.
I want to check each and every file in the folder with this structure. The structure should be standard for all the files. If the structure same for all files I need to get codes form file name. For example
If you see the below file name, I need to get ACA and put into variable,I need to get 122 and put into variable. For group name and date time needs to put in variable.
If the file format is not valid state then I need to log exception.
Let me know if I am not clear.
Kindly provide the C# code for achieving the above requirement.
As I am new to .net programming. kindly help me.
Thanks in Advance,
Regards,
Madhava Ganji
Madhava GanjiHi MadhavaGanji,
I have post how to validate the file name, header row against definition table which stored the file name and column definition.
Take a look and see if this is helpful.
http://sqlage.blogspot.com/2013/11/ssis-validate-file-header-against.html
http://sqlage.blogspot.com/ -
SELECT INTO ( variable ) STATEMENTS NOT WORKING FOR SYBASE TABLE AS VIEW
Dear Experts,
We have connected our 9i db with Sybase db using Hs connectivity.
and then we have create the view in oracle db for SYBASE_TABLE as SYBASE_TABLE_VIEW.
ALL THE INSERT, UPDATE AND DELETE COMMANDS ARE WORKING BUT THE
select Into (variable) is not working.
Please help to resolve the select into statment which is in BOLD in the below routine
PLEASE NOTE! FORM WAS COMPILED SUCCESSFULLY AND FORM IS RUNNING BUT SELECT INTO COMMAND IS NOT WORKING.
Thanks & Regards
Eidy
PROCEDURE SRBL_INSERT IS
CURSOR SRBL IS
SELECT impno,impcod,impnam
from oracle_table1 a, oracle_table2 b
WHERE a.impcod=b.empcod
v_srpcod varchar2(5);
BEGIN
FOR rec in SRBL loop
begin
select "im_code" into v_impcod
from SYBASE_TABLE_VIEW
where "im_code"=rec.impcod;
exception when no_data_found then
v_srpcod:=null;
end;
END LOOP;
END;
Edited by: Eidy on Aug 16, 2010 11:28 AMhellow
try this.
select "im_code" into v_impcod
from SYBASE_TABLE_VIEW
where "im_code"=rec.impcod;
v_srpcod := v_impcod ;
........ -
Hi All!
I''ve created global and lоcal variable with type - string
How can I assign the value into variable in BR?
I tried [Var_1] = "qwe"; or [Var_1] = @CONCATENATE (String_1, String_2) it doesn't work
Regards
SashaYou should be able to take global/local variables from HBR into the code and use concatenate within the HBR.
Something like
@CONCATENATE([varName1], [varName2]) shouldn't be a problem, so long as the values are good.
Regards,
Cameron Lackpour -
Read a file content into Variable
Hi There,
I've a file in Unix and the content of it need to be assigned to an ODI variable. How can I do it?
Regards.
-BhavaniStep 1. ODI procedure .
Command on Target - Java bean shell.
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
BufferedReader br = new BufferedReader(new FileReader("C:\\test.txt" ));
String strLine = br.readLine();Step 2
Create variable and add
SELECT '<@=strLine@>' from dual This particular code will read only first line and pass into variable. -
ForEach Loop - Parsing XML subgroup into Variables
Hi all,I am designing a new ETL process using SSAS.
We have a controller package which receives an XML string at run time into a variable called BatchRequest :-
<Batch>
<Request>
<Name>Filemon</Name>
<Params>
<filepaths>
<Sourcepath>d:\temp</Sourcepath>
<Destpath>D:\temp2</Destpath>
<Archivename>\Archive</Archivename>
</filepaths>
</Params>
</Request>
</Batch>
The Batch can contain a number of Requests and a ForEach Loop is used to parse the text for the Name node and the text for the Params Node into variables RequestName and RequestParams respectively.
however, what I want to be able to do is to take the text for <name> into Requestname but take the entire XML sub string for <Params> into RequestParams.
At the moment I get the text only (e.g. d:\tempd:\temp2\Archive).
The Requestname is used by an XML task within the ForEach loop to retrieve full package path details from an external config file, and hence it only needs to be a keyword.
I played with the idea of including <Params> as a subnode for <Name>, only populating RequestName in the loop parser and then having an XML task which would parse the related parameter string, but i don't know how to tell the XML task that I
want the parameter string where the <Name> is Filemon (in this example).
Can anyone give me some suggestions or pointers?
Thanks
Iain
IainHi idcowden,
Glad to hear that you have resolved the issue on your own. Thank you for sharing the solution.
Regards,
Mike Yin
TechNet Community Support -
Empty query result into variable? what's the result
It's Null Value or What?
i write a query like this.
select name into variable from table where pk is null;
/*this query return nothing*/
/*Variable = Null or variable is empty ?*/Generally, the contents of the variable do not change if a SELECT..INTO.. returns no rows.
It is safer to have your NO_DATA_FOUND exception handler set the variable to an appropriate value (eg null). -
Insert multiple objects into variable (array)
Hello,
I need to create PS script to which gets logged on users(get-rdusersession | select UserName), puts them into variable $users=@(user1,user2,...,userN) and runs foreach {something} - something like send message and logoff user. But I cannot get the
output from command get-rdusersession to the variable. Can someone tell, how to do that? Thank you.
Pete
sfsHi Pete,
try this:
$Users = Get-RDUserSession | Select -ExpandProperty UserName
The "-ExpandProperty" Parameter means the select command returns a String with the value that the UserName property on the output of Get-RDUserSession had. Otherwise you get a PSObject that has a UserName property itself, containing that string
(try Piping both versions to the cmdlet Get-Member and see for yourself, both properties and type name).
Cheers,
Fred
Ps.: Try running Get-RDUserSession in your Powershell Console and check whether you actually get any output, in case that's the problem.
There's no place like 127.0.0.1 -
Regular expression result into variable??
Im dealing with log files here...i use regular expression to detect the values...how can i save these values into variable, for example 25-07-2005 into "date"?
this is how my output statement look like
myOutput1.print(matcher1.group(1));
matcher1.group is the way i use to get the value using regular expressionthanx...actually i have already match it in groups and it works fine..the problem is im dealing with log files...what im trying to do is reformat back the log files collected...example.."8 Nov" change it to 8-11-2005
When i match it into the group its actually just finding the pattern, not saving it into variable..if its save in the variable would be easier..
how can i change "8 Nov" to 8-11-2005?? can anyone help me with a simple code???
thanks -
AppleScript Excel - Copy value of cells into variables
I am super new to AppleScript, so please excuse me if I am not good at explaining what I am trying to do. I have an Excel file that has 12 columns and X rows, I need to have B2/C2/D2/etc copied into variables but have the column be a variable instead of a static number so I can write a loop to get all the rows, etc. Here is what I have now, and I know this is far from being correct.
copy value of cell "B2" to varRow
I have tried something crazy like this:
copy value of column colSection of row intRow to varSection
But that just throws up an error saying the object i am trying to access does not exist. I set the ColSection to "B" and intRow to 2, so I thought it would work. Any ideas or advice I am open! Thanks!The following should give you the idea:
tell application "Microsoft Excel"
activate
make new workbook
set myCol to 3 -- the starting column
set myBgnRow to 2 -- the starting row
set myString to "Hello World" -- characters to be inserted into sheet as sample values
set myChar to 1 -- Points to first character ("H")
set myEndRow to myBgnRow + (length of myString) - 1 -- the ending row
-- Now put some values into the cells
repeat with myRow from myBgnRow to myEndRow
select (cell myCol of row myRow of active sheet)
tell cell myCol of row myRow
set value to character myChar of myString
end tell
set myChar to myChar + 1
end repeat
-- now get the values back out
-- note that this is using same myBgnRow and myEndRow as above
repeat with myRow from myBgnRow to myEndRow
select (cell myCol of row myRow of active sheet)
tell cell myCol of row myRow
set myVal to value
end tell
display dialog (myCol as text) & "," & (myRow as text) & " " & myVal
end repeat
end tell -
Inputing into variables.
I'm a C++ programmer, but my teacher wants me to program a herkle game in Java. I could easily do it in C++, and I know that the two languages are similar, but I dont know alot of the keywords, like in C++, you'd use cout <<. In java, you'd use system.out.println(". What i'm trying to get to is I need to learn how to input into variables. Like let the user assign a value to a variable or string. Thaks for any help
Gui = Graphical User Interface; Command Line = DOS
also, just use this file, save it as PrimitiveInput.java and compile it with the javac tool that comes with the Java Development Kit:
import java.io.*;
* This class provides a collection of basic methods to perform
* primitive type console input.
public class PrimitiveInput
static BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
* read the next line from the keyboard as a String
* @return the line as a String
* @throws IOException
public static String readString() throws IOException
return in.readLine() ;
* read the first character on the line
* @return the first character on the line
* @throws IOException
public static char readCharacter() throws IOException
String s = in.readLine();
if (s.length() == 0)
return '\0';
else
return s.charAt(0);
* read the next line as an integer
* @return the line as an integer
* @throws IOException
public static int readInteger() throws IOException
try
String line = in.readLine();
int i = Integer.valueOf(line.trim()).intValue();
return i;
catch (Exception e)
throw new IOException("invalid integer format");
* read the next line as a float
* @return the line as a float
* @throws IOException
public static float readFloat() throws IOException
try
String line = in.readLine();
return Float.valueOf(line.trim()).floatValue();
catch (Exception e)
throw new IOException("invalid float format");
* read the next line as a double
* @return the line as a double
* @throws IOException
public static double readDouble() throws IOException
try
String line = in.readLine();
return Double.valueOf(line.trim()).doubleValue();
catch (Exception e)
throw new IOException("invalid double format");
} // End PrimitiveInput.java -
Hi all. I need to clear a field in a structure, but the problem is that this field is known only during runtime and is contained as a value of another field (lv_need_clear). How can the value be into transformed into variable?
CONCATENATE 'ls_bapi_' <ls_matdata>-tabname 'x' '-'
<ls_dd03p>-deffdname INTO lv_need_clear.
CLEAR "...???u can assign structure too.
FIELD-SYMBOLS <fs_struc> TYPE ANY.
ASSIGN (structure_name) TO <fs_struc>.
check sy-subrc EQ 0.
then.
ASSIGN COMPONENT (field_name) OF structure <fs_struct> TO <fs>. -
hi all,
below is my code .
select a.notification_date, a.approve_decision, b.audit_decision ,
case
when a.case_status = 10
then '0'||a.approve_decision||b.audit_decision
when a.case_status = 5
then a.case_status||NULL||NULL
end as status_id
from t_claim_case a, t_claim_product b
where a.case_id = b.case_id
and a.case_id = i_case_id ;
what i wan to achieve is to get notification_date and status_id into
variable m_notification_date and m_status_id.
tks.select notification_date, status_id
into m_notification_date, m_status_id
from (
select a.notification_date, a.approve_decision,
b.audit_decision ,
case
when a.case_status = 10
then
'0'||a.approve_decision||b.audit_decision
when a.case_status = 5
then a.case_status||NULL||NULL
end as status_id
from t_claim_case a, t_claim_product b
where a.case_id = b.case_id
and a.case_id = i_case_id
) ; -
I have a report data as following:
Invoice | Invoice Line | Supplier | Total Amt
Inv 1 0001 A 100
Inv 1 0002 B 100
Inv 2 0001 A 200
Inv 2 0002 B 200
I have done the report into grouping the data by suppress the Duplicate amount and become following
Invoice | Invoice Line | Supplier | Total Amt
Inv 1 0001 A 100
0002 B
Inv 2 0001 A 200
0002 B
I have use a variable to calculate how much of Supplier available by using count. In order to avoid duplicate Total Amt = 200, I create a variable C = sum(Total Amt) / count(Supplier). But one things is if I want to do the sum for Total Amt for the entire report. I am not able to use the Sum(Total Amt) in Report footer. And I am not able to do the Sum (Variable C). Any idea?i gather you are grouping your report by customer then invoice number
use MANUAL running totals, the wizard may be the reason it is incorrect.
create 1 set of the 3 formulas listed below for customer and one set for invoice id.
RESET
The reset formula is placed in a group header report header to reset the summary to zero for each unique record it groups by.
whileprintingrecords;
Numbervar X := 0;
CALCULATION
The calculation is placed adjacent to the field or formula that is being calculated.
(if there are duplicate values; create a group on the field that is being calculated on. If there are not duplicate records, the detail section is used.
whileprintingrecords;
Numbervar X := x + ; ( or formula)
DISPLAY
The display is the sum of what is being calculated. This is placed in a group, page or report footer. (generally placed in the group footer of the group header where the reset is placed.)
whileprintingrecords;
Numbervar X;
Maybe you are looking for
-
My apple id shows to be disabled on iphone and ipads but workd on PC. Have tried changing password on PC and signing out and back in on devices with no results. How do I reenable my ID so I can update and purchase apps?
-
Hi, I am trying to use Jakarta's dbcp package for connection pooling in a standalone application with MySQL database. I've taken a look at the samples at: http://cvs.apache.org/viewcvs.cgi/jakarta-commons/dbcp/doc/ I would like to manually configure
-
Replacing pictures in interactive slideshow
I am currently working on a CS5 InDesign interactive project. I have 3 thumbnail buttons which trigger larger pictures on the same page. All works fine when clicked in order, but I cannot go backwards (by clicking back to thumbnail 1 for example) and
-
Hi Group, I have one File to File scenarion which using ABAP proxy to upload the table in SAP side.I processed the File and it is showing success status in both SAP side MONI and XI Side MONI ,but corresponding tables not updated,I need to debug the
-
Get "Licensing for this product has stopped working" error on my New Mac with old Adobe software
hi people, i've recently purchased a new machine and can't work out how to get Illustrator cs3 or photoshop cs5 working on it... photoshop says "Licensing for this product has stopped working. you cannot use this product at this time. you must repair