Storing numbers in char variables.
Hi All
I need to store a number in a character variable
Num = 686 (integer type)
here c1 is the char variable of length 4.
If I give C1 = Num
the value is not stored.
How to store a number in a character variable.
Regards
Renuka.
Works fine. run the code below.
REPORT ztest.
DATA: n TYPE i VALUE '6666',
c TYPE char4.
c = n.
BREAK-POINT.
write: c , n.
Similar Messages
-
Select two diff fields and storing them in two variable in a same query ?
Hello,
i have a join query and i am selecting fields from different table(one field is the material number and second is bsad-wrbtr, on which i am doing the SUM). Now i cant store material number in a variable, cause i will be getting many material numbers(against 'vbeln') and sum( bsad-wrbtr ) will be stored collectively in a variable.
Shud i be using an internal table to store both of them ? , cause i have to display all the material numbers retrieved . If yes, the how ? what will be the query like ?
My current select/join query is,
select sum( bd~wrbtr ) into l_cramt
from ( ( bsis as bs
inner join bsad as bd on bs~bukrs = bd~bukrs and
bs~belnr = bd~augbl and
bs~bldat = bd~augdt )
inner join vbrp as vb on vb~vbeln = bd~belnr )
where bs~blart = 'DZ' and bs~hkont = p_hkont.
Waiting for your replies, thank..
Shehryar DaharHi,
If you want to have a list of materials and sum for each of them try this:
types: begin of t_list,
matnr like vbrp-matnr,
wrbtr like bsad-wrbtr,
end of t_list.
data: i_list type table of t_list.
select vbmatnr sum( bdwrbtr ) into table i_list
from ( ( bsis as bs
inner join bsad as bd on bsbukrs = bdbukrs and
bsbelnr = bdaugbl and
bsbldat = bdaugdt )
inner join vbrp as vb on vbvbeln = bdbelnr )
where bsblart = 'DZ' and bshkont = p_hkont
group by vb~matnr.
If you want to have a sum for a given material try this:
select vbmatnr sum( bdwrbtr ) into (v_matnr, v_wrbtr )
from ( ( bsis as bs
inner join bsad as bd on bsbukrs = bdbukrs and
bsbelnr = bdaugbl and
bsbldat = bdaugdt )
inner join vbrp as vb on vbvbeln = bdbelnr )
where bsblart = 'DZ' and bshkont = p_hkont
and vb~matnr = p_matnr. -
How to find out the type of the value stored in a string variable?
Hi,
How do i find out the type of the value stored in a string variable?
for example,
I have a string variable str, in which the following type of values wil be stored
1) Intger
2) Long
3) boolean
4) Char
Is there any method to find out the type of the value, anything like str.getType()?. Please kindly help me. Thanks in advance.Hi All, i'm sorry for the double posting, by mistake it occured.
Thanks for your replies, i have a string variable str, in which the value is stored and i have another string variable type, in which the type of the value is stored.
For example,
String str = "15";
String type = "Integer";
Is there any way to verify whether the value stroed in str is of type stored in the variable 'type'. I want to write a method of type boolean, it will throw true of the value stored in str is of type 'type'. Thanks -
How to get a "char variable" with presentation variable???
I want to pass a char variable with presentation variable, I don't have problems if I pass "int".
For example in answers page I add a column that contains years of my dimension. 2000 until 2012 and prompted my presentation variable "year" (from my dashboard prompt) and when I go to dashboard if I choose in my prompt 2006 in my report appear 2006...any problem and easy. But my problem is if I would pass a char variable, in my prompt also I have months but not numbers else names: January, February, March...and a presentation variable that name is "month". If I do the same report but change column year to month (name) I don't have any results and I have an error.
How can I solucionate this???
Thank you!!Alex,
Do you have separate columns for Year and Month Name. If Yes, Then why it is so confusing?
1. create a dashboard prompt with month name column
2. Assign it to monthname variable
3. In your report use above variable any where.., but what ever you are doing should be logical and valid to get some data.
In general above approach will work.
You said, "No! I don't want to do a filter with month! I would like to pass this variable, in this example don't make sense but I need to pass a char variable with presentation variable to do another things..."
what does that mean, what you are trying to do with the variable in your report. If you give a example that would be better.
- Madan -
Hi,
I'm a beginner in ABAP and I have a question..
Is possible increment a char variable?
for example I have varible:
R001 and i want increment this variable till RZZZ..
There is some solution or some function that i could use to do this?
Thanks so much.Hi,
please find starting & ending sequence numbers from R000 RZZZ
000 001 002 003 004 005 006 007 008 009 00A 00B 00C 00D 00E 00F 00G 00H 00I 00J 00K 00L 00M 00N
00O 00P 00Q 00R 00S 00T 00U 00V 00W 00X 00Y 00Z 010 011 012 013 014 015 016 017 018 019 020 021
022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045
046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069
070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093
094 095 096 097 098 099 01A 01B 01C 01D 01E 01F 01G 01H 01I 01J 01K 01L 01M 01N 01O 01P 01Q 01R
01S 01T 01U 01V 01W 01X 01Y 01Z 02A 02B 02C 02D 02E 02F 02G 02H 02I 02J 02K 02L 02M 02N 02O 02P
ZUM ZUN ZUO ZUP ZUQ ZUR ZUS ZUT ZUU ZUV ZUW ZUX ZUY ZUZ ZVA ZVB ZVC ZVD ZVE ZVF ZVG ZVH ZVI ZVJ
ZVK ZVL ZVM ZVN ZVO ZVP ZVQ ZVR ZVS ZVT ZVU ZVV ZVW ZVX ZVY ZVZ ZWA ZWB ZWC ZWD ZWE ZWF ZWG ZWH
ZWI ZWJ ZWK ZWL ZWM ZWN ZWO ZWP ZWQ ZWR ZWS ZWT ZWU ZWV ZWW ZWX ZWY ZWZ ZXA ZXB ZXC ZXD ZXE ZXF
ZXG ZXH ZXI ZXJ ZXK ZXL ZXM ZXN ZXO ZXP ZXQ ZXR ZXS ZXT ZXU ZXV ZXW ZXX ZXY ZXZ ZYA ZYB ZYC ZYD
ZYE ZYF ZYG ZYH ZYI ZYJ ZYK ZYL ZYM ZYN ZYO ZYP ZYQ ZYR ZYS ZYT ZYU ZYV ZYW ZYX ZYY ZYZ ZZA ZZB
ZZC ZZD ZZE ZZF ZZG ZZH ZZI ZZJ ZZK ZZL ZZM ZZN ZZO ZZP ZZQ ZZR ZZS ZZT ZZU ZZV ZZW ZZX ZZY ZZZ
My suggestion will be create a custom table and keep all possible combination numbers in it and use this table
a® -
How to store serval char variables into a string variable?
I have serval char variables, but i don't know how to put them together (without using arrays). I am thinking to store these char variables into a string variable but i don't know how to do it. For example,
char letter1 = 'a', letter2 = 'b', letter3 = 'c';
String letters;
then how can i do to make letters = "abc" from using letter1,2,3?
I am just a beginner of Java, if anyone can help me, i will appreciate that very much!!!String letters=""+leter1+letter2+letter3;is fine and dandy. What it actually compiles to is
String letters = new StringBuffer().append(letter1).append(letter2).append(letter3).toString();Which ofcourse is much more code to write, but still good to know.
So do see the API for java.lang.StringBuffer.
Heikki -
Executing a Stored Procedure with OUT Variables
When you execute a stored proc withi OUT variables, do you have to add in the "Declare" section and "Begin/End" sections? Or can you just use "EXECUTE <stored proc>"??
When you execute a stored proc withi OUT variables, do you have to add in the "Declare" section and "Begin/End" sections?
Or can you just use "EXECUTE <stored proc>"?? You mean this?:
michaels> create or replace procedure p (o out varchar2)
as
begin
o := 'Some out variable';
end p;
Procedure created.
michaels> var o varchar2(50)
michaels> exec p(:o)
PL/SQL procedure successfully completed.
michaels> print o
o
Some out variable -
How to see the datas stored in DBMS_SQL.Varchar2S variable?
how to see the datas stored in DBMS_SQL.Varchar2S variable?
it says error if i use dbms_out.put_line.in PLSQL :
procedure p_try (p_test IN OUT DBMS_SQL.VARCHAR2S) is
begin
p_test.delete ;
p_test( -3000) := '===============' ;
p_test( 22) := 'Hello' ;
p_test( 55555) := 'World' ;
p_test(987654321) := '===============' ;
end p_try;
set serveroutput on
declare
l_test dbms_sql.varchar2s ;
i number ;
begin
p_try (l_test) ;
i := l_test.first ;
while i >= l_test.first and i <= l_test.last loop
dbms_output.put_line (l_test(i)) ;
i := l_test.next(i) ;
end loop ;
end ;
===============
Hello
World
===============when using Forms, you would use TEXT_IO instead of DBMS_OUTPUT -
Can I Execute a function whose name is stored in a string variable?
Can I execute a function whose name is stored in a string variable?
Like
Depending on the condition I will stroed the name of the function in a string variable. Then using that string variable i want to execute the function.
String str=��
iVal an int can take ne value
Switch(iVal)
Case 1:
str=�test1()�;
Case 2:
str=�test2()�;
I want whatever function name is in str to be executed.
----------------------------------------------------------------------------------For just executing a method or two, reflection might be easier than beanshell (or it might not). For executing entire scripts, beanshell will be preferable over reflection.
(I assume beanshell uses reflection under the hood, but I've never bothered to peek.) -
How to convert DATE variable to CHAR variable
dear all,
How to convert DATE variable to CHAR variable
thanqDepending on your final goal here are 2 options.
DATA: datein TYPE d.
DATA: dateout(10) TYPE c.
DATA: dateout2(8) TYPE c.
datein = sy-datum.
WRITE datein TO dateout MM/DD/YYYY.
dateout2 = datein.
WRITE:/ datein, dateout, dateout2.
and the output
05022008 05/02/2008 20080502 -
Stored numbers not stored!
When I call one of my Skype to Go numbers, I am told "we don't recognise the number you are calling from, please jump through 15,000 hoops to connect the call" the number I am calling from is stored in my stored numbers... it gives me the option to save the number again, but the next time I call I have to jump through the same 15,000 hoops, why is this happening?
Something like
SELECT row_number() over (order by deptid) rank_no, deptid, dept_name
FROM deptJustin -
I have a problem storing numbers in files. WHen i store them, they are stored as ANSI numbers. Which means I have a limit of 255. Anything over this becomes a '?'
How would I go about getting around this limitation?
Should I store them as strings?If you have a string which contains only a number, you can use the following method to get the number:
String s="123";
int i=Integer.parseInt(s);So you could store one number per line in the file, which is the simplest way to do it.
Alternatively, you can store several numbers on each line, so long as they are separated by the same character, eg a space, or a comma or whatever. The use StringTokenizer to break the string up into tokens according to the delimeter you specify:
String s="1,2,3,4,5,6";
StringTokenizer st=new StringTokenizer(s, ",");
while (st.hasMoreTokens()) {
//This loop iterates over each token. Basically, each time this
//loop goes round, i equals the next number in the string.
int i=st.nextToken();
}So you can store numbers however you like in the file, so long as the numbers are all stored in the same way (this keeps it simple). -
Dear friends,
i have case like the following example, and i hope you have solution for my problem, lets assume the following:
declare
xx varchar2(10);
begin
xx := 5 ||','||6;
select * from emp where emp_no in (xx);
end ;
when you run above query it will give invalid number. as the query didn't recognized the numbers inside the variable.
Thanks in advanceYou want something like this:
SQL> ed
Wrote file afiedt.buf
1 select *
2 from emp
3 where ename in (
4 with t as (select '&input_string' as txt from dual)
5 select REGEXP_SUBSTR (txt, '[^,]+', 1, level)
6 from t
7 connect by level <= length(regexp_replace(txt,'[^,]*'))+1
8* )
SQL> /
Enter value for input_string: SCOTT,JAMES
old 4: with t as (select '&input_string' as txt from dual)
new 4: with t as (select 'SCOTT,JAMES' as txt from dual)
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7788 SCOTT ANALYST 7566 19-04-1987 00:00:00 3000 20
7900 JAMES CLERK 7698 03-12-1981 00:00:00 950 30
SQL>Which would also work if the input was numbers and you were comparing against e.g. the empno column. -
Tsql stored procedure - passing multiple variables
Hi,
I have a dropdown field on a form that allows for multiple
selects. When I process the form, I currently use CF to dynamically
generate the sql WHERE clause creating as many AND statements as
needed.
I'm migrating to MS SQL 2005 and Stored Procedures on the db.
I'm trying to create a stored procedure that effectively uses tsql
to do what CF was doing previously (creating the WHERE clause).
In the code below, I am passing a char(22) variable called
Channel. The code below was my initial attempt at trying to create
the WHERE clause. Most of the code is focused on extracting out the
individual "Channel" entities. Any thoughts on how to pull this
together would be GREATLY appreciated!
I'm need help on the SELECT side, ultimately I'm selecting
"regions", from "Syndicated", the WHERE is based on the "Channels"
passed.
Thanks,
cfwildHi,
This was quite the adventure trying to figure this out. I
learned quite a bit about tsql. Here is the final procedure:
CREATE PROCEDURE dbo.uspSelectSyndicatedRegion
@TablePrefix char(7),
@Category varchar(100),
@Channel varchar(2000)
AS
BEGIN
SELECT DISTINCT S.Region
FROM Syndicated S
JOIN iter_charlist_to_tbl(@Channel, DEFAULT) M
ON S.Channel = M.str
UNION
SELECT ''
ORDER BY S.Region
END -
How to validate numbers in char field.
Hello all,
I have one database column with char data type. This field should allow insert only
numbers [ zero to nine] and plus symbol .. how to validate this?
Pls help me..
I.m using oracle 9i database. So it does not allow REG-EXP and WITH methods.. So give some
sql coding to do thisAs this forum is for issues with the SQL Developer tool, you'll probably get more answers in the SQL And PL/SQL forum.
Regards,
K.
Maybe you are looking for
-
How to populate the last empty row in Excel without using Report Generation Kit
I wrote a Labview SUb Vi that uses Report Generation Toolkit that is not loaded on the test stand. I am looking to convert it from Report Generation Vi like New Report, Append Table to Report, Dispose Report. The tunneling through all the report ge
-
Error 1603 installing microsoft sql native client
error 1603 installing microsoft sql native client Sagar Chavan
-
Does anyone know if you can do a back up in Contribute or do I need to buy another program to do this. I basically want to back up our website in case of crash. If I need a program, any suggestions on who or what would be appreciated. Thanks, Linda
-
Blogging software and Dreamweaver
I am searching for a blogging software to add to our site. Any suggestions (product) from anyone that has worked with blogging software? Thanks
-
I apologize if this isn't the appropriate board for this. I have never developed software for anything. I know HTML, CSS, XHTML, Actionscript, PHP and MySQL. I am putting together a portfolio and am considering trying to develop my portfolio into an