Function to generate a random ID
Hello all,
Do we have any inbuilt function in SAP to generate a random alphanumeric ID?
The requirement is such that there is an import parameter "Sales Rep ID" which is optional. So if the user is not providing the ID, then we have to randomly generate it ourselves. Hence I am looking for a FM which does that job.
Regards,
Abhishek
look at the function modules in F052, rthere yiou can generate random value for any data type.
RANDOM_AMOUNT
RANDOM_C
RANDOM_C_BY_SET
RANDOM_F8
RANDOM_I2
RANDOM_I4
RANDOM_INITIALIZE
RANDOM_P
RANDOM_TABLE_ENTRY
Similar Messages
-
Any function generating a random number ?
Is there any function which yields a random number every time from a given list of numbers ?
e.g.
Consider table t as :
invoice_no
123
456
789
654
321
987
I want a function executed manually yielding a random invoice no.
How can i achieve ?
Regards
Capri !!!Cannot reproduce. There must be some misunderstanding.
The selected invoices are just numbered and the required number of random positions is extracted.
Don't know how a valid position can contain a nonexisting invoice number as (valid I presume) invoice numbers were selected before being numbered.
I think the first version was a little unfair: The last invoice couldn't be extracted as dbms_random.value(low,high) can return low but cannot return high.
select invoice_no
from (select invoice_no,row_number() over (order by null) the_row
from invoices
where <your criteria here>
where the_row in (select trunc(dbms_random.value(1,(select count(*) + 1 from invoices)),0)
from dual
connect by level <= :how_many_to_draw
)Regards
Etbin
In my solution I overlooked the possibility that the same invoice could be extracted more than once. So better to follow Dave's suggestion and choose MichaelS's solution
with
invoices as
(select trunc(dbms_random.value(:lower_limit,:upper_limit),0) invoice_no
from dual
connect by level <= :number_of_rows
select invoice_no
from (select invoice_no
from invoices
-- where <your criteria here>
order by dbms_random.value
where rownum <= :how_manyMessage was edited by:
Etbin -
Urgent How to generate a random code such as registration code?
I would like to ask that how to generate a random code?
For example, when you register a E-mail account, you need to enter the code for activation. I would like to create a java Bean to do this job. Would you help me?In fact, I would like to set a 10 digi codes randomly (such as FH654CS081, MKO624VG9f) for user input when they register the forum account. This random code will be sent to the user's email. User have to input this code to a JSP web site. Also, the code which is inputed by user will be matched with the database. If user input success, the forum account will be activated.
By generating this 10 digi codes, I want to handle this generation by using java bean.
1) Any thing else i need to import ? (such as <% page import="java.......?")
2) Any functions can handle this task?
3) Any example can be my reference?
Thank you very much -
How Do I Generate Random Numbers in iWorks
Excel has the "F9" key to generate random numbers numbers don't
please see below what i'm trying to do
I open up a blank Excel worksheet, and type the number "1" into cell A1. Type the number "2" into cell A2. Then type the number "3" into cell A3. Type the number "4" into cell A4, and then type the number "5" into cell A5.
2
Type the word "PB" into cell A6.
3
Enter the function "=RANDBETWEEN(1,59)" into cell B1.
4
Enter an exact copy of this function "=RANDBETWEEN(1,59)" into cells B2, B3, B4, and B5.
5
Enter the function "=RANDBETWEEN(1,39)" into cell B6.
6
Hit the "F9" key to generate the random numbers simulating game.
But in numbers how do i do this?
Thanks!
Alex...firstly your not asking about generating random numbers, your asking how do you make a workbook recalculate new random numbers. From M$'s website:
F9
Calculates all worksheets in all open workbooks
It does not produce random numbers the equations should produce random numbers as soon as you enter them in. If they dont then you have automatic reclaculations turned off and F9 is forcing a recalc.
In numbers there is not shortcut to forcing the workbook to recalculate other than enter data into a cell. So if you made a new table and then enter data. For every data point you enter you should see new data apear.
Was just validating the method for forcing and its not working on my ipad. I will mark this conversation and if i find it i will respond again.
Jason
Message was edited by: jaxjason -
Generate multiple random numbers?
Hi,
I'm trying to generate random numbers using Math.random()* n;
but I want the random numbers to reset to something different after
a particular event is called. Instead, I've noticed the numbers
either buzz away randomly in every frame (when placed inside
onEnterFrame), or it picks random numbers once, and then uses those
same values over and over (when placed outside the onEnterFrame).
How do i get actionscript to generate new random numbers
after each myMC.onPress = function(), or alternatively, after a
score changes (like some kind of watch feature?)ok, i've got a half working version;
function ranbot(x) {
return Math.ceil(Math.random()* x) + "/" +
Math.ceil(Math.random()* x);
trace(ranbot(60));
but is it possible to set up the function so the numerator is
equal to or less than the denominator? Also, if the numerator is
set to never exceed the denominator, then a large percentage -
something like 25-50% of the output fractions would equal "1", like
55/55, 23/23, 7/7, 28/28, and so on.
I did something like this when using variables;
var randombot2:Number = Math.ceil(Math.random()* 99);
var randomtop2:Number = Math.min(randombot2 -
Math.floor(Math.random()* randombot2* 0.5),
Math.ceil(Math.random()* 99));
- but I do not understand how this works in function
terminology. -
How to generate a random number with at least 6 digits?
Hi all,
All is in the question. :-)
I would like to generate a random number but the function "random
number" in Labview isn't accurate enough.
Do you know an algorithm to generate a random number of 6 or more
digit?
Thanks,
PFHi PF,
It's simple. Use 2 random number functions in the same process. Now you
should have 2 distinct random numbers that have the same accuracy. Let's say
LV gives accuracy up to the thousandth (0.XXX), now if you divide one number
by 1000 and then add to the other number you should then have something like
0.XXXXXX. Actually, LV random number function can give up to about 17 digits
(decimal). If you are looking for more digits (>17 digits), the idea above
may not work, then the last thing you may want try is to generate two or
three random numbers then convert all these decimal numbers to fractional
strings chop off the 0 and dot then concatinate them together. After all
it's still a random number. How many digits do you want to get? Make sure
the indicators acce
pt that many digits?
Good luck
Louis.
P-F wrote in message
news:[email protected]..
> Hi all,
>
> All is in the question. :-)
>
> I would like to generate a random number but the function "random
> number" in Labview isn't accurate enough.
>
> Do you know an algorithm to generate a random number of 6 or more
> digit?
>
> Thanks,
>
> PF -
A function for generate a actual tree select
hi,
i tried to write a function that generate a actual tree select and i think this is very helpful
Create Or Replace Function Generate_Tree_Fun(p_Path Varchar2,
p_Delimiter Varchar2,
p_Level Integer,
p_Tbl_Name Varchar2,
p_Parent_Field Varchar2,
p_Child_Filed Varchar2)
Return Varchar2 Is
v_Txt Varchar2(5000) := '';
v_Row_Num Number;
v_Max_Count Number;
v_Child Varchar2(100);
v_Parent Varchar2(100);
v_Level Number := p_Level;
Begin
If (v_Level = 1) Then
Return '';
End If;
If (v_Level > 1) Then
v_Txt := '|' || Lpad('_', 6, '_');
End If;
If (v_Level > 2) Then
For i In 1 .. p_Level - 2 Loop
v_Level := v_Level - 1;
v_Child := Ltrim(Regexp_Replace(p_Path,
Ltrim(Replace(p_Path,
p_Delimiter,
')(' || p_Delimiter) || ')',
'\' || v_Level),
p_Delimiter);
Execute Immediate 'Select t.' || p_Parent_Field || '
From ' || p_Tbl_Name || ' t
Where t.' || p_Child_Filed || ' = :1'
Into v_Parent
Using v_Child;
Execute Immediate 'Select a, b From (Select Row_Number() Over(Order By t.' ||
p_Child_Filed ||
') a,Count(1) Over(Partition By t.' ||
p_Parent_Field || ') b,t.' || p_Child_Filed ||
',t.' || p_Parent_Field || ' From ' || p_Tbl_Name ||
' t Where t.' || p_Parent_Field ||
' = :1 Order By t.' || p_Child_Filed || ') Where ' ||
p_Child_Filed || ' = :2 '
Into v_Row_Num, v_Max_Count
Using v_Parent, v_Child;
If (v_Row_Num <> v_Max_Count) Then
v_Txt := Rpad('|', 20, ' ') || v_Txt;
Else
v_Txt := Rpad(' ', 20, ' ') || v_Txt;
End If;
End Loop;
End If;
Return v_Txt;
End;
select Generate_Tree_Fun(sys_connect_by_path(e.empno,','),',',level,'emp','mgr','empno') || e.ename
from emp e
start with mgr is null
connect by e.mgr=prior e.empno
enjoy itArash wrote:
hi,
i tried to write a function that generate a actual tree select and i think this is very helpful
We are so proud of you! -
How to generate n random dates
Can anyone help me in generating Random dates, i want to generate 100 random dates in yyyy-mm-dd format.
I've tried this, but will appreciate any neat solutions...
public static void main(String arg[]) {
int no = 0;
while (no < 100) {
// Year
int yylower = 1970; // your lower integer value
int yyupper = 2000; // the larger one of your two integers
double rand = Math.random();
int yyresult = yylower + (int) ( (yyupper - yylower) * rand);
// Month
int mmlower = 1; // your lower integer value
int mmupper = 12; // the larger one of your two integers
rand = Math.random();
int mmresult = mmlower + (int) ( (mmupper - mmlower) * rand);
// Month
int ddlower = 1; // your lower integer value
int ddupper = 29; // the larger one of your two integers
rand = Math.random();
int ddresult = ddlower + (int) ( (ddupper - ddlower) * rand);
System.out.println(yyresult + "-" + mmresult + "-" + ddresult);
no++;
} -
How to generate pseudo random noise(PRN) binary sequence using shift registers?
what is the block diagram to generate pseudo random noise (PRN) binary sequence of 1's and 0's using shift registers
please help
i need 2 submit this project in this weekThis is a fairly simple homework problem. My hints (on the LabVIEW side):
1- look at while loops
2- look at shift registers on while loops with multiple input elements
3-look at the logic components, AND, OR XOR
Look at this wiki article: http://en.wikipedia.org/wiki/Linear_feedback_shift_register
Do the work, you won't learn if someone shows you how it is done! The palette that the previous post points to are of PRN and other "noise generators" but I suspect that is not what you are after.
Know that creating a PRN with a reasonable number of shift register taps produces very pseudo results, as the "random" pattern begins to repeat pretty quickly, thereby making it not a truly random number.
When you have an attempt that is sort of working and want additional suggestions, post the code here. We won't do your work, we will help you try to do it, and learn it, yourself.
Putnam
Certified LabVIEW Developer
Senior Test Engineer
Currently using LV 6.1-LabVIEW 2012, RT8.5
LabVIEW Champion -
How to generate n random dates between 2 time periods
Hi,
I'm trying to write a method that generates n random dates between 2
time periods. For example, lets say I want to generate n random dates
between Jan 1 2003 and Jan 15 2003. I'm not sure how to go about
doing the random date generation. Can someone provide some direction
on how to do this?
The method signature should look like this.
public String[] generateRandomDates(String date1,String date2,int n){
// date1 and date2 come in the format of mmddyyyyhh24miss.
// n is the number of random dates to generate.
return dateArray;
Thanks.
Peterfirst take a look at the API concerning a source of randomness (Random might be a good guess), then take a look at stuff concerning dates (Date might be cool, maybe you will find some links from there).
Who wrote this stupid assignment? -
Overriding method to generate a random radius
So I'm working on this small homework assignment for my Computer Science course. What I'm supposed to be doing here is overriding my drawCircle to provide a radius for my circle between 10 - 100. Anyway I've figured out some of what I need, but I'm having an issue generating the random number. Any insight would be helpful.
public class MyCircle {
public MyCircle(){
double radius;
// == Page 365, EX 6.6
public void drawCircle(Graphics g, int x, int y, int radius, Color color){
int x1 = x - radius;
int y1 = y - radius;
int side = 2 * radius;
g.setColor(color);
g.drawOval(x, y, side, side);
// == Page 365, EX 6.7
public void drawCircle(Graphics g, int x, int y, int radius){
//int x1 = x - radius;
//int y1 = y - radius;
//int side = 2 * radius;
//g.setColor(Color.green);
//g.drawOval(x, y, side, side);
drawCircle(g, x, y, radius, Color.green);
public void drawCircle(Graphics g, int x, int y){
radius = (int)Math.random();
int x1 = x - (int)radius;
int y1 = y = (int)radius;
int side = 2 * (int)radius;
g.setColor(Color.WHITE);
g.drawOval(x, y, side, side);
}So as you can seeim using Math.radius to try and do this but it only provides a number between 0.0 and 1.0.Thanks for the input guys I got it to work, and it might be a little more then what I may have to do to get it to work, but its the only way I could figure it out at this point.
public void drawCircle(Graphics g, int x, int y, Color color){
// Creates a Random number generater that Generates values from 10 - 100
Random generator = new Random();
double radius = generator.nextDouble() * 60 + 10;
int x1 = x - (int)radius;
int y1 = y = (int)radius;
int side = 2 * (int)radius;
g.setColor(color);
g.drawOval(x, y, side, side);
} -
How do I generate a random String
Hi, there is probably a very simple answer to this question, but nevertheless....
Is there a class I can use which will allow me to generate a random String of any length?
Many thanks.depending on which chars you want to use for the String, sometimes it is more handy to use a char[], something like
publc static final char[] CASE_SENSITIVE_ALPHNUM = {'a', ...., 'A',....'1',...};//for alphamumeric case sensitive chars
public static final char[] CASE_INSENSITIVE_ALPH = {"a", ....,'z'};
public String randString(int length, char[] charset) {
StringBuffer sBuf = new StringBuffer();
for (int i = 0; i < length; i++ ) {
sBuf.append(charset[(int)(Math.random() * charset.length)] )
return sBuf.toString(); -
ABAP Function Module generator
Hi,
I wonder if there is a ABAP Function Module generator for inbound and outbound adapter data. Can I generate a function module in XI to trigger a adapter.
regards,
RichardHi,
There is no tool to "generate" RFCs. You will have to use SE37 to create the RFCs as always.
For outbound RFC, you will need only to define the interfaces, e.g. IMPORT, EXPORT, TABLES. No ABAP code is required. Then, just populate the parameters and send to XI.
For inbound RFC, you can develop the RFC to do whatever it needs to do in ABAP.
In the IR of XI, you can import the RFC's meta data.
Regards,
Bill -
How to generate a random session variable in php
i want to generate a random session variable and insert the variable in a mysql record to use later to validate an account set up.
person fills out form to create account and submits; inserts form information in mysql record.
i want the random variable to be inserted from a hidden field and the page sends an email with a link to click on to compare the variable to validate the user.
Not sure how to generate a random session variable and get that to the hidden field value to be inserted with the other form information.
thanks for your help,
Jim BalthropTo insert the key I would personally do something like...
$key = md5($username . $password . $salt);
Insert that into your MySQL database, then send them a email with it, my next code shows how to activate it.
This is to activate the account.
<?php
$key;
$errors = array();
if(isset($_GET['key']){
$key = $_GET['key'];
$sql = 'SELECT * FROM users WHERE key = \'' . $key '\' LIMIT 1';
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result)){
$sql2 = 'UPDATE users SET active = 1 WHERE key = \'' . $key '\' LIMIT 1';
$result2 = mysql_query($sql2) or die(mysql_error());
if($result2){
//successfully activated account
else{
//Something Went Wrong!
else{
$errors[] = 'Invaild Key, Please try again!';
else{
$errors[] = 'Invaild Key, Please try again!';
?> -
Generating a random include file
I'm trying to generate a random "include" file in an HTML web page. I have a group of 20 files, each with one sentence, and I'd like to randomly call one of those files into my web page, using a statement like
<!--include virtual = "includes/file1.inc" -->
Is there a way to use Javascript to generate that line of code, but make the number just before ".inc" be randomly entered?
Thanks in advance.
BobWell, dynamically formed file name for include is not possible in javasript. Includes are processed before any javascript runs on the page.
But
You can do this if you keep the lines in the HTML file:
<SCRIPT LANGUAGE="JavaScript">
lines = new Array;
lines[1] = "Well, some things in Javascript are not cool";
lines[2] = "Sometimes Javascript is cool";
lines[3] = "Ok, I am getting tired of typing now";
lines[4] = "But then again, who is worried";
lines[5] = "A random line can be shown";
var total = 5;
var randomNumber = Math.random();
var idx = Math.round( (total-1) * randomNumber) + 1;
document.write(lines[idx]);
</SCRIPT>
Maybe you are looking for
-
Two iTunes libraries one MacBook Pro account...
How do you make two itunes libraries on one macbook account? I've heard it's possible for PC so it should be for a Mac... If this topic has already been discussed sorry for the inconvenience...
-
Does elements use plug ins?
I have a macbook pro & snow leopard. I bought a sony snap lab to print action photos at sports events. The background template needs to go through this plug in specific for the snap lab. So my husband has a pc. I was just going to buy the cheapest PS
-
I have been having a hard time figuring out where to fix this mouse down problem. On this new site magbacker.com, when you click the left navigation text the text gets smaller. I have a separate css style sheet called "sprymenubarvertical2.css" and a
-
Puchased items in my watchtime app will not restore to my ipad (1) after an ipad restore. The items appear ready for purchase. how can i restore the items.
-
Hi, I did the below configuration in Project Management and even after Accounting Tab is invisible. In Project Management 1. Activated Account Integration in the Project type and selected Flagged to Transfer 2. Selected object type OFIN_INT_ERP_PS 3.