Generate random string ABAP

Does anyone have sample code to generate a random string of 12 characters?
Urgently needed.
Thanks very much for any replies.

You could generate a random number between 1 and 999999999999 (see RUTRANDU program). Then you could convert each position in the number to a corresponding character. 0 = A, 1 = B, etc.
Hope it helps
Regards

Similar Messages

  • How to generate random strings

    Gday all,
    So I have to create a simple guessing game where the user guesses a 3 letter string that is randomly generated:
    "For each new game your program will generate three unique random numbers between 0 and 9
    inclusive, and convert them into a String of three characters in the range A to J. This String will be an
    input to a game, where the user tries to guess the correct letters in the correct order. Examples of valid
    input Strings would be, �JAD�, �ABC�, �IBE� and �EFG�. Examples of some invalid input Strings could be
    �abc�, �AAA�, �123�, �AdE� or �NME�."
    Just wondering how to create this random string? I know how to generate a random 3 char number (num = (int) (Math.random() * 1000)) but I dont know how to convert this into a corresponding string, as the instructions say.
    I know this is very basic, but any tips?

    I know how to generate a random 3 char number (num = (int) (Math.random() * 1000)) but I dont know how to convert this into a corresponding stringUse string concatenation (+ with one or two String operands).
    int i = 42;
    char ch1 = '*';
    char ch2 = '!';
    String str = "foo";
        // the System.out.println() is not important
        // in each case a string is being created and printed
    System.out.println("" + i);
    System.out.println("2 times i = " + (2 * i));
    System.out.println(i + "*2=" + (2 * i));
    System.out.println("" + ch1 + ch2); // hint, hint
    System.out.println(1 + 2 + "???");
    System.out.println("???" + 1 + 2);

  • Generating random String

    Hi My randomString() method is generating junk character, I know this is due to some character set problem .I have not handeled properly the generation of randomCharacter.Please help.
    package javaProg.completeReferance;
    import java.util.*;
    import javaProg.completeReferance.*;
    public class TestMap
         public static void main(String [] args)
               Map m= new HashMap();
               System.out.println("The Size of the Map is "+m.size());
               fillMap(m,12);
               System.out.println("The Size of the Map after fillMap Method is "+m.size());
               ArrayList1.space("");
               Collection c = m.entrySet();
               Iterator i=c.iterator();
               displayMap(i);
         public static void fillMap(Map map,int number)
              for(int i=1;i<=number;i++)
              map.put(nextString(5),((int)(Math.random()*500)));
         public static void displayMap(Iterator i)
               while (i.hasNext())
                    Map.Entry m= ((Map.Entry) i.next());
                    System.out.print(m.getKey()+"    "+m.getValue());
                    System.out.println();
         public static String nextString(int length)
              int randomInt=0;
              char randomChar=' ';
              StringBuffer randomString = new StringBuffer("");
              for(int i=1;i<=length;i++)
                randomInt = ((int)(5+Math.random()*500));
                randomChar = (char) randomInt;
                randomString.append(randomChar);
              return (randomString.toString()).trim();
    }

    Hi It still shows juck character, below is the sample output.
    We are using
    t?O%q 298
    ?W?8! 424
    pR*fz 12
    ]5dA? 310
    Ek?7? 466
    /@JYL 313
    UNY 262
    (&#8962;%3? 25
    ?z,?? 98
    ????q 414
    V?0s? 370
    ?_?oo 91

  • Generating random string not like - example

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    Hi,
    I want to generate a random one char string of which is not like a char.
    select str from (select DBMS_RANDOM.STRING('U',1) str from dual) where str!='A';
    some times i am getting NULL. How can i get some char all the time? i want to create a function using this logic. can some one help me to achieve this?
    Thanks,
    sg

    One more way to do this... (Without function)
    WITH t AS (SELECT 'X' charac FROM DUAL)  --- 'X' is the  input
    SELECT COLUMN_VALUE letter
      FROM (  SELECT *
                FROM t a,
                     TABLE (sys.odcivarchar2list ('A',
                                                  'B',
                                                  'C',
                                                  'D',
                                                  'E',
                                                  'F',
                                                  'G',
                                                  'H',
                                                  'I',
                                                  'J',
                                                  'K',
                                                  'L',
                                                  'M',
                                                  'N',
                                                  'O',
                                                  'P',
                                                  'Q',
                                                  'R',
                                                  'S',
                                                  'T',
                                                  'U',
                                                  'V',
                                                  'W',
                                                  'X',
                                                  'Y',
                                                  'Z')) b
               WHERE COLUMN_VALUE <> a.charac
            ORDER BY DBMS_RANDOM.VALUE ())
    WHERE ROWNUM = 1;
    Cheers,
    Manik.

  • Genarating random strings?

    could someone please tell me if this code will generate a 'b' and a 'w'
    if i tell it too. and how do i make it 5 characters long. And its says
    this is how you call it and i dont have a clue what that means. and when
    you answer this please dont use techincal terms cause im just learning
    and i probaly wont have a clue what your talking about. thankyou.
    <?php
    // function to generate random strings
    function RandomString($length=32)
    $randstr='';
    srand((double)microtime()*1000000);
    //our array add all letters and numbers if you wish
    $chars = array ( 'a','b','c','d','e','f');
    for ($rand = 0; $rand <= $length; $rand++)
    $random = rand(0, count($chars) -1);
    $randstr .= $chars[$random];
    return $randstr;
    ?>
    and call it like this
    <?php
    echo RandomString(8);
    ?>
    Example
    ebbfbcbae

    Well, first of all this is PHP code and not Java. And I am not sure but I don't think it's possible to call PHP functions in Java Code (the otehr way around it should be working though, at least with the Java Extension for PHP). So, if you are writing a Java programm, you will probably have to translate this code piece to Java.
    Second. It will do what you want it to do - given you make a few modifications. You will have to change the line
    $chars = array ( 'a','b','c','d','e','f');
    to
    $chars = array ( 'b','w');
    as these are the characters you want. And you will have to call the function like this
    echo RandomString(5);
    if you want a string with five letters.
    I don't know how much this will help you, since this code is PHP and written procedural and not object-orientented as you have to write Java in, and the translation to Java might not be that easy if you don't know much about Java.

  • 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();

  • HOW TO GENERATE RANDOM MEANINGFUL STRINGS ?

    Friends,
    How do I generate random meningfull strings ? I know how to generate strings randomly but I want to generate meaningfull names. The length is not important. Please help me in this matter as I have to implement this soon.
    Thanks in advance
    Ankit.

    Thanks for reply,
    I want to generate any string randomly and also want to make sure that it is meaningfull name. I can use Random(0n class to generate random number then convert according to ascii table to char and concat these generated chars to have string but then it is not meaningfull string, it could be anything. I want the string to be meaningfull too.(any word or name in english language). I don't want to pick up already generated word or names from list randomly(i think this is what you are thinking)

  • How to create a javabean that generate random password?

    May i know how to create a javabean that can generate random password?
    that include character and string
    and length of 10.

    i created a class file for my java bean
    package autogenerate;
    import java.util.*;
    public class GeneratePwId
    private int MemId;
    private String Passwd;
    public GeneratePwId(){}
    public String getPasswd()
    return this.Passwd;
    public void setPasswd()
    char[] letters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
    'J', 'K', 'L', 'M', 'N', 'P', 'R', 'T',
    'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c',
    'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
    'm', 'n', 'p', 'q', 'r', 's', 't', 'u',
    'v', 'w', 'x', 'y', 'z', '0', '1', '2',
    '3', '4', '5', '6', '7', '8', '9' } ;
    String pwd = "" ;
    while( pwd.length() < 10 )
    pwd += letters[ (int)( Math.random() * letters.length ) ] ;
    this.Passwd = pwd;
    i successfully compile my java file. and try to test it by writing a jsp file.
    here is my jsp code
    <html>
    <head>
    <title>
    Try retrieving password
    </title>
    </head>
    <body>
    <jsp:useBean class"autogenerate.GeneratePwId" id="bean0" scope="page"/>
    <%=bean0.getPasswd()%>
    </body>
    </html>
    but i encounter this error
    org.apache.jasper.compiler.ParseException: /jsp/GetPasswd.jsp(7,18) Attribute class has no value
    anyone can teach me how to solve this problem?
    thanks a alot!

  • Generate random number and letter in a text field ...

    Hi All,
    I having a bit trouble when trying to generate random number and letter in application express in a text field. Say I have a licence form and when user wants to create a licence, it will provide a random licence number in the licence number field but it has to be unique. the number should be something like HQ2345. I was trying to set the following sql in default value for that text field but it is not working -
    select DBMS_RANDOM.STRING('',2) || trunc(DBMS_RANDOM.VALUE(1000,9999))
    from dual;
    any suggesion !!!!
    thanks

    Put this as default value for your text-item
    DBMS_RANDOM.STRING('',2) || trunc(DBMS_RANDOM.VALUE(1000,9999))
    with type PL/SQL Expression. It have tested it and it works fine.
    DickDral

  • Generating random numbers, while excluding some numbers

    I want to generate random numbers between 1 and 13 (including 1 and 13), while excluding numbers 6 and 9
    Please tell me theres an easy fix to this issue --

    lemme know if it compiles
    import java.util.*;
    public class RandomNumber {
    public static void main( String[] args) {
    int numWins = 0;
    for( int i = 1; i < 101; i++) {
    boolean x = true, y = true;
    int number = 0;
    while(!x && !y && number != 6 && number != 9)
    number = 1 + (int) (Math.random() % 13);
    x = number >= 1;
    y = number <= 13;
    int number2 = 0;
    while(!x && !y && number2 != 6 && number2 != 9)
    number2 = 1 + (int) (Math.random() % 13);
    x = number2 >= 1;
    y = number2 <= 13;
    int number3 = 0;
    while(!x && !y && number3 != 6 && number3 != 9)
    number3 = 1 + (int) (Math.random() % 13);
    x = number3 >= 1;
    y = number3 <= 13;
    int number4 = 0;
    while(!x && !y && number4 != 6 && number4 != 9)
    number4 = 1 + (int) (Math.random() % 13);
    x = number4 >= 1;
    y = number4 <= 13;
    int DrawAgain = 2;
    if (number == DrawAgain) {
    System.out.println( "A Random number between 1 and 10: " + number);
    System.out.println( "A second Random number between 1 and 10: " + number2);
    if (number2 == 8) {
    System.out.println( " Piece made it home successfully");
    numWins++;
    if (number2 == DrawAgain) {
    System.out.println( "A third Random number between 1 and 10: " + number3);
    if (number2 == 7) {
    System.out.println( " Piece made it home successfully");
    numWins++;
    if (number3 == DrawAgain) {
    if (number4 == 7)
    System.out.println( " Piece made it home successfully");
    numWins++;
    else {
    System.out.println( "A Random number between 1 and 10: " + number);
    if (number == 10) {
    System.out.println( " Piece made it home successfully");
    numWins++;
    System.out.println(" Number of times piece made it home successfully " + numWins);
    }

  • Need help with codings on generating random words

    hi guys.. i need help with generating random words from a list of array. please help me with the codings.. let me know the other variables that are needed if required as well.. thanks a million..
    private String wordList[] = { "abstraction", "command", "arithmetic", "backslash" };

    Hi,
    You can use the Random class to generate Random number between 0 to the array length and use the generated random number as index in to the Strign array.
    To generate Random number use the following code
    Random r = new Random();
    num = ((r.nextInt() >>> 1) % wordList.length);
    num will have the randomly generated number.

  • How can I generate random password

    Hello...
    I use oracle 10g for windows,,,I have an employee table , there are a lot of colunms , their names are employee_name , employee_id ,employee_pass .....
    employee_pass colunm is empty
    I want to generate random password for employee_pass colunm
    How can I generate random password for employee_pass colunm
    thanks
    omer faruk akyuzlu
    in Turkey

    SQL>  exec dbms_random.seed(to_char(sysdate, 'sssss'))
    PL/SQL procedure successfully completed.
    SQL> select dbms_random.string('X', 8) from dual
      2  /
    DBMS_RANDOM.STRING('X',8)
    4YT1H150
    SQL> select dbms_random.string('X', 8) from dual
      2  /
    DBMS_RANDOM.STRING('X',8)
    WIA3QCIP
    SQL> Please be aware that storing the actual passwords in a the EMPLOYEES table is a very bad idea. Oracle has a pretty good password implementation. It's not perfect but it's a darn site better than hand-rolling our own.
    Cheers, APC

  • When accessing certain websites, I am met with a random string of characters in the browser window. What could be causing this?

    When trying to access certain websites, http://redditenhancementsuite.com/ or http://www.channel4.com/programmes/the- ... od#3293733 for example, all I get is a random string of characters in my browser window like the following:
    ‹­XmoÛ6þ>`ÿáª/Ý€ZÊËú²Í6Ð%ÍZ¬íŠ&A±O%щTI*®‡ýø='J¶”8^†._L‰wÇ{yîá)ÓG§¿Ÿ\üñᜟx÷vþí7ÓÂWeû+Eο•ô‚ ïë‰üÜš›YtbŽ—ÚO.ÖµŒ(O³ÈË/>aåŸ)+„uÒÏ¿˜ŒˆØˆWŸ”ó2Ï•§Wº:“ŒÐy£Œœ&a‚¥Ò×de9‹œ_—ÒRúˆ<ŽêNÈœ‹š°r1‹¬t1?Îÿ›Z$kœ7ÕÄp#¹úÜH»ž4jr¿ˆŸÅa7‡S.³ªöC/®Äo#r6›Eœ Ÿ’$3¹Œƒ¹83Uoù0~WJÇWpvšExý»É•ëÜqïŽÅ‡¹º5/Y–r"Ž(×^enìàÃÍUâ+ƒ‹ÆVwNOŠ€A8’š| aÅï€Åšhš«›v%0Ú‚"A†UµUQ•XJ—”fiâZ/#Z©Ü³èèé@$Õ²ðxx—¹YÄ‚\!qÛjmMÌØÞa<õzÂÛ#ûÇ°ÙÛçug²ìà„i"˜¶‘¶Q!B-BTÓ†‘ð‡¶˜"ìÍeµh¢hþÚTh"Ï!žC%7+]‘‡zua­YEóÓnsŸ…Ÿá~I8ë÷©@z²ºWùøêœÎðžOe›å_ !Qûds“5Ì Â+£;·N‡ïö)‹Zu*/?ŒÙ'˜¬Ôµÿ»ŸEŠ¥Ð×ÑüÞîS©i|¯GÂÓ€-ì4 …fL/­iêŸ.®(óf€xÿŸ+BØÀVq8ç¬þÄÇ€gŒí°OЄÀ¿Ò©¥–9žœÒKÇüíL œ rz鳊,ךPý%ÒRR.\‘aóâçMÊ|–Jò†rå èPòèK‘£îwxg¬€…*œŽp…LÍ¥Ü%xYçÂÃé÷òFZ\9‹‡Ëd‡ÙSÕ¥ôÎÛmÀ—šóƃ®ÜZˆ¶§ŽÝ]’yÁíuOçcwÜùÏÜvþ‹£™ ×ûR"NN4¿‰Cýz&xšK¿ uŒÜãVÚm|;<ÌÛ;ošÔœ="" ò1êgôt;®]ôÍ+ÐÖ1]:0ªŒ‘ÛpJç;G †ÑÆ«…‚%€‚広ÜȲ6T rawpgYàÜñ•9J†ˆ®‘›“vŒ€Ó-_ö›”5S˜©cw\%Ê~bÞE Ñ#@8BšrÔ8DGN°fLï'¡×S誇#gCÑ1+žU0óàòŒLÀG‰Ë‡Ó5Á‚äºMËöÌ'H*ŸŽ…š®‹ZT„)¹‘­ûˆ.P%£îRU*\Äp?dÚÏ^J‡ëù«Áˆ‚õ7ù0™ÝØvJ2€­—倕:)*Î.œUºODÈïškÙ˜rú±§+TS#òÜè Zñ1£Ûš”ß—br|‹F·”òókºB’j‘]£\mMR¢XŠì\ãðÿožËJ42“9ÞÍùþèoCÁí¢·ÁÁcÐX·ÃóæîK¶C$ý}ï8šGr·žål0 ŽäöL…#¹]£àHàAóßHãÎÐ7Úý—Io${ÏxÇùçaÎRÒç—ñ„P–VTøZ[RºÞŽÝ'ãjµŠ|x@UÖø€5Õ݉óÜcö¡s“JÜVbNßm*70Ý~x‚3l24͇Olã{º|ƒ;•ÂûüÊ…V²Ìōʙ¡ônßN[)zÉwS§ÊÁÌâãÕø¹u°ŠŠÉµÈoÒ}‚¿*þò—ÔTÄ
    The characters change depending on the website. I've tried disabling all extensions and plugins, reinstalling firefox and reinstalling java to no avail. The issue seems to be isolated to firefox, chrome is able to display the webpages without a problem. The problem occures following a malware in infection which would redirect goolgle searches in firefox. It was dealt with using Malwarebytes Anti-malware and by removing some entries from C:\WINDOWS\system32\drivers\etc\hosts file.

    Hi,
    I tried everything above but to no avail. Windows firewall seemed to be allowing Firefox through without it actually being in the exception list. However, I did remove Firefox but this time removing all profile data too. Reinstalling Firefox seemed to make the websites work. However I then restored my bookmarks, and suddenly the websites stopped functioning again, displaying the random string of characters. Could this be an issue with my bookmarks?

  • How do you generate random data info using json and spry?

    I have a mobile applicaton that uses spry datasets that dynamically populate a jquery mobile listview by using a json file. Everything is operating as it should.
    However, I would like to understand how to pull random objects from the json file to have them displayed on a different page.
    My json file is standard and not complicated. It has several levels. Each is represented as below:
                                  { "Level1":
                                                                {"imageurl":"images/_myimage.png",
                                                                "someData":"S,A,P,R",
                                                                "levelLongDesc":"further description",
                                                                "name": "John Doe",
                                                                "page": "referencepage",
                                                                "description":"The description of the image"
    {"imageurl":"images/_myimage.png",
      "someData":"S,A,P,R",
      "levelLongDesc":"further description",
      "name": "John Doe",
      "page": "referencepage",
      "description":"The description of the image"
    Json file Level1 has about 70 objects
    What I would like to do is randomly load one of the Level1 object arrays into the page when the user selects a Level 1 radio button that is on the screen. I know how to create the page, radio buttons and basics, but just don't know how to pull in the random data.
    I've found one code sample on this site that speaks to spry and xml, but I haven't been able to apply it in any way that works for me with the json file:
    http://forums.adobe.com/message/662551
    I've also googled. There isn't much on spry datasets with json and generating random info. There was a little bit on sorting, but that didn't help either.
    Does anyone have a good example/tutorial of how to use the random function with spry/json?
    TIA
    -Rachel

    I've done similar things before.  A few thoughts for you:
    1. I'm assuming you're doing a buffered period or frequency measurement on the incoming encoder pulses, right?  First key point is that you'll have data that is spaced equally in position, but not equally in time.  If you are looking for a time-based FFT such that increasing speed will shift your spectrum, you're going to need to go through an interpolation process to resample your data as though equally-spaced in in time. 
    2. Your 149 pulse per rev encoder may be a significant source of error unless its 149 pulses are placed with extreme accuracy.  Any error in pulse placement violates your underlying assumption of data that is equally-spaced in position.  It'll be very helpful to send your data through a software lowpass filter to attenuate those artifacts. 
    3. I am not sure what you mean by "decompose the buffered data (array) into a single datastream."  You'll get an array of periods / frequencies from the call to DAQmx Read.  If you want to use it in a LabVIEW waveform datatype, you'll first need to do the resampling to create equally-spaced-in-time data.  The LabVIEW waveform datatype (and all the analysis functions like FFT that use it) depend on receiving data with a fixed constant time interval between samples.
    -Kevin P.

  • Table maintenance generator in webdypro abap

    Hi Experts,
    Please can you suggest how to implemnt Table maintenance generator in webdypro abap.
    Regards,
    BBC

    Hi,
    Thanks for your inputs,
    Now I have included add, modify, delete and save functionalities to ALV table.
    Here What I did, fist it shows the list of records from data base table with ALV table as ready only mode.
    Then
    If we click on add button then last row will add with editable mode,
    If we select a row and click on modify button then in that row fourth field only editable (because first three are primary key fields).
    If we select row and click on delete then record deleted and updated in database table.
    If click on save button, it captures the modified ones then saved.
    if we test individual functionality, it is working fine.
    If we do fist add functionality then after saving if we click on modify row then it is showing total row as in editable mode.
    Here as per modify fyctionlaity in that row fourth field only have to show editable.
    Please can you suggest how to resolve this issue?
    Regards,
    BBC
    Edited by: BBC Achari on Sep 7, 2011 9:23 AM

Maybe you are looking for

  • Create Sales Order with Open item Quantity

    Hi, I would like to ask how can I create an inquiry which will have a record also created in table VBBE. For example. When I create an inquiry, a corresponding record will be created in table VBAK, but I found out that not all inquires will get a rec

  • How do I create a folder in mail?

    How do I create a folder within a mail account?

  • Look at the wired error!

    Look at the following code(about XML parsing but it does not matter with the error): Element header = (Element) document.createElement("WfMessageHeader"); if (msg.isResponse) Element requestOrResponse = (Element) document.createElement("Response"); e

  • Update problems with Adobe Flash Player preinstalled via Chrome. Can any one help?

    Dears, I am using the Chrome and it says it has installed the Adobe Flash Player and the auto updater. I selected to be advised every time an update is available, before it gets installed. During the start up of my Windows system (i.e. the "autoexec"

  • Setting up different webservices based on port number

    I have several different web services set up on different port numbers, but would like to access them based on the sub domain instead of the port number. for instance we have Rumpus ftp running on port 8000 webmail running on port 82 wiki running on