Creating random lines

Hey, I need help in creating an applet that generates randomly placed lines and I've tried with the for-expression and all I get is symmetrical lines that change their direction when I open up Applet Viewer. Could someone please help, I've been stuck with this for the last three hours.

Oh and I don't want anyone to write the code ready for me, I just need to know what to do to get the lines to be random. I used the mathRandom values combined with the for-expression. I'll copy and paste the code I've written here, maybe someone could tell me what I'm doing wrong :(
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class m2t3 extends Applet {
public void paint(Graphics g) {
int i;
int luku;
luku = (int) (Math.random() *21)+10;
int luku2;
luku2 = (int) (Math.random()*10)+1;
int luku3;
luku3 = (int) (Math.random()*27)+12;
int luku4;
luku4 = (int) (Math.random()*13)+2;
for (i=1; i<=100;i++) {
g.drawLine(i*luku4,i*luku3,i*luku,i*luku2);
I'm sorry if this isn't allowed! I just didn't know what else to do

Similar Messages

  • Reading a Random Line from a Text File

    Hello,
    I have a program that reads from a text file words. I currently have a text file around 800KB of words. The problem is, if I try to load this into an arraylist so I can use it in my application, it takes wayy long to load. I was wondering if there was a way to just read a random line from the text file.
    Here is my code, and the text file that the program reads from is called 'wordFile'
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    public class WordColor extends JFrame{
         public WordColor(){
              super("WordColor");
              setSize(1000,500);
              setVisible(true);
              add(new WordPanel());
         public static void main(String[]r){
              JFrame f = new WordColor();
    class WordPanel extends JPanel implements KeyListener{
         private Graphics2D pane;
         private Image img;
         private char[]characterList;
         private CharacterPosition[]positions;
         private int charcounter = 0;
         private String initialWord;
         private File wordFile = new File("C:\\Documents and Settings\\My Documents\\Java\\projects\\WordColorWords.txt");
         private FontMetrics fm;
         private javax.swing.Timer timer;
         public final static int START = 20;
         public final static int delay = 10;
         public final static int BOTTOMLINE = 375;
         public final static int buffer = 15;
         public final static int distance = 4;
         public final static Color[] colors = new Color[]{Color.red,Color.blue,Color.green,Color.yellow,Color.cyan,
                                                                          Color.magenta,Color.orange,Color.pink};
         public static String[] words;
         public static int descent;
         public static int YAXIS = 75;
         public static int SIZE = 72;
         public WordPanel(){
              words = readWords();
              setLayout(new BorderLayout());
              initialWord = getWord();
              characterList = new char[initialWord.length()];
              for (int i=0; i<initialWord.length();i++){
                   characterList[i] = initialWord.charAt(i);
              setFocusable(true);
              addKeyListener(this);
              timer = new javax.swing.Timer(delay,new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        YAXIS += 1;
                        drawWords();
                        if (YAXIS + descent - buffer >= BOTTOMLINE) lose();
                        if (allColorsOn()) win();
         public void paintComponent(Graphics g){
              super.paintComponent(g);
              if (img == null){
                   img = createImage(getWidth(),getHeight());
                   pane = (Graphics2D)img.getGraphics();
                   pane.setColor(Color.white);
                   pane.fillRect(0,0,getWidth(),getHeight());
                   pane.setFont(new Font("Arial",Font.BOLD,SIZE));
                   pane.setColor(Color.black);
                   drawThickLine(pane,getWidth(),5);
                   fm = g.getFontMetrics(new Font("Arial",Font.BOLD,SIZE));
                   descent = fm.getDescent();
                   distributePositions();
                   drawWords();
                   timer.start();
              g.drawImage(img,0,0,this);
         private void distributePositions(){
              int xaxis = START;
              positions = new CharacterPosition[characterList.length];
              int counter = 0;
              for (char c: characterList){
                   CharacterPosition cp = new CharacterPosition(c,xaxis, Color.black);
                   positions[counter] = cp;
                   counter++;
                   xaxis += fm.charWidth(c)+distance;
         private void drawThickLine(Graphics2D pane, int width, int thickness){
              pane.setColor(Color.black);
              for (int j = BOTTOMLINE;j<BOTTOMLINE+1+thickness;j++){
                   pane.drawLine(0,j,width,j);
         private void drawWords(){
              pane.setColor(Color.white);
              pane.fillRect(0,0,getWidth(),getHeight());
              drawThickLine(pane,getWidth(),5);
              for (CharacterPosition cp: positions){
                   int x = cp.getX();
                   char print = cp.getChar();
                   pane.setColor(cp.getColor());
                   pane.drawString(""+print,x,YAXIS);
              repaint();
         private boolean allColorsOn(){
              for (CharacterPosition cp: positions){
                   if (cp.getColor() == Color.black) return false;
              return true;
         private Color randomColor(){
              int rand = (int)(Math.random()*colors.length);
              return colors[rand];
         private void restart(){
              charcounter = 0;
              for (CharacterPosition cp: positions){
                   cp.setColor(Color.black);
         private void win(){
              timer.stop();
              newWord();
         private void newWord(){
              pane.setColor(Color.white);
              pane.fillRect(0,0,getWidth(),getHeight());
              repaint();
              drawThickLine(pane,getWidth(),5);
              YAXIS = 75;
              initialWord = getWord();
              characterList = new char[initialWord.length()];
              for (int i=0; i<initialWord.length();i++){
                   characterList[i] = initialWord.charAt(i);
              distributePositions();
              charcounter = 0;
              drawWords();
              timer.start();
         private void lose(){
              timer.stop();
              pane.setColor(Color.white);
              pane.fillRect(0,0,getWidth(),getHeight());
              pane.setColor(Color.red);
              pane.drawString("Sorry, You Lose!",50,150);
              repaint();
              removeKeyListener(this);
              final JPanel p1 = new JPanel();
              JButton again = new JButton("Play Again?");
              p1.add(again);
              add(p1,"South");
              p1.setBackground(Color.white);
              validate();
              again.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        remove(p1);
                        addKeyListener(WordPanel.this);
                        newWord();
         private String getWord(){
              int rand = (int)(Math.random()*words.length);
              return words[rand];
         private String[] readWords(){
              ArrayList<String> arr = new ArrayList<String>();
              try{
                   BufferedReader buff = new BufferedReader(new FileReader(wordFile));
                   try{
                        String line = null;
                        while (( line = buff.readLine()) != null){
                             line = line.toUpperCase();
                             arr.add(line);
                   finally{
                        buff.close();
              catch(Exception e){e.printStackTrace();}
              Object[] objects = arr.toArray();
              String[] words = new String[objects.length];
              int count = 0;
              for (Object o: objects){
                   words[count] = (String)o;
                   count++;
              return words;
         public void keyPressed(KeyEvent evt){
              char tempchar = evt.getKeyChar();
              String character = ""+tempchar;
              if (character.equalsIgnoreCase(""+positions[charcounter].getChar())){
                   positions[charcounter].setColor(randomColor());
                   charcounter++;
              else if (evt.isShiftDown()){
                   evt.consume();
              else{
                   restart();
              drawWords();
         public void keyTyped(KeyEvent evt){}
         public void keyReleased(KeyEvent evt){}
    class CharacterPosition{
         private int xaxis;
         private char character;
         private Color color;
         public CharacterPosition(char c, int x, Color col){
              xaxis = x;
              character = c;
              color = col;
         public int getX(){
              return xaxis;
         public char getChar(){
              return character;
         public Color getColor(){
              return color;
         public void setColor(Color c){
              color = c;
    }

    I thought that maybe serializing the ArrayList might be faster than creating the ArrayList by iterating over each line in the text file. But alas, I was wrong. Here's my code anyway:
    class WordList extends ArrayList<String>{
      long updated;
    WordList readWordList(File file) throws Exception{
      WordList list = new WordList();
      BufferedReader in = new BufferedReader(new FileReader(file));
      String line = null;
      while ((line = in.readLine()) != null){
        list.add(line);
      in.close();
      list.updated = file.lastModified();
      return list;
    WordList wordList;
    File datFile = new File("words.dat");
    File txtFile = new File("input.txt");
    if (datFile.exists()){
      ObjectInputStream input = new ObjectInputStream(new FileInputStream(datFile));
      wordList = (WordList)input.readObject();
      if (wordList.updated < txtFile.lastModified()){
        //if the text file has been updated, re-read it
        wordList = readWordList(txtFile);
        ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(datFile));
        output.writeObject(wordList);
        output.close();
    } else {
      //serialized list does not exist--create it
      wordList = readWordList(txtFile);
      ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(datFile));
      output.writeObject(wordList);
      output.close();
    }The text file contained one random sequence of letters per line. For example:
    hwnuu
    nhpgaucah
    zfbylzt
    hwnc
    gicgwkhStats:
    Text file size: 892K
    Serialized file size: 1.1MB
    Time to read from text file: 795ms
    Time to read from serialized file: 1216ms

  • Flex Time Creates Random Pops

    Flex time is creating random pops after just minor correction of a monophonic bass line. The pops vary depending on where the playback starts in the file and they are recorded into merged or bounce in place audio. No plugs on the channel either.
    Bob

    I am getting that exact same problem too. A bass line that after using Flex time on, would randomly get clicks on it. I think it's doing it to the guitar lines too.
    What seemed to work for me was changing the Flex time setting from Monophonic to Slicing. It kind of defeats the purpose of Flex time, but at least it sounds right again.
    Hope Apple fixes this soon!

  • Adobe flash player updates creates horizonal lines on my monitor. How do I delete adobe flash player?

    Adobe Flash Player updates create horizonal lines on my monitor. How do I delete Adobe Flash Player?

    if you reboot and the line is there before you login it's not flash
    but more likely an hardware issue
    people like to see patterns so they seek them out but that can at times result in
    a random hardware failure being tied to whatever the user was doing when it happened
    like "tripple clicking in mail caused a loud pop and smoking raising from my imac"
    but anyway this is how you uninstall flash
    https://helpx.adobe.com/flash-player/kb/uninstall-flash-player-mac-os.html
    more
    uninstall flash mac

  • Unable to create Schedule line(Maintain sch.agreement)

    Hi experts,
    After running MRP i got Planned order for a certain material and for that material procurement type maintained as "Both internal and external" in material master. After completing the process planned order to purchase requisition, i separately created schedule agreement . Now here i am facing one problem that if i create schedule line with reference to purchase requsition i am getting the error Requisition doc. type NB not allowed with doc.type LP.
    pls anybody suggest is there any prob made in the above process
    Regs,
    SR
    Edited by: SP Ramesh on Jan 1, 2010 8:22 AM

    go to tcode OLME> schedule agreement> select the line of document type LP and then slecte the folled item category and then selce each item category one by one and then click on the second folders link document type and there give source document type NB
    cause of the issue is : the source document type NB is not set with LP document type of schedule agreement

  • CRXI Export to text - suppressed section creates blank lines

    I'm using CRXI Proffesional - full version 11.5.11.1470
    I have a report that uses the typical "stealth" subreport to obtain and pass info to the container, but remains invisible in preview mode. The fields in the subreport are all suppressed, the sections in the subreport are suppressed if blank and the subreport itself is suppressed when blank, the section that contains the subreport is also suppressed if blank.
    This has always worked fine to get info into the container from the subreport while not creating any "white space" on the report.
    Print preview and export to pdf both function just fine, omitting the blank lines.
    It seems that exporting this to a text file is now creating blank lines for each occurence of the subreport.
    I have seen this problem in a couple of forums but have not seen a resolution yet.
    Does anybody have any idea how I can stop the exporting of suppressed blank sections ?

    Good morning.
    We've got something to get straight first
    When you say "...from the Report Viewer. The report printed as expected on HP printer...", do you mean the viewer of the .NET app, or the viewer of the CR designer?
    And version 12.0.0.683, is very old (well as far as CR is concerned anyhow   ). That version is SP 1, we are now on SP 2. So that will be the place to start. Get to SP 2 which can be downloaded from here;
    https://smpdl.sap-ag.de/~sapidp/012002523100009038092009E/cr2008win_sp2.exe
    Ludek

  • Using Select all to create multiple lines in a sales order

    Hello SAP experts,
    In our business practice users create multiple line sales orders with reference to contracts and use the copy paste method and then assign each line to the contract manually.
    After a few years of this practice i found a new way to create multiple lines but it doesn't quite work correctly. When you have created the first line of an order if you click on the select all button the system will ask you how many lines do you want to copy. I don't know if this is standard SAP but 3 things don't happen when we use this 1) The schedule line information is blank 2) conditions do not copy from the contract even though the contract has been referenced. 3) Since there is no schedule line information the order fails when saving and we get a update terminated message.
    I am having problems finding any documentation around this function so any help with this would be greatly appreciated.
    error when updating is
    Transaction..   VA01
    Update key...   4D358878A8B601AAE10080000A2C4982
    Generated....   28.01.2011, 13:47:23
    Completed....   28.01.2011, 13:47:23
    Error Info...   00 671: ABAP/4 processor: GETWA_NOT_ASSIGNED

    GETWA_NOT_ASSIGNED
    Many threads are there on this error message and you would come to know if you google with this text.  Check couple of threads where  the same topic was discussed
    [Re: GETWA_NOT_ASSIGNED|Re: GETWA_NOT_ASSIGNED;
    [Re: GETWA_NOT_ASSIGNED ABAP Dump|GETWA_NOT_ASSIGNED ABAP Dump;
    Also there are some 20 OSS notes on this error message and you can have a look at the following notes:-
    1)   Note 913679 - VA01: Short Dump GETWA_NOT_ASSIGNED on click of quantity.
    2)   Note 591955 - ABAP runtime error GETWA_NOT_ASSIGNED
    3)   Note 870670 - SD_SALES_DOCU_MAINTAIN_DIALOG termination with GETWA_NOT_***
    4)   Note 141314 - VA02: Dump with 'GETWA_NOT_ASSIGNED'
    thanks
    G. Lakshmipathi

  • Creating Schedule lines in Scheduling agreement using LSMW

    Hi,
    I want to upload multiple schedule lines in scheduling agreement using LSMW. I have done the recording and maintained multiple lines in input file. However during execution LSMW creates only one line and keeps on ovewritting the same line. Please let me know how can I create multiple schedule lines.
    Regards

    First you should search for existing standard LSMW migration objects that possibly cover your scenario. These normally take care of complex header / multiple items / multiple subitems relations.
    With a recording you can only load flat structures. Sometimes a "create new  lines" / "enter first line" / "save transaction" logic can be constructed to load multiple items to a header (or even subitems to an item?) with a recording, but this can be pretty awkward.
    Thomas

  • MRP does not creates Shcedule Line

    I have a valid scheduling agreement LPA in place. Scheduling Agreement is approved and released status.
    I have source list also maintained for same scheduling agreement with long validity and MRP indicator as 2 - Create Schedule line automatically. 
    I am running MRP using following parameters in MD02.
    Processing key          NETCH               Net Change in Total Horizon
    Create purchase req.    3                   Planned orders
    Delivery schedules      3                   Schedule lines
    Create MRP list         1                   MRP list
    Planning mode           3                   Delete and recreate planning data
    Scheduling              2                   Lead Time Scheduling and Capacity Planni
    Even schedule line and other parameters maintained properly, MRP creates planned order and does not creates Schedule Line automatically. Material Master is maintained MRP Type PD, Lot Size as Replenishment to maximum stock level, Safety stock, No strategy and availability on.
    What I am doing wrong? With same setting in other system it is working perfectly fine.
    Any feedback appreciated.
    Thanks
    PP

    Hi
    Check whether the Agreement Open Target value .
    If the target quantity was completed . so system will not create the Schedule lines for the material
    2. If you mainatian the open period in the smk.
    so system will create the planned order instead of schedule agreement. check

  • Random Line reading in text file

    I am trying to read a random line in a text file but every time i read it it reads first line of the file any one can help me what is the problem in the code is or provide me with a new code.
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                   File file = new File("word.txt");
                   if(!file.exists())
                        System.out.println("File does not exist.");
                        System.exit(0);
                   try{
                        //Open the file for reading
                        RandomAccessFile raf = new RandomAccessFile(file, "r");
    raf.seek(file.length());     //Seek to end of file
                        System.out.println("Read full line: " + raf.readLine());
    //str2 is a String
                        str2 = str2 + raf.readLine();
                        System.out.println(""+str2);
                        raf.close();
                        System.out.println("Successfully");
                   catch(IOException ioe)
                        System.out.println(ioe.getMessage());
    my text file look like in this format
    mind
    hate
    Abhor
    Bigot
    narrow
    prejudiced
    person
    Counterfeit
    fake
    false
    give
    voting
    rights
    Hamper
    hinder
    obstruct
    Kindle
    to
    start
    fire
    harmful
    poisonous
    lethal

    Next time when posting code, please use code tags: http://forum.java.sun.com/help.jspa?sec=formatting
    A RandomAccessFile has nothing to do with getting a (pseudo) random line number from a file.
    You should also split things up in separate methods:
    - a method for counting the number of lines in a file;
    - a method to get the N-th line from a file.
    In your main method, you call the method which counts the number of lines N in a file and then generate a (pseudo) random number between 1 and N. Use the java.util.Random class for this.
    When you have generated that number, call the other method to get that specific line number.
    Here's a small start:
    import java.io.*;
    import java.util.*;
    public class Main {
        public static String getLineNumber(int number) throws FileNotFoundException {
            // your code here
        public static int countLines(String fileName) throws FileNotFoundException {
            // your code here
        public static void main(String[] args) throws Exception {
            int numberLines = countLines("word.txt");
            Random generator = new Random();
            int randomNumber = generator.nextInt(numberLines)+1;
            String randomLine = getLineNumber(randomNumber);
            System.out.println("Line "+randomNumber+" = '"+randomLine+"'");
    }In both methods, you can use the java.util.Scanner class to read lines from the file.
    Have a look at the API docs of the Scanner class:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html (including code samples!)
    Good luck.

  • How can I create a line break in pages for iPad?

    On the Mac you can hold the shift key while pressing the return key to creat a line break. Only pressing the return key will creat a new paragraph of course.
    On the iPad you only can creat paragraphs. Pressing the shif key does not change that.
    Does anybody know how to force a linebrek on the pages app for iPad?

    Tap and hold where you wish to insert the line break. Select Insert from the pop up menu, then Line break.
    this might be helpful for future reference: http://help.apple.com/pages/ipad/1.7/

  • My iPod Touch has had random lines appearing on the screen at certain times (videos, typing)

    My iPod 5 (32gig) has recently started to do this thing where it will show random lines on the screen when either typing quickly or watching certain videos. They are close to the thickness of your fingernails and occasionally vary in color. I've had this iPod for around a year and a half now and it hasn't suffered any significant trauma. When it happens on the keyboard, the lines only appear on the keyboard. When it happens during a video it only happens where the video is playing (ie. if not on full screen, it only happens on the rectangle where the video is, not the empty space). And it also only happens on certain videos. It happened earlier on a news segment clip on the Fox website, but not on a music video I watched on YouTube three minutes later. For videos, it can be up to three of these lines at once. It first started happening to my keyboard and has since furthered itself to the videos. The screen has two small scratches but other than that it's fine. I'd also like to add even though it may not be relevant that my apps have been crashing more recently as well.
    What do you recommend I do? Why is this happening? Thank you in advance!

    Try:
    - Reset the iOS device. Nothing will be lost      
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings                            
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes
    - Restore to factory settings/new iOS device.                       
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar                                                              

  • How to create a line type in data dictionary

    How to create a line type in data dictionary?Please explain step by step?
    Thanks & Regads,
    Sairam

    Hi,
    the details abbout the line type.
    The line type of a table type can be defined by:
    o Specification of a type that already exists (data element,
    structure, table type, table, view) whose properties are then copie
    as properties of the defined table line.
    o Direct type input, where data type, number of positions, and, if
    required, decimal places, are entered directly.
    o Specification of a reference type.
    and SE11 and click on datatype and click on table type and enter the line type.
    Thanks
    Shiva

  • Error in creating schedule line aggrement through BAPI

    Hi All ,
    I want to create schedule line aggrement (VA31) by using BAPI / FM .
    I am using " SD_SALESDOCUMENT_CREATE" FM  .
    Here i am getting error in output when i enter shchedle line data in input .
    Error is given below .
    E V1                   434 No schedule line category could be determined during quantity adjustment
    Error only come when i want to create new schedule line ....in Changing any schedule line aggrement there is no error .
    I am able to create schedule line aggrement manually .
    please help .

    Use BAPI_SAG_CREATE

  • Error whil creating Service Line item in ME51N using BAPI_PR_CREATE

    Hi Experts,
                Am able to create PR number using BAPI_PR_CREATE, but when am trying to create Service line item am getting acc assignment error please check my code and solve my issue. ..its very adj  please help me .
    DATA : t_bapimereqitemimp TYPE TABLE OF bapimereqitemimp ,
          t_bapimereqaccount TYPE TABLE OF bapimereqaccount,
          t_bapimereqaccountx TYPE TABLE OF bapimereqaccountx,
          t_pritemx    TYPE TABLE OF bapimereqitemx,
          wa_bapimereqitemimp        TYPE bapimereqitemimp,
          pr_number  TYPE bapimereqheader-preq_no,
          wa_prheader  TYPE   bapimereqheader,
          wa_prheaderx TYPE  bapimereqheaderx,
          wa_pritemx   TYPE  bapimereqitemx,
          wa_bapimereqaccountx TYPE bapimereqaccountx,
          wa_bapimereqaccount TYPE bapimereqaccount,
          t_return     TYPE TABLE OF bapiret2,
          wa_return    TYPE bapiret2.
    DATA : t_bapi_srv_limit_data TYPE TABLE OF bapi_srv_limit_data,
            wa_bapi_srv_limit_data TYPE bapi_srv_limit_data.
    DATA servicelimitx  TYPE TABLE OF bapi_srv_limit_datax.
    DATA w_servicelimitx  TYPE bapi_srv_limit_datax.
    DATA : t_servicelines TYPE TABLE OF bapi_srv_service_line,
            w_servicelines TYPE bapi_srv_service_line,
            t_servicelinesx TYPE TABLE OF bapi_srv_service_linex,
            w_servicelinesx TYPE bapi_srv_service_linex,
            t_bapi_srv_acc_data TYPE TABLE OF bapi_srv_acc_data,
            w_bapi_srv_acc_data TYPE bapi_srv_acc_data,
            t_bapi_srv_acc_datax TYPE TABLE OF bapi_srv_acc_datax,
            w_bapi_srv_acc_datax TYPE bapi_srv_acc_datax.
    DATA : t_bapimereqitem TYPE TABLE OF bapimereqitem,
            w_bapimereqitem TYPE bapimereqitem.
    DATA :  t_bapimereqitemx TYPE TABLE OF bapimereqitemx,
            w_bapimereqitemx TYPE bapimereqitemx.
    wa_prheader-pr_type  = 'RV'."lv_doc_type.
    wa_prheaderx-pr_type = 'X'.
    wa_bapimereqitemimp-preq_item  = '1'."wa_eban-item.
    wa_bapimereqitemimp-pur_group  = '100'."wa_eban-ekgrp.
    wa_bapimereqitemimp-preq_name  = 'E.R. TITTO'."wa_eban-afnam.
    wa_bapimereqitemimp-short_text = 'AC Fitting'."wa_eban-txz01.
    wa_bapimereqitemimp-material   = ' '."wa_eban-matnr.
    wa_bapimereqitemimp-plant      = '1000'."wa_eban-werks.
    wa_bapimereqitemimp-store_loc  = 'ST00'."wa_eban-lgort.
    wa_bapimereqitemimp-matl_group = 'Z13'."wa_eban-matkl.
    wa_bapimereqitemimp-quantity   = '1'."wa_eban-menge.
    wa_bapimereqitemimp-unit       = 'AU'."wa_eban-meins.
    wa_bapimereqitemimp-deliv_date =  '20140604'."wa_eban-lfdat.
    wa_bapimereqitemimp-preq_price = '100'."wa_eban-preis.
    wa_bapimereqitemimp-item_cat   = 'D'."wa_eban-pstyp.
    wa_bapimereqitemimp-acctasscat =  'K'."wa_eban-knttp.
    wa_bapimereqitemimp-fixed_vend = ' '."wa_eban-flief.
    wa_bapimereqitemimp-purch_org  = '1000'."wa_eban-ekorg.
    wa_bapimereqitemimp-currency   = 'INR'."wa_eban-waers.
    wa_bapimereqitemimp-pckg_no = '00000001'.
    wa_bapimereqaccount-preq_item  = '1'."wa_eban-item.
    *wa_bapimereqaccount-serial_no  = '01'.
    wa_bapimereqaccount-gl_account = '0000002244'."wa_eban-sakto.
    wa_bapimereqaccount-costcenter = 'OPSD'."wa_eban-kostl.
    APPEND wa_bapimereqitemimp TO t_bapimereqitemimp.
    APPEND wa_bapimereqaccount TO t_bapimereqaccount.
    wa_pritemx-preq_item  = '1'."wa_eban-item.
    wa_pritemx-pur_group  = 'X'.
    wa_pritemx-preq_name  = 'X'.
    wa_pritemx-short_text = 'X'.
    wa_pritemx-material   = 'X'.
    wa_pritemx-plant      = 'X'.
    wa_pritemx-store_loc  = 'X'.
    wa_pritemx-matl_group = 'X'.
    wa_pritemx-quantity   = 'X'.
    wa_pritemx-unit       = 'X'.
    wa_pritemx-deliv_date = 'X'.
    wa_pritemx-preq_price = 'X'.
    wa_pritemx-item_cat   = 'X'.
    wa_pritemx-acctasscat = 'X'.
    wa_pritemx-fixed_vend = 'X'.
    wa_pritemx-purch_org  = 'X'.
    wa_pritemx-currency   = 'X'.
    wa_pritemx-pckg_no   = 'X'.
    wa_bapimereqaccountx-preq_item  = '1'."wa_eban-item.
    *wa_bapimereqaccountx-serial_no  = '01'.
    wa_bapimereqaccountx-preq_itemx = 'X'.
    wa_bapimereqaccountx-serial_nox = 'X'.
    wa_bapimereqaccountx-gl_account = 'X'.
    wa_bapimereqaccountx-costcenter = 'X'.
    APPEND wa_pritemx TO t_pritemx.
    APPEND wa_bapimereqaccountx TO t_bapimereqaccountx.
    **Service item limit
    *wa_bapi_srv_limit_data-doc_item = '10'.
    wa_bapi_srv_limit_data-overall_limit = '1000'.
    wa_bapi_srv_limit_data-exp_value = '800'.
    APPEND wa_bapi_srv_limit_data TO  t_bapi_srv_limit_data.
    *w_servicelimitx-doc_item = '10'.
    w_servicelimitx-overall_limit = 'X'.
    w_servicelimitx-exp_value = 'X'.
    APPEND w_servicelimitx TO servicelimitx.
    w_bapimereqitem-preq_item = '10'.
    ***w_bapimereqitem-preq_name = 'E.R. TITTO'.
    ***w_bapimereqitem-plant = '1000'.
    ***w_bapimereqitem-store_loc = 'ST00'.
    ***w_bapimereqitem-matl_group = 'Z03'.
    ***w_bapimereqitem-quantity = '1'.
    ***w_bapimereqitem-unit = 'AU'.
    w_bapimereqitem-item_cat = 'D'.
    w_bapimereqitem-deliv_time = '20140604'.
    w_bapimereqitem-acctasscat = 'K'.
    **w_bapimereqitem-consumpt = 'U'.
    APPEND w_bapimereqitem TO t_bapimereqitem.
    **w_bapi_srv_acc_data-doc_item = '1'.
    **w_bapi_srv_acc_data-outline = '0000000001'.
    *w_bapi_srv_acc_data-srv_line = '20'.
    w_bapi_srv_acc_data-serial_no = '10'.
    w_bapi_srv_acc_data-serial_no_item = 'D'.
    *w_bapi_srv_acc_data-quantity = '1'.
    *APPEND w_bapi_srv_acc_data TO t_bapi_srv_acc_data.
    **w_bapi_srv_acc_datax-doc_item = '1'.
    **w_bapi_srv_acc_datax-outline = '0000000001'.
    *w_bapi_srv_acc_datax-srv_line = '20'.
    **w_bapi_srv_acc_datax-serial_no = '01'.
    **w_bapi_srv_acc_datax-serial_no_item = '01'.
    *w_bapi_srv_acc_datax-quantity = '1'.
    *APPEND w_bapi_srv_acc_datax TO t_bapi_srv_acc_datax.
    w_servicelines-service = '00000001'.
    APPEND w_servicelines TO t_servicelines.
    w_servicelinesx-service = 'X'.
    APPEND w_servicelinesx TO t_servicelinesx.
    CALL FUNCTION 'BAPI_PR_CREATE'
       EXPORTING
         prheader        = wa_prheader
         prheaderx       = wa_prheaderx
       IMPORTING
         number          = pr_number
       TABLES
         return          = t_return
         pritem          = t_bapimereqitemimp
         pritemx         = t_pritemx
         pritemexp       = t_bapimereqitem
         praccount       = t_bapimereqaccount
         praccountx      = t_bapimereqaccountx
         servicelimit    = t_bapi_srv_limit_data
         servicelimitx   = servicelimitx
         servicelines    = t_servicelines
         servicelinesx   = t_servicelinesx
         serviceaccount  = t_bapi_srv_acc_data
         serviceaccountx = t_bapi_srv_acc_datax.

    Hi,
    Check this Thread , Thread1 . It might help you to resolve the issue.
    Thanks
    KH

Maybe you are looking for

  • Mac Pro 2008 won't boot from install disc - black screen

    Hello, I recently purchased a new hard drive to replace the original that came with my Mac Pro 2008.  I was able to format the new drive using Disk Utility. I am now at the point where I need to install OS X onto the new drive, but the computer refus

  • [Urgent] Item missing when filling Subclass Information

    Hi All, I created custom form based on TEMPLATE.fmb and all libraries needed have been attached perfectly. When I fill Subclass Information 'TEXT_ITEM' in property class of an text item, then compile it, the item does not appear. But in Oracle Form b

  • DBMS_LOGSTDBY.BUILD Seems to Hang

    Hi Group, One step on the logical standby creation is to execute the package DBMS_LOGSTDBY.BUILD, however it has been executing for almost three days and it does not return the sql promt, I read about metalink note 747495.1 DBMS_LOGSTDBY.BUILD Seems

  • Upload to FTP Host

    Hello, I am trying to upload my site to FTP Host, i got past the first window i am now stuck on the Upload to Ftp host window, its asking for folder info and i dont know what to put in here please help thanks Jay

  • Full screen mode in flash player - how to make it more fluent ?

    For some reason I'm experiencing a not fluent picture by watching tennis or other sports on ESPN3 Live on Flash Player. The thing is, sometimes in one and the same session, watching the same match switching to full screen mode I get a fluent picture