Hi,see this code....

hi group,
I am a new user. I am new in Swing also.
Try this code.
when I press keyboard( like a,b,c.....)In my tree I am selecting corresponding nodes.
In keytyped event i have written like this
public void keyTyped(KeyEvent kt)
     this.selectNodeWithValue('A');
private void selectNodeWithValue(char ch)
     DefaultMutableTreeNode root = (DefaultMutableTreeNode)treemodel.getRoot();
     TreePath selPath = null;
     Enumeration enum = root.breadthFirstEnumeration();
     int counter = 0;
     while(enum.hasMoreElements())
          DefaultMutableTreeNode node = (DefaultMutableTreeNode)enum.nextElement();
          String obj = (String)node.getUserObject();
          StringBuffer buf = new StringBuffer(obj);
          if(buf.charAt(0) == ch)
                    TreeNode[] nArr = treemodel.getPathToRoot(node);
                    selPath = new TreePath(nArr);
                    System.out.println("inside selpath is:"+selPath);
     System.out.println("the selpath is:"+selPath);
     getJDestTree().setSelectionPath(selPath);
     getJDestTree().scrollPathToVisible(selPath);
     updateUI();
     if(selPath != null)
          ivjJDestTree.setSelectionPath(selPath);
here just I am checking with one char 'A'.like this I want all the chars.
Any suggestions will be appreciated.
shalini.

Hi shalini,
you have the key event as parameter.
with this you can get the key char
Eg.KeyEvent Ke
Ke.getKeyChar()..
this will return the key that was pressed.
good luck.
yamuna.

Similar Messages

  • Plz see this code

    rs=stm.executeQuery("select news.news_id,to_char(news_date,'dd-MON-yy HH:MM:SS AM'),heading,desc1,desc2 from news where sysdate<=news_date + interval '2' day order by news_date desc");
              while(rs.next()){
              newsDate=rs.getString("news_date");
              out.println("News ID"+rs.getString("news_id")+"<div align=right>"+newsDate+"</div><br>");
              news_id=rs.getInt("news_id");
              heading=rs.getString("heading");
              out.println("<tr><td><a href=http://localhost:5050/examples/servlet/displayNews?newsID="+news_id+"><font color=olive face='times new roman' size=3><b>"+heading+"</a></font></td></tr>");               
              out.println("<tr><td>"+rs.getString("desc1")+"<a href=http://localhost:5050/examples/servlet/displayNews?newsID="+news_id+">   Details.....</a><br><br></td></tr>");
              }news_date exists in DB but it gives
    Error:
    Invalid column name

    try to use like this to get data :
    rs. getInt(1) > use column index number
    maybe helps you.

  • Solve this code

    hai all
    i solve a dayanamic "select" statement using ref cursor.but the output is displaying without spaces .i want to split the output.
    see this code.i need a output in browser(using htp package).
    declare
    TYPE generic_rc IS REF CURSOR;
    cv generic_rc;
    column_list varchar2(500);
    temp varchar2(500);
    BEGIN
    column_list:='select pname| |course| |splace from studies ';
    OPEN cv FOR
    column_list;
    loop
    fetch cv into temp;
    exit when cv%notfound;
    dbms_output.put_line(temp);
    insert into tab1 values(temp);
    end loop;
    close cv;
    commit;
    end;
    here i am selecting 3 columns.i got answer without space.how to split the answer.
    advanced thanx for ur repply
    null

    Your code was :
    column_list:='select pname| |course| |splace from studies ';
    Try:
    column_list:='select pname&#0124; &#0124;' '&#0124; &#0124;course&#0124; &#0124;' '&#0124; &#0124;splace from studies ';
    For output in a browser, change dbms_output.put_line by htp.p
    Hth,
    Ton

  • See my error against this code jasperPrint = JasperFillManager.fillReport(s

    sir i use this code for without database report
    jasperPrint = JasperFillManager.fillReport(stream, new HashMap(), new JREmptyDataSource());
    and comple then output window give me this error
    C:Documents and SettingsAdministratorMy DocumentsCreatorProjectswithoutdatasourceireportsrcwithoutdatasourceireportPage1.java:390: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown
    jasperPrint = JasperFillManager.fillReport(stream, new HashMap(), new JREmptyDataSource());
    1 error
    C:Documents and SettingsAdministratorMy DocumentsCreatorProjectswithoutdatasourceireportnbprojectbuild-impl.xml:233: The following error occurred while executing this line:
    C:Documents and SettingsAdministratorMy DocumentsCreatorProjectswithoutdatasourceireportnbprojectbuild-impl.xml:122: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 13 seconds)
    see all error and
    plese give me idea
    thank's
    aamir

    See your other thread on the same topic
    Re: jsp give me this error javax.servlet.ServletException: oracle.jdbc.driv

  • New issue , when importing new paid app spreadsheet into Configurator iTunes attempts to download an ipa file for each redeem code .  If you have 100 codes 100 downloads will start. Call enterprise support if you are seeing this issue.

    New issue , when importing new paid app spreadsheet into Configurator iTunes attempts to download an ipa file for each redeem code .  If you have 100 codes 100 downloads will start. Call enterprise support if you are seeing this issue.

    New issue , when importing new paid app spreadsheet into Configurator iTunes attempts to download an ipa file for each redeem code .  If you have 100 codes 100 downloads will start. Call enterprise support if you are seeing this issue.

  • Hi can anyone see anything glaringly wrong in this code its only a few line

    class test
    public static void main(String []args)
    public void display()
         int limit=5;
         int total=0;
         for (int i = 0; i<limit; i++)
              System.out.println(i*i+i);
              total+=i;
         System.out.println(total);

    see after running this code
    public class test
         public static void display()
         int limit=5;
         int total=0;
         for (int i = 0; i<limit; i++)
              System.out.println(i*i+i);
              total+=i;
                   System.out.println(total);
                        public static void main(String []args)
                                  display();
    I get this output
    0
    2
    6
    12
    20
    10
    but when i work it out in my mind i get this
    2
    12
    and then i stop because i wonder why i didnt get the 0 and why i missed the 6
    can anyone work out what im doing wrong
    thanks

  • My ITunes gift card I brought, the Reemdem code had bin wide out so I can no longer see that code what do I do

    My ITunes gift card I brought, the Reemdem code had bin wide out so I can no longer see that code what do I do?

    "bin wide out"?
    If you mean you cannot read the code on the back of the card take it back to the store you purchased it from. If the numbers are not visable because you scratched them out I don't know if the store will replace or refund that. If you can read some of the numbers you could just keep trying a combination of letters and numbers to replace the missing ones. This will take a while depending on how many inputs are missing. You will have to use 0 through 9 and I am guessing A through Z.

  • Why this code is not working??? java script

    gen_validatorv2.js
         JavaScript Form Validator
    Version 2.0.2
         Copyright 2003 JavaScript-coder.com. All rights reserved.
         You use this script in your Web pages, provided these opening credit
    lines are kept intact.
         The Form validation script is distributed free from JavaScript-Coder.com
         You may please add a link to JavaScript-Coder.com,
         making it easy for others to find this script.
         Checkout the Give a link and Get a link page:
         http://www.javascript-coder.com/links/how-to-link.php
    You may not reprint or redistribute this code without permission from
    JavaScript-Coder.com.
         JavaScript Coder
         It precisely codes what you imagine!
         Grab your copy here:
              http://www.javascript-coder.com/
    function Validator(frmname)
    this.formobj=document.forms[frmname];
         if(!this.formobj)
         alert("BUG: couldnot get Form object "+frmname);
              return;
         if(this.formobj.onsubmit)
         this.formobj.old_onsubmit = this.formobj.onsubmit;
         this.formobj.onsubmit=null;
         else
         this.formobj.old_onsubmit = null;
         this.formobj.onsubmit=form_submit_handler;
         this.addValidation = add_validation;
         this.setAddnlValidationFunction=set_addnl_vfunction;
         this.clearAllValidations = clear_all_validations;
    function set_addnl_vfunction(functionname)
    this.formobj.addnlvalidation = functionname;
    function clear_all_validations()
         for(var itr=0;itr < this.formobj.elements.length;itr++)
              this.formobj.elements[itr].validationset = null;
    function form_submit_handler()
         for(var itr=0;itr < this.elements.length;itr++)
              if(this.elements[itr].validationset &&
         !this.elements[itr].validationset.validate())
              return false;
         if(this.addnlvalidation)
         str =" var ret = "+this.addnlvalidation+"()";
         eval(str);
    if(!ret) return ret;
         return true;
    function add_validation(itemname,descriptor,errstr)
    if(!this.formobj)
         alert("BUG: the form object is not set properly");
              return;
         }//if
         var itemobj = this.formobj[itemname];
    if(!itemobj)
         alert("BUG: Couldnot get the input object named: "+itemname);
              return;
         if(!itemobj.validationset)
         itemobj.validationset = new ValidationSet(itemobj);
    itemobj.validationset.add(descriptor,errstr);
    function ValidationDesc(inputitem,desc,error)
    this.desc=desc;
         this.error=error;
         this.itemobj = inputitem;
         this.validate=vdesc_validate;
    function vdesc_validate()
    if(!V2validateData(this.desc,this.itemobj,this.error))
    this.itemobj.focus();
              return false;
    return true;
    function ValidationSet(inputitem)
    this.vSet=new Array();
         this.add= add_validationdesc;
         this.validate= vset_validate;
         this.itemobj = inputitem;
    function add_validationdesc(desc,error)
    this.vSet[this.vSet.length]=
         new ValidationDesc(this.itemobj,desc,error);
    function vset_validate()
    for(var itr=0;itr<this.vSet.length;itr++)
         if(!this.vSet[itr].validate())
              return false;
         return true;
    function validateEmailv2(email)
    // a very simple email validation checking.
    // you can add more complex email checking if it helps
    if(email.length <= 0)
         return true;
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    var regexp_user=/^\"?[\w-_\.]*\"?$/;
    if(splitted[1].match(regexp_user) == null) return false;
    if(splitted[2] != null)
    var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
    if(splitted[2].match(regexp_domain) == null)
         var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
         if(splitted[2].match(regexp_ip) == null) return false;
    }// if
    return true;
    return false;
    function V2validateData(strValidateStr,objValue,strError)
    var epos = strValidateStr.search("=");
    var command = "";
    var cmdvalue = "";
    if(epos >= 0)
    command = strValidateStr.substring(0,epos);
    cmdvalue = strValidateStr.substr(epos+1);
    else
    command = strValidateStr;
    switch(command)
    case "req":
    case "required":
    if(eval(objValue.value.length) == 0)
    if(!strError || strError.length ==0)
    strError = objValue.name + " : Required Field";
    }//if
    alert(strError);
    return false;
    }//if
    break;
    }//case required
    case "maxlength":
    case "maxlen":
    if(eval(objValue.value.length) > eval(cmdvalue))
    if(!strError || strError.length ==0)
    strError = objValue.name + " : "+cmdvalue+" characters maximum ";
    }//if
    alert(strError + "\n[Current length = " + objValue.value.length + " ]");
    return false;
    }//if
    break;
    }//case maxlen
    case "minlength":
    case "minlen":
    if(eval(objValue.value.length) < eval(cmdvalue))
    if(!strError || strError.length ==0)
    strError = objValue.name + " : " + cmdvalue + " characters minimum ";
    }//if
    alert(strError + "\n[Current length = " + objValue.value.length + " ]");
    return false;
    }//if
    break;
    }//case minlen
    case "alnum":
    case "alphanumeric":
    var charpos = objValue.value.search("[^A-Za-z0-9]");
    if(objValue.value.length > 0 && charpos >= 0)
    if(!strError || strError.length ==0)
    strError = objValue.name+": Only alpha-numeric characters allowed ";
    }//if
    alert(strError + "\n [Error character position " + eval(charpos+1)+"]");
    return false;
    }//if
    break;
    }//case alphanumeric
    case "num":
    case "numeric":
    var charpos = objValue.value.search("[^0-9]");
    if(objValue.value.length > 0 && charpos >= 0)
    if(!strError || strError.length ==0)
    strError = objValue.name+": Only digits allowed ";
    }//if
    alert(strError + "\n [Error character position " + eval(charpos+1)+"]");
    return false;
    }//if
    break;
    }//numeric
    case "alphabetic":
    case "alpha":
    var charpos = objValue.value.search("[^A-Za-z]");
    if(objValue.value.length > 0 && charpos >= 0)
    if(!strError || strError.length ==0)
    strError = objValue.name+": Only alphabetic characters allowed ";
    }//if
    alert(strError + "\n [Error character position " + eval(charpos+1)+"]");
    return false;
    }//if
    break;
    }//alpha
              case "alnumhyphen":
    var charpos = objValue.value.search("[^A-Za-z0-9\-_]");
    if(objValue.value.length > 0 && charpos >= 0)
    if(!strError || strError.length ==0)
    strError = objValue.name+": characters allowed are A-Z,a-z,0-9,- and _";
    }//if
    alert(strError + "\n [Error character position " + eval(charpos+1)+"]");
    return false;
    }//if                
                   break;
    case "email":
    if(!validateEmailv2(objValue.value))
    if(!strError || strError.length ==0)
    strError = objValue.name+": Enter a valid Email address ";
    }//if
    alert(strError);
    return false;
    }//if
    break;
    }//case email
    case "lt":
    case "lessthan":
    if(isNaN(objValue.value))
    alert(objValue.name+": Should be a number ");
    return false;
    }//if
    if(eval(objValue.value) >= eval(cmdvalue))
    if(!strError || strError.length ==0)
    strError = objValue.name + " : value should be less than "+ cmdvalue;
    }//if
    alert(strError);
    return false;
    }//if
    break;
    }//case lessthan
    case "gt":
    case "greaterthan":
    if(isNaN(objValue.value))
    alert(objValue.name+": Should be a number ");
    return false;
    }//if
    if(eval(objValue.value) <= eval(cmdvalue))
    if(!strError || strError.length ==0)
    strError = objValue.name + " : value should be greater than "+ cmdvalue;
    }//if
    alert(strError);
    return false;
    }//if
    break;
    }//case greaterthan
    case "regexp":
                   if(objValue.value.length > 0)
         if(!objValue.value.match(cmdvalue))
         if(!strError || strError.length ==0)
         strError = objValue.name+": Invalid characters found ";
         }//if
         alert(strError);
         return false;
         }//if
    break;
    }//case regexp
    case "dontselect":
    if(objValue.selectedIndex == null)
    alert("BUG: dontselect command for non-select Item");
    return false;
    if(objValue.selectedIndex == eval(cmdvalue))
    if(!strError || strError.length ==0)
    strError = objValue.name+": Please Select one option ";
    }//if
    alert(strError);
    return false;
    break;
    }//case dontselect
    }//switch
    return true;
         Copyright 2003 JavaScript-coder.com. All rights reserved.
    example.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Example for Validator</title>
    <script language="JavaScript" src="gen_validatorv2.js" type="text/javascript"></script>
    </head>
    <body>
    <form action="" name="myform" >
    <table cellspacing="2" cellpadding="2" border="0">
    <tr>
    <td align="right">First Name</td>
    <td><input type="text" name="FirstName"></td>
    </tr>
    <tr>
    <td align="right">Last Name</td>
    <td><input type="text" name="LastName"></td>
    </tr>
    <tr>
    <td align="right">EMail</td>
    <td><input type="text" name="Email"></td>
    </tr>
    <tr>
    <td align="right">Phone</td>
    <td><input type="text" name="Phone"></td>
    </tr>
    <tr>
    <td align="right">Address</td>
    <td><textarea cols="20" rows="5" name="Address"></textarea></td>
    </tr>
    <tr>
    <td align="right">Country</td>
    <td>
         <SELECT name="Country">
              <option value="" selected>[choose yours]
              <option value="008">Albania
              <option value="012">Algeria
              <option value="016">American Samoa
              <option value="020">Andorra
              <option value="024">Angola
              <option value="660">Anguilla
              <option value="010">Antarctica
              <option value="028">Antigua And Barbuda
              <option value="032">Argentina
              <option value="051">Armenia
              <option value="533">Aruba     
         </SELECT>
         </td>
    </tr>
    <tr>
    <td align="right"></td>
    <td><input type="submit" value="Submit"></td>
    </tr>
    </table>
    </form>
    <script language="JavaScript" type="text/javascript">
    //You should create the validator only after the definition of the HTML form
    var frmvalidator = new Validator("myform");
    frmvalidator.addValidation("FirstName","req","Please enter your First Name");
    frmvalidator.addValidation("FirstName","maxlen=20",
         "Max length for FirstName is 20");
    frmvalidator.addValidation("FirstName","alpha");
    frmvalidator.addValidation("LastName","req");
    frmvalidator.addValidation("LastName","maxlen=20");
    frmvalidator.addValidation("Email","maxlen=50");
    frmvalidator.addValidation("Email","req");
    frmvalidator.addValidation("Email","email");
    frmvalidator.addValidation("Phone","maxlen=50");
    frmvalidator.addValidation("Phone","numeric");
    frmvalidator.addValidation("Address","maxlen=50");
    frmvalidator.addValidation("Country","dontselect=0");
    </script>
    </body>
    </html>
    documentation.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
         <title>JavaScript Form Validator Documentation</title>
    <Style>
    BODY, P,TD{ font-family: Arial,Verdana,Helvetica, sans-serif; font-size: 10pt }
    H1{ font-family: Arial,Verdana,Helvetica, sans-serif; font-size: 18pt; color : #000066}
    H3{ font-family: Arial,Verdana,Helvetica, sans-serif; font-size: 12pt; color : #000066 }
    A{font-family: Arial,Verdana,Helvetica, sans-serif;}
    B {     font-family : Arial, Helvetica, sans-serif;     font-size : 12px;     font-weight : bold;}
    CODE {font-family : Courier,monospace;font-size: 10pt;color : #800000;}
    CODE.htm {font-family : "Courier New", Courier, monospace;     font-size : x-small;     color : #000080;}
    </Style>
    </head>
    <body>
    <center>
    <table cellspacing="2" cellpadding="2" border="0" width="600">
    <tr><td>
         <h1>JavaScript Form Validations Made Easy!</h1>
         <h3>Documentation for JavaScript Form Validator</h3>
         <HR size=1>
         <P>
         The Form validation script is distributed free from JavaScript-Coder.com<br>
         You can use the script in your web pages for free.
         </P>
         <P>
         You may please add a link to JavaScript-Coder.com,
         making it easy for others to find this script.<br>
         Checkout the <A href="http://www.javascript-coder.com/links/how-to-link.php
         target="_blank">Give a Link & Get a Link!</A> page.
         </P>
         <P>
         <B>JavaScript Coder</B><br>
         It precisely codes what you imagine!<br>
         Grab your copy here: http://www.javascript-coder.com
         </P>
         <HR size=1>
         <P>
         Using client side JavaScript is an efficient way to validate the user input
         in web applications. When there are many fields in the form, the JavaScript
         validation becomes too complex.
         </P>
         <P>
    The JavaScript class presented here makes the form validations many times easier.
         </P>
         <P>
         The idea is to create a set of "validation descriptors" associated with each element
         in a form. The "validation descriptor" is nothing but a string specifying the type of
         validation to be performed.
         </P>
         <P>
         Each field in the form can have 0, 1, or more validations. For example, the input should
         not be empty, should be less than 25 chars, should be alpha-numeric, etc
         </P>
         You can associate a set of validation descriptors for each input field in the form.
         <a name="3"></a>
         <h3>Using The Script</h3>
         1.Include gen_validatorv2.js in your html file just before closing the HEAD tag<br><br>
         <CODE>
         <script language="JavaScript" src="gen_validatorv2.js" type="text/javascript"></script><BR>
         </head><BR>
         </CODE><br>
         2. Just after defining your form,
         Create a form validator object passing the name of the form<br><br>
         <CODE class='htm'>
          <FORM name='myform' action=""><BR>
          <!----Your input fields go here --><BR>
          </FORM><BR>
         </CODE><CODE>
          <SCRIPT language="JavaScript"><BR>
          var frmvalidator  = new Validator("myform");<BR>
         </CODE>
         <br>
         <br>
         3. Now add the validations required<br><br>
         <CODE>
              frmvalidator.addValidation("FirstName","alpha");
         </CODE><br><br>
         the first argument is the name of the field and the second argument is the
         validation descriptor, which specifies the type of validation to be performed.<br>
         You can add any number of validations.The list of validation descriptors are provided
         at the end of the documentation.<br>
         The optional third argument is the error string to be displayed if the validation
         fails.<br>
         <br>
         <CODE>
              frmvalidator.addValidation("FirstName","alpha");<br>
              frmvalidator.addValidation("FirstName","req","Please enter your First Name");<br>
              frmvalidator.addValidation("FirstName","maxlen=20",<br>
                   "Max length for FirstName is 20");          <br>
         </CODE>     <br>
         <br>
         4. Similarly, add validations for the fields where validation is required.<br>
         That's it! You are ready to go.
         <A name="3"></A>
         <h3>Example</h3>
         The example below will make the idea clearer<br>
         <CODE class="htm">
                   <form action="" name="myform" ><BR>
                   <table cellspacing="2" cellpadding="2" border="0"><BR>
                   <tr><BR>
                     <td align="right">First Name</td><BR>
                     <td><input type="text" name="FirstName"></td><BR>
                   </tr><BR>
                   <tr><BR>
                     <td align="right">Last Name</td><BR>
                     <td><input type="text" name="LastName"></td><BR>
                   </tr><BR>
                   <tr><BR>
                     <td align="right">EMail</td><BR>
                     <td><input type="text" name="Email"></td><BR>
                   </tr><BR>
                   <tr><BR>
                     <td align="right">Phone</td><BR>
                     <td><input type="text" name="Phone"></td><BR>
                   </tr><BR>
                   <tr><BR>
                     <td align="right">Address</td><BR>
                     <td><textarea cols="20" rows="5" name="Address"></textarea></td><BR>
                   </tr><BR>
                   <tr><BR>
                     <td align="right">Country</td><BR>
                     <td><BR>
                          <SELECT name="Country"><BR>
                             <option value="" selected>[choose yours]<BR>
                             <option value="008">Albania<BR>
                             <option value="012">Algeria<BR>
                             <option value="016">American Samoa<BR>
                             <option value="020">Andorra<BR>
                             <option value="024">Angola<BR>
                             <option value="660">Anguilla<BR>
                             <option value="010">Antarctica<BR>
                             <option value="028">Antigua And Barbuda<BR>
                             <option value="032">Argentina<BR>
                             <option value="051">Armenia<BR>
                             <option value="533">Aruba     <BR>
                         </SELECT><BR>
                        </td><BR>
                   </tr><BR>
                   <tr><BR>
                     <td align="right"></td><BR>
                     <td><input type="submit" value="Submit"></td><BR>
                   </tr><BR>
                   </table><BR>
                   </form><BR>
                   </CODE><CODE>
                   <script language="JavaScript" type="text/javascript"><BR>
                    var frmvalidator = new Validator("myform");<BR>
                    frmvalidator.addValidation("FirstName","req","Please enter your First Name");<BR>
                    frmvalidator.addValidation("FirstName","maxlen=20",<BR>
                        "Max length for FirstName is 20");<BR>
                    frmvalidator.addValidation("FirstName","alpha");<BR>
                    <BR>
                    frmvalidator.addValidation("LastName","req");<BR>
                    frmvalidator.addValidation("LastName","maxlen=20");<BR>
                    <BR>
                    frmvalidator.addValidation("Email","maxlen=50");<BR>
                    frmvalidator.addValidation("Email","req");<BR>
                    frmvalidator.addValidation("Email","email");<BR>
                    <BR>
                    frmvalidator.addValidation("Phone","maxlen=50");<BR>
                    frmvalidator.addValidation("Phone","numeric");<BR>
                    <BR>
                    frmvalidator.addValidation("Address","maxlen=50");<BR>
                    frmvalidator.addValidation("Country","dontselect=0");<BR>
                   </script><BR>     
         </CODE>
         <A name="4"></A>
         <h3>Some Additional Notes</h3>
         <LI type="disc">The form validators should be created only after defining the HTML form
         (only after the </form> tag. )<br>
         <LI type="disc">Your form should have a distinguished name.
         If there are more than one form
         in the same page, you can add validators for each of them. The names of the
         forms and the validators should not clash.
         <LI type="disc">You can't use the javascript onsubmit event of the form if it you are
         using this validator script. It is because the validator script automatically overrides the
         onsubmit event. If you want to add a custom validation, see the section below
         </LI>
         <A name="5"></A>
         <h3>Adding Custom Validation</h3>
         If you want to add a custom validation, which is not provided by the validation descriptors,
         you can do so. Here are the steps:
         <LI type="disc">Create a javascript function which returns true or false depending on the validation.<br>
         <CODE>
              function DoCustomValidation()<BR>
              {<BR>
                var frm = document.forms["myform"];<BR>
                if(frm.pwd1.value != frm.pwd2.value)<BR>
                {<BR>
                  alert('The Password and verified password does not match!');<BR>
                  return false;<BR>
                }<BR>
                else<BR>
                {<BR>
                  return true;<BR>
                }<BR>
              }<BR>
         </CODE><br>
         <LI type="disc">Associate the validation function with the validator object.<br>
         <CODE>
         frmvalidator.setAddnlValidationFunction("DoCustomValidation");
         </CODE><br>
         </LI>
         <P>
         The custom validation function will be called automatically after other validations.
         </P>
         <P>
         If you want to do more than one custom validations, you can do all those
         validations in the same function.
         </P>
         <CODE>
              function DoCustomValidation()<BR>
              {<BR>
                var frm = document.forms["myform"];<BR>
                if(false == DoMyValidationOne())<BR>
                {<BR>
                  alert('Validation One Failed!');<BR>
                  return false;<BR>
                }<BR>
                else<BR>
                if(false == DoMyValidationTwo())<BR>
                {<BR>
                  alert('Validation Two Failed!');<BR>
                  return false;<BR>
                }<BR>
                else<BR>
                {<BR>
                  return true;<BR>
                }<BR>
              }<BR>
         </CODE><br>
         where DoMyValidationOne() and DoMyValidationTwo() are custom functions for
         validation.
         <A name="6"></A>
         <h3>Clear All Validations</h3>
         In some dynamically programmed pages, it may be required to change the validations in the
         form at run time. For such cases, a function is included which clears all validations in the
         validator object.<br><br>
         <CODE>
         frmvalidator.clearAllValidations();
         </CODE><br>
         <br>
         this function call clears all validations you set.<br>
         You will not need this method in most cases.
         <a name="7"></a>
         <h3>Table of Validation Descriptors</h3>     
    <table cellspacing="2" cellpadding="2" border="1" width="520px">
    <tr>
    <td><FONT face=Arial size=2>
         required<BR>
         req </FONT>
         </td>
    <td><FONT face=Arial size=2>The field should not be
    empty </FONT>
         </td>
    </tr>
    <tr>
    <td><FONT face=Arial size=2>
         maxlen=???<BR>
         maxlength=???
         </td>
    <td><FONT face=Arial size=2>checks the length entered data to the maximum. For
    example, if the maximum size permitted is 25, give the validation descriptor as "maxlen=25"
         </td>
    </tr>
    <tr>
    <td><FONT face=Arial size=2>
         minlen=???<BR>
         minlength=???
         </td>
    <td><FONT face=Arial size=2>checks the length of the entered string to the
    required minimum. example "minlen=5"
         </td>
    </tr>
    <tr>
    <td><FONT face=Arial size=2>
         alphanumeric /<BR>
         alnum </FONT>
         </td>
    <td><FONT face=Arial size=2>Check the data if it
    contains any other characters other than alphabetic or numeric characters
    </FONT>
         </td>
    </tr>     
    <tr>
    <td><FONT face=Arial size=2>num <BR>
         numeric </FONT>
         </td>
    <td><FONT face=Arial size=2>Check numeric data
    </FONT>
         </td>
    </tr>
    <tr>
    <td><FONT face=Arial size=2>alpha <BR>
         alphabetic </FONT>
         </td>
    <td><FONT face=Arial size=2>Check alphabetic data.
    </FONT>
         </td>
    </tr>     
    <tr>
    <td><FONT face=Arial size=2>email </FONT>
         </td>
    <td><FONT face=Arial size=2>The field is an email
    field and verify the validity of the data. </FONT>
         </td>
    </tr>
    <tr>
    <td><FONT face=Arial size=2>lt=???<BR>
         lessthan=???
         </td>
    <td><FONT face=Arial size=2>
         Verify the data to be less than the value passed.
         Valid only for numeric fields. <BR>
         example: if the
    value should be less than 1000 give validation description as "lt=1000"
         </td>
    </tr>
    <tr>
    <td><FONT face=Arial size=2>gt=???<BR>
         greaterthan=???     </td>
    <td><FONT face=Arial size=2>
         Verify the data to be greater than the value passed.
         Valid only for numeric fields. <BR>
         example: if the
    value should be greater than 10 give validation description as "gt=10"
         </td>
    </tr>
    <tr>
    <td><FONT face=Arial size=2>regexp=??? </FONT>
         </td>
    <td><FONT face=Arial size=2>
         Check with a regular expression the value should match the regular expression.<BR>
         example: "regexp=^[A-Za-z]{1,20}$" allow up to 20 alphabetic
         characters.
         </td>
    </tr>
    <tr>
    <td><FONT face=Arial size=2>dontselect=?? </FONT>
         </td>
    <td><FONT face=Arial size=2>This
    validation descriptor is valid only for select input items (lists)
    Normally, the select list boxes will have one item saying 'Select One' or
    some thing like that. The user should select an option other than this
    option. If the index of this option is 0, the validation description
    should be "dontselect=0"
         </td>
    </tr>
    </table>
         <P>
              <table cellspacing="2" cellpadding="2" border="1" width="520">
              <tr>
              <td>
                   <B>NOTE:</B><br>
                   The HTML Form Wizard included in JavaScript Coder contains still more
                   number of validations
                   (comparison validations, check box & radio button validations and more)<br>
                   Using the wizard, you can add validations to your forms
                   without writing a single line of code! <br>
                   JavaScript Coder takes care of
                   generating the code and inserting the code in to the HTML file.<br>
                   <A href="http://www.javascript-coder.com/index.phtml
                   target="_blank">Read more about JavaScript Coder</A>
                   </td>
              </tr>
              </table>
         </P>
         <A name="8"></A>
         <h3>Example Page</h3>     
         See the <a href="example.html target="_blank"
         >JavaScript form validation example here</a>
    </td>
    </tr>
    <tr><td align="center">
         <HR><br>
         Copyright &copy; 2003 JavaScript-Coder.com. All rights reserved.
    </td></tr>
    </table>     
    </center>
    </body>
    </html>

    The code is not working because you made a mistake somewhere, duh! So figure out what (hint: firefox javascript console, it's your friend) and fix it!
    And next time when you post code: use the [ code ]  tags to pretty format your code, as it is now it's unreadable.
    http://forum.java.sun.com/help.jspa?sec=formatting

  • Please someone help me with this code..

    hi, i have a big problem trying to figure out how to do this, i get this code somewhere in the net, so it's not me who code this, that's why i got this problem.
    this is a MIDlet games, something like gallaga. i like to add some features like the UP and DOWN movement and also i have a problem with his "fire", i can only shoot once after the fire image is gone in the screen, what i liked to have is even i pressed the fire button and press it again the fire will not gone, what i mean continues fire if i pressed everytime the fire button.
    i will post the code here so you can see it and give me some feedback. i need this badly, hoping to all you guys! thanks..for this forum.
    ----CODE BEGIN ---------------
    import java.io.IOException;
    import java.io.PrintStream;
    import java.util.Random;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    import javax.microedition.rms.RecordStore;
    import javax.microedition.rms.RecordStoreException;
    public class MobileGalaga extends MIDlet
    implements CommandListener, Runnable
    class ScoreScreen extends Canvas
    public void paint(Graphics g)
    g.setColor(0xffffff);
    g.fillRect(0, 0, MobileGalaga.WIDTH, MobileGalaga.HEIGHT);
    g.setColor(0x160291);
    g.setFont(MobileGalaga.fs);
    g.drawString("Help", MobileGalaga.CENTERW, 2, 17);
    g.setColor(0);
    g.drawString("Use left/right and fire", MobileGalaga.CENTERW, 20, 17);
    g.drawString("to destory the", MobileGalaga.CENTERW, 30, 17);
    g.drawString("incoming alien MobileGalaga", MobileGalaga.CENTERW, 40, 17);
    public void keyPressed(int i)
    int j = getGameAction(i);
    if(j == 8)
    display.setCurrent(titlescreen);
    ScoreScreen()
    class TitleScreen extends Canvas
    public void paint(Graphics g)
    g.setColor(0xffffff);
    g.fillRect(0, 0, MobileGalaga.WIDTH, MobileGalaga.HEIGHT);
    g.drawImage(MobileGalaga.logoimg, MobileGalaga.CENTERW, 15, 17);
    g.setColor(0);
    g.setFont(MobileGalaga.fs);
    g.drawString("Press 5 to", MobileGalaga.CENTERW, 43, 17);
    g.drawString("see help", MobileGalaga.CENTERW, 53, 17);
    public void keyPressed(int i)
    int j = getGameAction(i);
    if(j == 8)
    display.setCurrent(scorescreen);
    TitleScreen()
    class MainScreen extends Canvas
    public void paint(Graphics g)
    offg.setColor(0xffffff);
    offg.fillRect(0, 0, MobileGalaga.WIDTH, MobileGalaga.HEIGHT);
    for(int i = 0; i < MobileGalaga.slen; i++)
    if(!MobileGalaga.dead)
    offg.drawImage(MobileGalaga.alienimg[MobileGalaga.frame[i]], MobileGalaga.x[i], MobileGalaga.y[i], 17);
    if(!MobileGalaga.playerdead)
    offg.drawImage(MobileGalaga.playerimg, MobileGalaga.px, MobileGalaga.py, 17);
    } else
    if(MobileGalaga.explodeframe < 3)
    offg.drawImage(MobileGalaga.explosionimg[MobileGalaga.explodeframe], MobileGalaga.px, MobileGalaga.py, 17);
    MobileGalaga.explodeframe++;
    if(!MobileGalaga.gameover)
    MobileGalaga.playerpause++;
    if(MobileGalaga.playerpause < 50)
    MobileGalaga.playerpause++;
    } else
    MobileGalaga.playerdead = false;
    MobileGalaga.playerpause = 0;
    MobileGalaga.px = MobileGalaga.CENTERW;
    offg.setColor(0);
    offg.drawString(MobileGalaga.scorestr, MobileGalaga.WIDTH, 0, 24);
    offg.drawImage(MobileGalaga.playerimg, 0, 0, 20);
    offg.drawString(MobileGalaga.lives + "", 12, 0, 20);
    if(MobileGalaga.laser)
    offg.drawLine(MobileGalaga.laserx, MobileGalaga.lasery, MobileGalaga.laserx, MobileGalaga.lasery + 4);
    if(MobileGalaga.showscores)
    for(int j = 0; j < 5; j++)
    if(j == MobileGalaga.rank)
    offg.setColor(0xff0000);
    else
    offg.setColor(0);
    offg.drawString((j + 1) + " .... " + getScoreStr(MobileGalaga.highscore[j]), MobileGalaga.CENTERW, 20 + j * 10, 17);
    if(MobileGalaga.showmessage)
    offg.setColor(0xff0000);
    offg.drawString(MobileGalaga.msg, MobileGalaga.CENTERW, MobileGalaga.CENTERH, 17);
    MobileGalaga.messagepause++;
    if(MobileGalaga.messagepause > 20)
    MobileGalaga.showmessage = false;
    MobileGalaga.messagepause = 0;
    if(MobileGalaga.gameover)
    MobileGalaga.showscores = true;
    else
    if(MobileGalaga.wavecomplete)
    initWave();
    g.drawImage(offimg, 0, 0, 20);
    public void keyPressed(int i)
    int j = getGameAction(i);
    if(j == 2)
    MobileGalaga.playerLeft = true;
    else
    if(j == 5)
    MobileGalaga.playerRight = true;
    else
    if(j == 8)
    fireLaser();
    public void keyReleased(int i)
    int j = getGameAction(i);
    if(j == 2)
    MobileGalaga.playerLeft = false;
    else
    if(j == 5)
    MobileGalaga.playerRight = false;
    private Image offimg;
    private Graphics offg;
    public MainScreen()
    offimg = Image.createImage(getWidth(), getHeight());
    offg = offimg.getGraphics();
    offg.setFont(MobileGalaga.fs);
    public MobileGalaga()
    rand = new Random();
    display = Display.getDisplay(this);
    mainscreen = new MainScreen();
    titlescreen = new TitleScreen();
    scorescreen = new ScoreScreen();
    WIDTH = mainscreen.getWidth();
    HEIGHT = mainscreen.getHeight();
    CENTERW = WIDTH / 2;
    CENTERH = HEIGHT / 2;
    exitCommand = new Command("Exit", 7, 1);
    playCommand = new Command("Play", 1, 1);
    quitCommand = new Command("Quit", 1, 1);
    againCommand = new Command("Again", 1, 1);
    nullCommand = new Command("", 1, 1);
    try
    alienimg[0] = Image.createImage("/alien1.png");
    alienimg[1] = Image.createImage("/alien2.png");
    explosionimg[0] = Image.createImage("/explosion1.png");
    explosionimg[1] = Image.createImage("/explosion2.png");
    explosionimg[2] = Image.createImage("/explosion3.png");
    playerimg = Image.createImage("/player.png");
    logoimg = Image.createImage("/logo.png");
    catch(IOException ioexception)
    db("Couldn't get images!");
    imgW = alienimg[0].getWidth();
    imgH = alienimg[0].getHeight();
    edgeH = imgW / 2;
    edgeV = imgH / 2;
    pimgW = playerimg.getWidth();
    pimgH = playerimg.getHeight();
    pedgeH = pimgW / 2;
    pedgeV = pimgH / 2;
    highscore = getHighScores();
    public void run()
    while(runner)
    rp();
    updatePos();
    try
    MobileGalaga _tmp = this;
    Thread.sleep(75L);
    catch(InterruptedException interruptedexception)
    db("interrupted");
    runner = false;
    MobileGalaga _tmp1 = this;
    Thread.yield();
    public void startApp()
    throws MIDletStateChangeException
    display.setCurrent(titlescreen);
    addBeginCommands(titlescreen, false);
    addBeginCommands(scorescreen, false);
    addPlayCommands(mainscreen, false);
    public void pauseApp()
    public void destroyApp(boolean flag)
    runner = false;
    th = null;
    private void rp()
    mainscreen.repaint();
    private void startGame()
    initGame();
    if(th == null)
    th = new Thread(this);
    runner = true;
    th.start();
    private void initGame()
    px = CENTERW;
    py = HEIGHT - pedgeV - pimgH;
    packcount = 0;
    lives = 3;
    score = 0;
    scorestr = "000000";
    rank = -1;
    difficulty = 400;
    wave = 1;
    initWave();
    private void initWave()
    for(int i = 0; i < slen; i++)
    frame[i] = i % 2;
    x[i] = packX[i] = sposX[i];
    y[i] = packY[i] = sposY[i];
    dx[i] = packdx = alien_dx_right;
    dy[i] = packdy = alien_dy_right;
    dxcount[i] = dycount[i] = 0;
    pmode[i] = 0;
    flying[i] = false;
    dead[i] = false;
    playerLeft = false;
    playerRight = false;
    laser = false;
    playerdead = false;
    showscores = false;
    showmessage = false;
    gameover = false;
    wavecomplete = false;
    playerpause = 0;
    messagepause = 0;
    killed = 0;
    private void updatePos()
    if(playerLeft)
    updatePlayerPos(-2);
    else
    if(playerRight)
    updatePlayerPos(2);
    fly = Math.abs(rand.nextInt() % difficulty);
    if(fly < slen && !flying[fly] && !dead[fly])
    if(x[fly] < CENTERW)
    setDX(fly, alien_dx_flyright, 2);
    setDY(fly, alien_dy_flyright, 2);
    } else
    setDX(fly, alien_dx_flyleft, 2);
    setDY(fly, alien_dy_flyleft, 2);
    flying[fly] = true;
    for(int i = 0; i < slen; i++)
    if(!dead[i])
    if(!flying[i])
    if(x[i] + edgeH + dx[i][dxcount[i]] > WIDTH)
    changePackDir(alien_dx_left, alien_dy_left);
    if((x[i] - edgeH) + dx[i][dxcount[i]] < 0)
    changePackDir(alien_dx_right, alien_dy_right);
    } else
    if(y[i] + edgeV + dy[i][dycount[i]] > HEIGHT)
    x[i] = packX[i];
    y[i] = packY[i];
    flying[i] = false;
    setDX(i, packdx, 0);
    setDY(i, packdy, 0);
    if(!playerdead && y[i] <= py + pedgeV && y[i] >= py - pedgeV && x[i] <= px + pedgeH && x[i] >= px - pedgeH)
    playerHit();
    if(laser && lasery <= y[i] + edgeV && lasery >= y[i] - edgeV && laserx <= x[i] + edgeH && laserx >= x[i] - edgeH)
    alienHit(i);
    for(int j = 0; j < slen; j++)
    if(!dead[j])
    if(framecount == 3)
    frame[j] = frame[j] + 1 < 2 ? 1 : 0;
    lastx = x[j];
    lasty = y[j];
    x[j] += dx[j][dxcount[j]];
    y[j] += dy[j][dycount[j]];
    if(pmode[j] == 0)
    dxcount[j] = dxcount[j] + 1 < dx[j].length ? dxcount[j] + 1 : 0;
    dycount[j] = dycount[j] + 1 < dy[j].length ? dycount[j] + 1 : 0;
    } else
    if(pmode[j] == 2)
    dxcount[j] = dxcount[j] + 1 < dx[j].length ? dxcount[j] + 1 : dxcount[j];
    dycount[j] = dycount[j] + 1 < dy[j].length ? dycount[j] + 1 : dycount[j];
    packX[j] += packdx[packcount];
    packY[j] += packdy[packcount];
    packcount = packcount + 1 < packlen ? packcount + 1 : 0;
    framecount = framecount + 1 < 4 ? framecount + 1 : 0;
    if(laser)
    lasery -= 6;
    if(lasery < 0)
    laser = false;
    private void setDX(int i, int ai[], int j)
    if(i == -1)
    for(int k = 0; k < slen; k++)
    if(!flying[k])
    dx[k] = ai;
    dxcount[k] = 0;
    pmode[k] = j;
    } else
    dx[i] = ai;
    dxcount[i] = 0;
    pmode[i] = j;
    private void setDY(int i, int ai[], int j)
    if(i == -1)
    for(int k = 0; k < slen; k++)
    if(!flying[k])
    dy[k] = ai;
    dycount[k] = 0;
    pmode[k] = j;
    } else
    dy[i] = ai;
    dycount[i] = 0;
    pmode[i] = j;
    private void changePackDir(int ai[], int ai1[])
    setDX(-1, ai, 0);
    setDY(-1, ai1, 0);
    packdx = ai;
    packdy = ai1;
    packcount = 0;
    private void updatePlayerPos(int i)
    plastx = px;
    px += i;
    if(px + pedgeH > WIDTH || px - pedgeH < 0)
    px = plastx;
    private void fireLaser()
    if(!laser)
    laser = true;
    laserx = px;
    lasery = py;
    private void alienHit(int i)
    if(!playerdead)
    dead[i] = true;
    laser = false;
    killed++;
    if(flying[i])
    score += 200;
    else
    score += 50;
    if(killed == slen)
    waveComplete();
    scorestr = getScoreStr(score);
    private void playerHit()
    playerdead = true;
    playerpause = 0;
    explodeframe = 0;
    lives--;
    if(lives == 0)
    gameOver();
    private void waveComplete()
    wavecomplete = true;
    difficulty -= 100;
    if(difficulty < 100)
    difficulty = 100;
    msg = "WAVE " + wave + " COMPLETE";
    messagepause = 0;
    showmessage = true;
    wave++;
    score += 1000 * wave;
    scorestr = getScoreStr(score);
    private void gameOver()
    gameover = true;
    msg = "GAME OVER";
    for(int i = 0; i < 5; i++)
    if(score < highscore[i])
    continue;
    for(int j = 4; j > i; j--)
    highscore[j] = highscore[j - 1];
    highscore[i] = score;
    rank = i;
    break;
    setHighScores();
    showmessage = true;
    messagepause = 0;
    addEndCommands(mainscreen, true);
    private void addBeginCommands(Displayable displayable, boolean flag)
    if(flag)
    removeCommands();
    displayable.addCommand(playCommand);
    displayable.addCommand(exitCommand);
    displayable.setCommandListener(this);
    private void addPlayCommands(Displayable displayable, boolean flag)
    if(flag)
    removeCommands();
    displayable.addCommand(nullCommand);
    displayable.addCommand(quitCommand);
    displayable.setCommandListener(this);
    private void addEndCommands(Displayable displayable, boolean flag)
    if(flag)
    removeCommands();
    displayable.addCommand(againCommand);
    displayable.addCommand(quitCommand);
    displayable.setCommandListener(this);
    private void removeCommands()
    Displayable displayable = display.getCurrent();
    displayable.removeCommand(nullCommand);
    displayable.removeCommand(quitCommand);
    displayable.removeCommand(againCommand);
    displayable.removeCommand(playCommand);
    displayable.removeCommand(exitCommand);
    public void commandAction(Command command, Displayable displayable)
    if(command == playCommand)
    display.setCurrent(mainscreen);
    startGame();
    if(command == quitCommand)
    runner = false;
    while(th.isAlive()) ;
    th = null;
    addPlayCommands(mainscreen, true);
    display.setCurrent(titlescreen);
    if(command == againCommand)
    runner = false;
    while(th.isAlive()) ;
    th = null;
    display.setCurrent(mainscreen);
    addPlayCommands(mainscreen, true);
    startGame();
    if(command == exitCommand)
    destroyApp(false);
    notifyDestroyed();
    private int[] getHighScores()
    int ai[] = new int[5];
    ai[0] = 5000;
    ai[1] = 4000;
    ai[2] = 3000;
    ai[3] = 2000;
    ai[4] = 1000;
    byte abyte0[][] = new byte[5][6];
    try
    hsdata = RecordStore.openRecordStore("MobileGalaga", true);
    int i = hsdata.getNumRecords();
    if(i == 0)
    for(int j = 0; j < 5; j++)
    abyte0[j] = Integer.toString(ai[j]).getBytes();
    hsdata.addRecord(abyte0[j], 0, abyte0[j].length);
    } else
    for(int k = 0; k < 5; k++)
    abyte0[k] = hsdata.getRecord(k + 1);
    String s = "";
    for(int l = 0; l < abyte0[k].length; l++)
    s = s + (char)abyte0[k][l] + "";
    ai[k] = Integer.parseInt(s);
    catch(RecordStoreException recordstoreexception)
    db("problem with initialising highscore data\n" + recordstoreexception);
    return ai;
    private void setHighScores()
    byte abyte0[][] = new byte[5][6];
    try
    hsdata = RecordStore.openRecordStore("MobileGalaga", true);
    for(int i = 0; i < 5; i++)
    abyte0[i] = Integer.toString(highscore[i]).getBytes();
    hsdata.setRecord(i + 1, abyte0[i], 0, abyte0[i].length);
    catch(RecordStoreException recordstoreexception)
    db("problem with setting highscore data\n" + recordstoreexception);
    private String getScoreStr(int i)
    templen = 6 - (i + "").length();
    tempstr = "";
    for(int j = 0; j < templen; j++)
    tempstr = tempstr + "0";
    return tempstr + i;
    public static void db(String s)
    System.out.println(s);
    public static void db(int i)
    System.out.println(i + "");
    private Display display;
    private Command exitCommand;
    private Command playCommand;
    private Command quitCommand;
    private Command againCommand;
    private Command nullCommand;
    private MainScreen mainscreen;
    private TitleScreen titlescreen;
    private ScoreScreen scorescreen;
    private static int WIDTH;
    private static int HEIGHT;
    private static int CENTERW;
    private static int CENTERH;
    private boolean runner;
    private Thread th;
    private Random rand;
    private static final int RED = 0xff0000;
    private static final int ORANGE = 0xff9100;
    private static final int YELLOW = 0xffff00;
    private static final int WHITE = 0xffffff;
    private static final int BLACK = 0;
    private static final int BLUE = 0x160291;
    private static Image alienimg[] = new Image[2];
    private static Image explosionimg[] = new Image[3];
    private static Image playerimg;
    private static Image logoimg;
    private static int imgH;
    private static int imgW;
    private static int pimgH;
    private static int pimgW;
    private static int edgeH;
    private static int edgeV;
    private static int pedgeH;
    private static int pedgeV;
    private static final Font fs = Font.getFont(64, 0, 8);
    private static final Font fl = Font.getFont(64, 1, 16);
    private static final int sposX[] = {
    16, 28, 40, 52, 4, 16, 28, 40, 52, 64,
    4, 16, 28, 40, 52, 64
    private static final int sposY[] = {
    14, 14, 14, 14, 26, 26, 26, 26, 26, 26,
    38, 38, 38, 38, 38, 38
    private static final int LOOP = 0;
    private static final int ONCE = 1;
    private static final int HOLD = 2;
    private static final int move_none[] = {
    0
    private static final int alien_dx_right[] = {
    1, 1, 1, 1, 1, 1, 1, 1
    private static final int alien_dy_right[] = {
    0, 0, 1, 1, 0, 0, -1, -1
    private static final int alien_dx_left[] = {
    -1, -1, -1, -1, -1, -1, -1, -1
    private static final int alien_dy_left[] = {
    0, 0, -1, -1, 0, 0, 1, 1
    private static final int alien_dx_flyright[] = {
    1, 1, 1, 0, -1, -1, -1, -1, -1, 0,
    1, 1, 2, 3, 4, 5, 6
    private static final int alien_dy_flyright[] = {
    0, -1, -1, -1, -1, -1, 0, 1, 1, 1,
    1, 1, 2, 3, 4, 5, 6
    private static final int alien_dx_flyleft[] = {
    -1, -1, -1, 0, 1, 1, 1, 1, 1, 0,
    -1, -1, -2, -3, -4, -5, -6
    private static final int alien_dy_flyleft[] = {
    0, -1, -1, -1, -1, -1, 0, 1, 1, 1,
    1, 1, 2, 3, 4, 5, 6
    private static final int slen;
    private static final int ailen;
    private static final int packlen;
    private static int pmode[];
    private static int x[];
    private static int y[];
    private static int dx[][];
    private static int dy[][];
    private static int dxcount[];
    private static int dycount[];
    private static int frame[];
    private static boolean flying[];
    private static boolean dead[];
    private static boolean exploding[];
    private static int lastx;
    private static int lasty;
    private static int fly;
    private static int packX[];
    private static int packY[];
    private static int packdx[];
    private static int packdy[];
    private static int packcount;
    private static int framecount = 3;
    private static int px;
    private static int py;
    private static int plastx;
    private static int score;
    private static String scorestr;
    private static int lives;
    private static int killed;
    private static boolean playerdead;
    private static int explodeframe;
    private static int playerpause;
    private static int rank;
    private static boolean playerLeft;
    private static boolean playerRight;
    private static boolean laser;
    private static int laserx;
    private static int lasery;
    private static RecordStore hsdata;
    private static int highscore[] = new int[5];
    private static boolean showmessage;
    private static boolean showscores;
    private static boolean gameover;
    private static boolean wavecomplete;
    private static int messagepause;
    private static String msg;
    private static int difficulty;
    private static int wave;
    private static String tempstr;
    private static int templen;
    static
    slen = sposX.length;
    ailen = alien_dx_flyright.length;
    packlen = alien_dx_right.length;
    pmode = new int[slen];
    x = new int[slen];
    y = new int[slen];
    dx = new int[slen][ailen];
    dy = new int[slen][ailen];
    dxcount = new int[slen];
    dycount = new int[slen];
    frame = new int[slen];
    flying = new boolean[slen];
    dead = new boolean[slen];
    exploding = new boolean[slen];
    packX = new int[slen];
    packY = new int[slen];
    packdx = new int[packlen];
    packdy = new int[packlen];
    ----END OF CODE ----------------

    hi sorry if it's too big! i hope i can explain this very well (you know i only got this code in the net), if you try to run the program in emulator, the and lunch it will it will first display the title screen and if you hit the pressed key 5 it will display help,
    so my problem is how to move UP and DOWN and also if i pressed the fire button it will continue to fire. here is the code.
    //Code for the Left,Right,UP and Down movement and also the fire
    public void keyPressed(int i)
    int j = getGameAction(i);
    if(j == 2)
    MobileGalaga.playerLeft = true; //this is ok
    else
    if(j == 5)
    MobileGalaga.playerRight = true; //this is ok
    else
    if(j==1)
    MobileGalaga.playerUp = true; //i add this only, this has a problem
    else
    if(j==6)
    MobileGalaga.playerDown = true; //i add this only, this has a problem
    else
    if(j == 8)
    fireLaser(); //for the release of fire
    //for the release of key pressed
    public void keyReleased(int i)
    int j = getGameAction(i);
    if(j == 2)
    MobileGalaga.playerLeft = false;
    else
    if(j == 5)
    MobileGalaga.playerRight = false;
    //Update the position base on key pressed
    private void updatePos()
    if(playerLeft)
    updatePlayerPos(-5);
    else
    if(playerUp)
    updatePlayerPos1(-4);
    else
    if(playerDown)
    updatePlayerPos1(4);
    else
    if(playerRight)
    updatePlayerPos(5);
    fly = Math.abs(rand.nextInt() % difficulty);
    if(fly < slen && !flying[fly] && !dead[fly])
    if(x[fly] < CENTERW)
    setDX(fly, alien_dx_flyright, 2);
    setDY(fly, alien_dy_flyright, 2);
    } else
    setDX(fly, alien_dx_flyleft, 2);
    setDY(fly, alien_dy_flyleft, 2);
    flying[fly] = true;
    for(int i = 0; i < slen; i++)
    if(!dead)
    if(!flying[i])
    if(x[i] + edgeH + dx[i][dxcount[i]] > WIDTH)
    changePackDir(alien_dx_left, alien_dy_left);
    if((x[i] - edgeH) + dx[i][dxcount[i]] < 0)
    changePackDir(alien_dx_right, alien_dy_right);
    } else
    if(y[i] + edgeV + dy[i][dycount[i]] > HEIGHT)
    x[i] = packX[i];
    y[i] = packY[i];
    flying[i] = false;
    setDX(i, packdx, 0);
    setDY(i, packdy, 0);
    if(!playerdead && y[i] <= py + pedgeV && y[i] >= py - pedgeV && x[i] <= px + pedgeH && x[i] >= px - pedgeH)
    playerHit();
    if(laser && lasery <= y[i] + edgeV && lasery >= y[i] - edgeV && laserx <= x[i] + edgeH && laserx >= x[i] - edgeH)
    alienHit(i);
    for(int j = 0; j < slen; j++)
    if(!dead[j])
    if(framecount == 3)
    frame[j] = frame[j] + 1 < 2 ? 1 : 0;
    lastx = x[j];
    lasty = y[j];
    x[j] += dx[j][dxcount[j]];
    y[j] += dy[j][dycount[j]];
    if(pmode[j] == 0)
    dxcount[j] = dxcount[j] + 1 < dx[j].length ? dxcount[j] + 1 : 0;
    dycount[j] = dycount[j] + 1 < dy[j].length ? dycount[j] + 1 : 0;
    } else
    if(pmode[j] == 2)
    dxcount[j] = dxcount[j] + 1 < dx[j].length ? dxcount[j] + 1 : dxcount[j];
    dycount[j] = dycount[j] + 1 < dy[j].length ? dycount[j] + 1 : dycount[j];
    packX[j] += packdx[packcount];
    packY[j] += packdy[packcount];
    packcount = packcount + 1 < packlen ? packcount + 1 : 0;
    framecount = framecount + 1 < 4 ? framecount + 1 : 0;
    if(laser)
    lasery -= 6;
    if(lasery < 0 )
    laser = false;
    // this will move the object UP,DOWN,Left and Right
    private void updatePlayerPos(int i)
    plastx = px;
    px += i;
    if(px + pedgeH > WIDTH || px - pedgeH < 0)
    px = plastx;
    private void updatePlayerPos1(int i)
    plastx = py;
    py += i;
    if(px + pedgeV > HEIGHT || px - pedgeV < 0)
    px = plastx;
    // This will fire, if you hit the fire button
    private void fireLaser()
    if(!laser)
    laser = true;
    laserx = px;
    lasery = py;
    sorry if it's too long i just want too explain this. if anyone like to see this and run so that you can see it also, i can send an email.
    thanks,
    alek

  • How to improve the performance of this code

    Hi gurus
    code is given below with LDB
    this code look big but most of lines are commented
    plz help its urgent
    thanks in advance
    *& Report  ZSALES_RECON
    REPORT  ZSALES_RECON.
    TYPE-POOLS : SLIS.
    nodes: bseg , bkpf.
    data : begin of zbseg occurs 0,
    kunnr like bseg-kunnr,
    *lifnr like bseg-lifnr,
    dmbtr like bseg-dmbtr,
    *shkzg like bseg-shkzg,
    *gsber like bseg-gsber,
    bschl like bseg-bschl,
    *sgtxt like bseg-sgtxt,
    total like bseg-dmbtr,
    hkont like bseg-hkont,
    BUDAT LIKE Bkpf-BUDAT,
    belnr LIKE BSEG-belnr,
    cash like bseg-dmbtr,
    credit like bseg-dmbtr,
    abn_voucher like bseg-dmbtr,
    barista_voucher like bseg-dmbtr,
    accor like bseg-dmbtr,
    sodexho like bseg-dmbtr,
    gift like bseg-dmbtr,
    corp like bseg-dmbtr,
    card like bseg-dmbtr,
    miscellaneous like bseg-dmbtr,
    werks like bseg-werks,
    gjahr like bseg-gjahr,
    SR_NO TYPE I,
    shkzg like bseg-shkzg,
          end of zbseg,
          TP_TBL_DATA like ZBSEG.
        DATA  : idx TYPE sy-tabix.
    Report data to be shown.
    data: it_data like ZBSEG.
    Heading of the report.
    data: t_heading type slis_t_listheader.
    AT SELECTION-SCREEN.
    get bkpf.
    START-OF-SELECTION.
    data : sum_mis like bseg-dmbtr,
           sum_abn like bseg-dmbtr,
           sum_cash like bseg-dmbtr,
           sum_credit like bseg-dmbtr,
           sum_card like bseg-dmbtr,
           sum_barista_voucher like bseg-dmbtr,
           sum_accor like bseg-dmbtr,
           sum_sodexho like bseg-dmbtr,
           sum_gift like bseg-dmbtr,
           sum_corp like bseg-dmbtr.
    data : wa1_total like bseg-dmbtr.
    data : wa_belnr like bseg-belnr,
           wa_kunnr like bseg-kunnr,
           wa_werks like bseg-werks,
           belnr1 like bseg-belnr,
           wa_sr_no type i.
    GET BSEG.
    data : wa like line of zbseg.
    data : count type i,
           count1 type i.
    move-corresponding bseg to zbseg.
    *idx = sy-tabix.
    on change of zbseg-belnr.
    wa_kunnr = zbseg-kunnr.
    wa_kunnr = wa_kunnr+6(4).
    select single werks into wa_werks from bseg where belnr = zbseg-belnr
    and kunnr = '' and gjahr = zbseg-gjahr.
    if wa_kunnr = wa_werks.
    if zbseg-bschl <> '01'.
    clear: sum_mis,wa1_total,sum_abn,sum_cash,sum_credit,sum_card,
    sum_barista_voucher,sum_accor,sum_sodexho,sum_gift,sum_corp.
    wa-BUDAT = BKPF-BUDAT.
    wa-bschl = zbseg-bschl.
    wa-hkont = zbseg-hkont.
    wa-belnr = zbseg-belnr.
    wa_belnr = wa-belnr.
    wa-shkzg = zbseg-shkzg.
    wa-kunnr = zbseg-kunnr.
    count = wa-sr_no.
    *wa-sr_no = count + 1.
    idx = idx + 1.
    append wa to zbseg.
    **count = wa-sr_no.
    *wa-sr_no = wa-sr_no + 1.
    clear wa-total.
    endif.
    endif.
    endon.
    *clear : wa1_total.
    if wa_belnr = zbseg-belnr.
    loop at zbseg into wa.
    wa-total = wa1_total.
    wa-bschl = zbseg-bschl.
    wa-hkont = zbseg-hkont.
    count = sy-tabix.
    wa-sr_no = count.
    count1 = count.
    *wa_sr_no = count.
    modify zbseg from wa transporting sr_no.
    IF wa-bschl eq  '40' and wa-hkont eq '0024013020'.
    if sy-tabix = 1.
    wa-cash  = zbseg-dmbtr.
    sum_cash = sum_cash + wa-cash.
    wa-cash = sum_cash.
    modify zbseg index idx from wa transporting cash.
    endif.
    endif.
    IF wa-bschl eq  '40' and wa-hkont eq '0026060010'.
       if sy-tabix = 1.
    wa-credit  = zbseg-dmbtr.
    sum_credit = sum_credit + wa-credit.
    wa-credit = sum_credit.
    modify zbseg index idx from wa transporting credit.
    endif.
    endif.
    IF wa-bschl eq  '40' and wa-hkont eq '0026060015'.
    if sy-tabix = 1.
    wa-abn_voucher  = zbseg-dmbtr.
    sum_abn = sum_abn + wa-abn_voucher.
    wa-abn_voucher = sum_abn.
    modify zbseg index idx from wa transporting abn_voucher.
    endif.
    endif.
    IF wa-bschl eq  '40' and wa-hkont eq '0026060017'.
    if sy-tabix = 1.
    wa-barista_voucher  = zbseg-dmbtr.
    sum_barista_voucher = sum_barista_voucher + wa-barista_voucher.
    wa-barista_voucher = sum_barista_voucher.
    modify zbseg  index idx from wa transporting barista_voucher.
    endif.
    endif.
    IF wa-bschl eq  '40' and wa-hkont eq '0026060020'.
    if sy-tabix = 1.
    wa-sodexho  = zbseg-dmbtr.
    sum_sodexho = sum_sodexho + wa-sodexho.
    wa-sodexho = sum_sodexho.
    modify zbseg index idx from wa transporting sodexho.
    endif.
    endif.
    IF wa-bschl eq  '40' AND  wa-hkont eq '0026060030'.
    if sy-tabix = 1.
    wa-accor  = zbseg-dmbtr.
    sum_accor = sum_accor + wa-accor.
    wa-accor = sum_accor.
    modify zbseg  index idx from wa transporting accor.
    endif.
    endif.
    IF wa-bschl eq  '40' AND  wa-hkont eq '0026070040'.
    if sy-tabix = 1.
    wa-gift  = zbseg-dmbtr.
    sum_gift = sum_gift + wa-gift.
    wa-gift = sum_gift.
    modify zbseg index idx from wa transporting gift.
    endif.
    endif.
    IF wa-bschl eq  '40' AND  wa-hkont eq '0026060070'.
    if sy-tabix = 1.
    wa-card  = zbseg-dmbtr.
    sum_card = sum_card + wa-card.
    wa-card = sum_card.
    modify zbseg index idx from wa transporting card.
    endif.
    endif.
    IF wa-bschl eq  '40' AND  wa-hkont eq '0026060018'.
    if sy-tabix = 1.
    wa-corp  = zbseg-dmbtr.
    sum_corp = sum_corp + wa-corp.
    wa-corp = sum_corp.
    modify zbseg index idx from wa transporting corp.
    endif.
    endif.
    *IF wa-bschl eq  '11' .
    *wa-total  = zbseg-dmbtr.
    *modify zbseg index idx from wa transporting total.
    *endif.
    IF wa-bschl EQ  '40'  or wa-bschl = '01' .
    if sy-tabix = 1.
    wa-total = zbseg-dmbtr.
    wa1_total = wa1_total + wa-total.
    wa-total = wa1_total.
    *if idx = 2.
    *modify zbseg index 1 from wa transporting total.
    *else.
    modify zbseg  index idx from wa transporting total.
    *endif.
    endif.
    endif.
    *IF zbseg-TOTAL NE zbseg-DMBTR.
    IF wa-BSCHL NE '11' AND wa-BSCHL NE '40'. "AND wa-BSCHL NE '01'.
    if sy-tabix = 1.
    if wa-shkzg = 'S'.
    wa-miscellaneous = - wa-miscellaneous.
    endif.
    wa-miscellaneous =  ZBSEG-DMBTR.
    sum_mis = sum_mis + wa-miscellaneous.
    wa-miscellaneous = sum_mis.
    modify zbseg index idx from wa transporting miscellaneous.
    endif.
    ENDIF.
    *wa1-miscellaneous = wa-miscellaneous.
    *modify zbseg index idx from wa.
    *ENDIF.
    *append wa to zbseg.
    *clear:zbseg-dmbtr.
    endloop.
    endif.
    *****endif.
    *****endon.
    *ENDFORM.
    *append zbseg.
    *endloop.
    End-of-selection.
      perform build_alv using zbseg t_heading.
    *&      Form  build_alv
          Builds and display the ALV Grid.
    form build_alv using t_data
    *tp_tbl_data
                         t_heading  type slis_t_listheader.
    ALV required data objects.
    data: w_title   type lvc_title,
          w_repid   type syrepid,
          w_comm    type slis_formname,
          w_status  type slis_formname,
          x_layout  type slis_layout_alv,
          t_event    type slis_t_event,
          t_fieldcat type slis_t_fieldcat_alv,
          t_sort     type slis_t_sortinfo_alv.
    refresh t_fieldcat.
    refresh t_event.
    refresh t_sort.
    clear x_layout.
    clear w_title.
    Field Catalog
      perform set_fieldcat2 using:
    1 'SR_NO' 'SR_NO' 'BKPF' '5' space  space  'SR NO'  space  space space
    space space space space space t_fieldcat ,
    2 'BELNR' 'BELNR' 'BKPF' '10' space  space  'Document No'  space  space
    space space space space space space t_fieldcat ,
    3 'BUDAT' 'BUDAT' 'BKPF' '10' space  space  'Document Date'  space
    space space space space space space space t_fieldcat ,
    4 'KUNNR' space space  space space  space  'Site'  space  space
    space space space space space space t_fieldcat ,
    5 'TOTAL' space 'BSEG' space space  space  'Total'  space  space space
    space space space space 'X' t_fieldcat ,
    6 'CASH' 'CASH' 'BSEG' space space  space  'Cash Sales'
      space  space space space space space space 'X' t_fieldcat ,
    7 'CREDIT' 'CREDIT' 'BSEG' space space  space  'Credit Card'
    space space space space space space space 'X' t_fieldcat ,
    8 'ABN_VOUCHER' space 'BSEG' space space  space  'ABN Voucher'  space
    space
    space space space space space 'X' t_fieldcat ,
    9 'BARISTA_VOUCHER' space 'BSEG' '15' space  space  'BARISTA Voucher'
    space  space
    space space space space space 'X' t_fieldcat ,
    10 'CORP' 'CORP' 'BSEG' space space  space  'ABN Corp'  space  space
    space space space space space 'X' t_fieldcat ,
    11 'SODEXHO' 'SODEXHO' 'BSEG' space space  space  'Sodexho'  space
    space space space space space space 'X' t_fieldcat ,
    12 'ACCOR' 'ACCOR' 'BSEG' space space  space  'Accor'
    space  space space space space space space 'X' t_fieldcat ,
    13 'GIFT' 'GIFT' 'BSEG' space space  space  'Gift Coupon'
    space  space space space space space space 'X' t_fieldcat ,
    14 'CARD' 'CARD' 'BSEG' space space  space  'Diners Card'  space
    space space space space space space 'X' t_fieldcat ,
    15 'MISCELLANEOUS' space 'BKPF' '18' space  space
    'Miscellaneous Income' space space space space space space space 'X'
    t_fieldcat .
    *14 'KBETR' 'KBETR' 'KONP' '10' space  space  'Tax %age'  space  space
    *space space space space space space t_fieldcat ,
    *15 'MWSKZ1' 'MWSKZ1' 'RBKP' space space  space  'Tax Type'  space
    *space
    space space space space space space t_fieldcat ,
    *16 'AMT' 'AMT' 'RBKP' space space  space  'Amount Payable'  space
    *space
    space space space space space 'X' t_fieldcat ,
    *17 'WERKS' 'SITE' 'RSEG' space space  space  'State'  space  space
    *space space space space space space t_fieldcat .
    *18 'GSBER' 'GSBER' 'RBKP' space space  space  'Business Area'  space
    *space space space space space space space t_fieldcat .
    Layout
    x_layout-zebra = 'X'.
    Top of page heading
      perform set_top_page_heading using t_heading t_event.
    Events
      perform set_events using t_event.
    GUI Status
      w_status = ''.
      w_repid = sy-repid.
    Title
    w_title = <<If you want to set a title for
                the ALV, please, uncomment and edit this line>>.
    User commands
      w_comm   = 'USER_COMMAND'.
    Order
    Example
    PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
    Displays the ALV grid
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program       = w_repid
          it_fieldcat              = t_fieldcat
          is_layout                = x_layout
          it_sort                  = t_sort
          i_callback_pf_status_set = w_status
          i_callback_user_command  = w_comm
          i_save                   = 'X'
          it_events                = t_event
          i_grid_title             = w_title
        tables
          t_outtab                 = zbseg
         t_data
        exceptions
          program_error            = 1
          others                   = 2.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endform.                    " build_alv.
    *&      Form  set_top_page_heading
          Creates the report headings.
    form set_top_page_heading using t_heading type slis_t_listheader
                                    t_events  type slis_t_event.
    data: x_heading type slis_listheader,
          x_event   type line of slis_t_event.
    Report title
      clear t_heading[].
      clear x_heading.
      x_heading-typ = 'H'.
      x_heading-info = 'SALES RECONCILIATION REPORT'(001).
      append x_heading to t_heading.
    Top of page event
      x_event-name = slis_ev_top_of_page.
      x_event-form = 'TOP_OF_PAGE'.
      append x_event to t_events.
    endform.
    *&      Form  set_events
          Sets the events for ALV.
          The TOP_OF_PAGE event is alredy being registered in
          the set_top_page_heading subroutine.
    form set_events using t_events type slis_t_event.
    data: x_event   type line of slis_t_event.
    Example
    clear x_event.
    x_event-name = .
    x_event-form = .
    append x_event to t_event.
    endform.
    *&      Form  set_order
          Adds an entry to the order table.
    FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
                         t_sort TYPE slis_t_sortinfo_alv.
      DATA: x_sort TYPE slis_sortinfo_alv.
      CLEAR x_sort.
      x_sort-fieldname = p_fieldname.
      x_sort-tabname   = p_tabname.
      x_sort-up = p_up.
      x_sort-down = p_down.
      x_sort-subtot = p_subtot.
      APPEND x_sort TO t_sort.
    ENDFORM.                    "set_order
    *&      Form  set_fieldcat2
          Adds an entry to the field catalog.
       p_colpos: Column position.
       p_fieldname: Field of internal table which is being described by
    *            this record of the field catalog.
       p_ref_fieldname: (Optional) Table field / data element which
    *                describes the properties of the field.
    *                If this field is not given, it is copied from
    *                the fieldname.
       p_ref_tabname: (Optional) Table which holds the field referenced
    *              by <<p_ref_fieldname>>.
                      If this is not given, the parameter
                      <<p_ref_fieldname>> references a data element.
       p_outputlen: (Optional) Column width.
       p_noout: (Optional) If set to 'X', states that the field is not
    *           showed initially. If so, the field has to be
                included in the report at runtime using the display
                options.
       p_seltext_m: (Optional) Medium label to be used as column header.
       p_seltext_l: (Optional) Long label to be used as column header.
       p_seltext_s: (Optional) Small label to be used as column header.
       p_reptext_ddic: (Optional) Extra small (heading) label to be
    *                used as column header.
       p_ddictxt: (Optional) Set to 'L', 'M', 'S' or 'R' to select
                  whether to use SELTEXT_L, SELTEXT_M, SELTEXT_S,
                  or REPTEXT_DDIC as text for column header.
       p_hotspot: (Optional) If set to 'X', this field will be used
    *             as a hotspot area for cursor, alolowing the user
    *          to click on the field.
       p_showasicon: (Optional) If set to 'X', this field will be shown
                     as an icon and the contents of the field will set
    *             which icon to show.
       p_checkbox: (Optional) If set to 'X', this field will be shown
                   as a checkbox.
       p_edit: (Optional) If set to 'X', this field will be editable.
       p_dosum: (Optional) If set to 'X', this field will be summed
                (aggregation function) according to the grouping set
                by the order functions.
       t_fieldcat: Table which contains the whole fieldcat.
    FORM set_fieldcat2 USING
          p_colpos p_fieldname p_ref_fieldname p_ref_tabname
          p_outputlen p_noout
          p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
          p_hotspot p_showasicon p_checkbox p_edit
          p_dosum
          t_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: wa_fieldcat TYPE slis_fieldcat_alv.
      CLEAR wa_fieldcat.
    General settings
      wa_fieldcat-fieldname = p_fieldname.
      wa_fieldcat-col_pos = p_colpos.
      wa_fieldcat-no_out = p_noout.
      wa_fieldcat-hotspot = p_hotspot.
      wa_fieldcat-checkbox = p_checkbox.
      wa_fieldcat-icon = p_showasicon.
      wa_fieldcat-do_sum = p_dosum.
    Set reference fieldname, tablenam and rollname.
    If p_ref_tabname is not given, the ref_fieldname given
       is a data element.
    If p_ref_tabname is given, the ref_fieldname given is a
       field of a table.
    In case ref_fieldname is not given,
       it is copied from the fieldname.
      IF p_ref_tabname IS INITIAL.
        wa_fieldcat-rollname =   p_ref_fieldname.
      ELSE.
        wa_fieldcat-ref_tabname = p_ref_tabname.
        IF p_ref_fieldname EQ space.
          wa_fieldcat-ref_fieldname =   wa_fieldcat-fieldname.
        ELSE.
          wa_fieldcat-ref_fieldname =   p_ref_fieldname.
        ENDIF.
      ENDIF.
    Set output length.
      IF NOT p_outputlen IS INITIAL.
        wa_fieldcat-outputlen = p_outputlen.
      ENDIF.
    Set text headers.
      IF NOT p_seltext_m IS INITIAL.
        wa_fieldcat-seltext_m = p_seltext_m.
      ENDIF.
      IF NOT p_seltext_l IS INITIAL.
        wa_fieldcat-seltext_l = p_seltext_l.
      ENDIF.
      IF NOT p_seltext_s IS INITIAL.
        wa_fieldcat-seltext_s = p_seltext_s.
      ENDIF.
      IF NOT p_reptext_ddic IS INITIAL.
        wa_fieldcat-reptext_ddic = p_reptext_ddic.
      ENDIF.
      IF NOT p_ddictxt IS INITIAL.
        wa_fieldcat-ddictxt = p_ddictxt.
      ENDIF.
    Set as editable or not.
      IF NOT p_edit IS INITIAL.
        wa_fieldcat-input     = 'X'.
        wa_fieldcat-edit     = 'X'.
      ENDIF.
      APPEND wa_fieldcat TO t_fieldcat.
    ENDFORM.                   "set_fieldcat2
    ======================== Subroutines called by ALV ================
    *&      Form  top_of_page
          Called on top_of_page ALV event.
          Prints the heading.
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
        i_logo             = <<If you want to set a logo, please,
                             uncomment and edit this line>>
          it_list_commentary = t_heading.
    endform.                    " alv_top_of_page
    *&      Form  user_command
          Called on user_command ALV event.
          Executes custom commands.
    form user_command using r_ucomm     like sy-ucomm
                            rs_selfield type slis_selfield.
    Example Code
    Executes a command considering the sy-ucomm.
    CASE r_ucomm.
       WHEN '&IC1'.
         Set your "double click action" response here.
         Example code: Create and display a status message.
         DATA: w_msg TYPE string,
               w_row(4) TYPE n.
         w_row = rs_selfield-tabindex.
         CONCATENATE 'You have clicked row' w_row
                     'field' rs_selfield-fieldname
                     'with value' rs_selfield-value
                     INTO w_msg SEPARATED BY space.
         MESSAGE w_msg TYPE 'S'.
    ENDCASE.
    End of example code.
    endform.                    "user_command
    *********************************ldb code start from here *************************************************************
         DATABASE PROGRAM OF LOGICAL DATABASE ZBRM_3
      top-include and nxxx-include are generated automatically
      Do NOT change their names manually!!!
    *include DBZBRM_3TOP . " header
    *include DBZBRM_3NXXX . " all system routines
    include DBZBRM_3F001 . " user defined include
    PROGRAM SAPDBZBRM_3 DEFINING DATABASE ZBRM_3.
    TABLES:
        BKPF,
        BSEG.
    Hilfsfelder
    DATA:
       BR_SBUKRS LIKE BKPF-BUKRS,
        BR_SBELNR LIKE BKPF-BELNR,
        BR_SGJAHR LIKE BKPF-GJAHR,
        BR_SBUDAT LIKE BKPF-BUDAT,
        BR_SGSBER LIKE BSEG-GSBER.
       BR_SBUZEI LIKE BSEG-BUZEI,
       BR_SEBELN LIKE BSEG-EBELN,
       BR_SEBELP LIKE BSEG-EBELP,
       BR_SZEKKN LIKE BSEG-ZEKKN.
    working areas for the authority check                     "n435991
    for the company code                                      "n435991
    *TYPES : BEGIN OF STYPE_BUKRS,                               "n435991
             BUKRS              LIKE  T001-BUKRS,              "n435991
             WAERS              LIKE  T001-WAERS,              "n435991
             RETCODE            TYPE  N,                       "n435991
           END OF STYPE_BUKRS.                                 "n435991
                                                               "n435991
    *DATA : G_S_BUKRS             TYPE  STYPE_BUKRS,             "n435991
          G_T_BUKRS             TYPE  STYPE_BUKRS   OCCURS 0.  "n435991
                                                               "n435991
    for the document type                                     "n435991
    *TYPES : BEGIN OF STYPE_BLART,                               "n435991
             BLART              LIKE  BKPF-BLART,              "n435991
             RETCODE            TYPE  N,                       "n435991
           END OF STYPE_BLART.                                 "n435991
                                                               "n435991
    *DATA : G_S_BLART             TYPE  STYPE_BLART,             "n435991
          G_T_BLART             TYPE  STYPE_BLART   OCCURS 0.  "n435991
                                                               "n435991
    for the business area                                     "n435991
    *TYPES : BEGIN OF STYPE_GSBER,                               "n435991
             GSBER              LIKE  BSEG-GSBER,              "n435991
             RETCODE            TYPE  N,                       "n435991
           END OF STYPE_GSBER.                                 "n435991
                                                               "n435991
    *DATA : G_S_GSBER             TYPE  STYPE_GSBER,             "n435991
          G_T_GSBER             TYPE  STYPE_GSBER   OCCURS 0.  "n435991
                                                               "n435991
    for the purchasing organization                           "n435991
    *TYPES : BEGIN OF STYPE_EKORG,                               "n435991
             EKORG              LIKE  EKKO-EKORG,              "n435991
             RETCODE            TYPE  N,                       "n435991
           END OF STYPE_EKORG.                                 "n435991
                                                               "n435991
    *DATA : G_S_EKORG             TYPE  STYPE_EKORG,             "n435991
          G_T_EKORG             TYPE  STYPE_EKORG   OCCURS 0.  "n435991
                                                               "n435991
    for the plant                                             "n435991
    *TYPES : BEGIN OF STYPE_WERKS,                               "n435991
             WERKS              LIKE  EKPO-WERKS,              "n435991
             RETCODE            TYPE  N,                       "n435991
           END OF STYPE_WERKS.                                 "n435991
                                                               "n435991
    *DATA : G_S_WERKS             TYPE  STYPE_WERKS,             "n435991
          G_T_WERKS             TYPE  STYPE_WERKS   OCCURS 0.  "n435991
                                                               "n435991
    *DATA : G_F_TABIX             LIKE   SY-TABIX.               "n435991
                                                               "n435991
    working tables for array database access                  "n934526
    *types : begin of stype_key,                                 "n934526
             bukrs              type  bkpf-bukrs,              "n934526
             belnr              type  bkpf-belnr,              "n934526
             gjahr              type  bkpf-gjahr,              "n934526
           end of stype_key,                                   "n934526
                                                               "n934526
           stab_key             type  standard table of        "n934526
                                      stype_key                "n934526
                                      with default key.        "n934526
    Initialwerte setzen
    FORM INIT.
    ENDFORM.
    Selection Screen: Process before output
    FORM PBO.
    ENDFORM.
    Selection Screen: Process after input
    FORM PAI USING FNAME MARK.
      CHECK MARK = SPACE.
    ENDFORM.
    Lesen BKPF und Uebergabe an den Selektionsreport
    FORM PUT_BKPF.
    define locla working areas                                "n934526
    data : l_t_key             type  stab_key,                "n934526
            l_t_key_block       type  stab_key,                "n934526
            l_t_bkpf            type  standard table of bkpf.  "n934526
                                                               "n934526
    ----------------------------------------------------------"n934526
                                                                "n934526
    database seletion improved                                "n934526
    at first read all FI doc keys into a lean table           "n934526
    data: wa like bkpf-belnr.
      SELECT * FROM BKPF
    where budat in br_budat
          AND GJAHR EQ BR_GJAHR-LOW
          AND BLART = 'RV'.
         AND BLART IN BR_BLAR                               "n934526
                                                                "n934526
    check sy-subrc is initial.                                "n934526
                                                               "n934526
    then process the found FI doc keys in small blocks        "n934526
    do.                                                       "n934526
       if  l_t_key[] is initial.                               "n934526
         exit.        " no more keys -> leave this DO loop     "n934526
       endif.                                                  "n934526
                                                               "n934526
      form small blocks with 100 FI docs each                 "n934526
       refresh                  l_t_key_block.                 "n934526
       append lines of l_t_key  from 1 to 100                  "n934526
                                to  l_t_key_block.             "n934526
       delete l_t_key           from 1 to 100.                 "n934526
                                                               "n934526
      read the complete FI doc headers for the block          "n934526
       SELECT *                 FROM BKPF                      "n934526
         into  corresponding fields of table l_t_bkpf          "n934526
           for all entries in l_t_key_block                    "n934526
             WHERE BUKRS = l_t_key_block-BUKRS                 "n934526
               AND BELNR = l_t_key_block-BELNR                 "n934526
               AND GJAHR = l_t_key_block-GJAHR.                "n934526
                                                               "n934526
      provide the complete structure for the PUT              "n934526
       loop at l_t_bkpf         into  bkpf.                    "n934526
        process this company code  : authority and read T001  "n934526
         PERFORM                F1000_COMPANY_CODE.            "n934526
                                                               "n934526
        go on if the first authority check was successful     "n934526
         CHECK : G_S_BUKRS-RETCODE IS INITIAL.                 "n934526
                                                               "n934526
        set the currency key and save the keys                "n934526
         MOVE : G_S_BUKRS-WAERS TO  T001-WAERS,                "n934526
                BKPF-BUKRS      TO  BR_SBUKRS,                 "n934526
               MOVE  BKPF-BELNR       TO  BR_SBELNR.
               MOVE  BKPF-GJAHR      TO  BR_SGJAHR .               "n934526
                BKPF-GJAHR      TO  BR_SGJAHR.                 "n934526
          PUT                    BKPF.                          "n934526
       endloop.                                                "n934526
    enddo.                                                    "n934526
    ENDSELECT.
    ENDFORM.
    Lesen BSEG und Uebergabe an den Selektionsreport
    FORM PUT_BSEG.
    define local working areas                                "n934526
      data : l_t_bseg            type  standard table of bseg.  "n934526
                                                                "n934526
    ----------------------------------------------------------"n934526
    BR_SGSBER = BR_GSBER-LOW.
                                                                "n934526
      SELECT * FROM BSEG                                        "n934526
          WHERE  BELNR EQ BR_SBELNR
          AND GJAHR EQ BR_SGJAHR
          AND GSBER EQ BR_SGSBER.
    check sy-subrc is initial.                                "n934526
                                                                "n934526
    loop at l_t_bseg           into  bseg.                    "n934526
       MOVE BSEG-BUZEI TO BR_SBUZEI.
       MOVE BSEG-EBELN TO BR_SEBELN.
       MOVE BSEG-EBELP TO BR_SEBELP.
       MOVE BSEG-ZEKKN TO BR_SZEKKN.
        PUT BSEG.
      endSELECT.                                                  "n934526
    ENDFORM.
    "n435991
          FORM AUTHORITYCHECK_BKPF                            "n435991
    "n435991
                                                                "n435991
    *FORM AUTHORITYCHECK_BKPF.                                   "n435991
                                                                "n435991
    the authority-check for the company code was successful;  "n435991
    check authority for the document type here                "n435991
                                                                "n435991
    does the buffer contain this document type ?              "n435991
    READ  TABLE  G_T_BLART     INTO  G_S_BLART                "n435991
            WITH  KEY  BLART = BKPF-BLART  BINARY SEARCH.      "n435991
                                                               "n435991
    CASE  SY-SUBRC.                                           "n435991
       WHEN  0.       "document type is known                  "n435991
                                                               "n435991
       WHEN  4.       "docment type is new --> insert          "n435991
         MOVE  SY-TABIX         TO  G_F_TABIX.                 "n435991
         PERFORM                F1200_CREATE_BLART_ENTRY.      "n435991
         INSERT  G_S_BLART      INTO  G_T_BLART                "n435991
                                INDEX  G_F_TABIX.              "n435991
                                                               "n435991
       WHEN  8.       "document type is new --> append         "n435991
         PERFORM                F1200_CREATE_BLART_ENTRY.      "n435991
         APPEND  G_S_BLART      TO  G_T_BLART.                 "n435991
    ENDCASE.                                                  "n435991
                                                               "n435991
    set the return code                                       "n435991
    MOVE  G_S_BLART-RETCODE    TO  SY-SUBRC.                  "n435991
                                                               "n435991
    *ENDFORM.                     "authoritycheck_bkpf           "n435991
                                                               "n435991
    "n435991
          FORM AUTHORITYCHECK_BSEG                            "n435991
    "n435991
                                                                "n435991
    *FORM AUTHORITYCHECK_BSEG.                                   "n435991
                                                               "n435991
    does the buffer contain this document type ?              "n435991
    READ  TABLE  G_T_GSBER     INTO  G_S_GSBER                "n435991
            WITH  KEY  GSBER = BSEG-GSBER  BINARY SEARCH.      "n435991
                                                               "n435991
    CASE  SY-SUBRC.                                           "n435991
       WHEN  0.       "business area is known                  "n435991
                                                               "n435991
       WHEN  4.       "business area is new --> insert         "n435991
         MOVE  SY-TABIX         TO  G_F_TABIX.                 "n435991
         PERFORM                F1300_CREATE_GSBER_ENTRY.      "n435991
         INSERT  G_S_GSBER      INTO  G_T_GSBER                "n435991
                                INDEX  G_F_TABIX.              "n435991
                                                               "n435991
       WHEN  8.       "business area is new --> append         "n435991
         PERFORM                F1300_CREATE_GSBER_ENTRY.      "n435991
         APPEND  G_S_GSBER      TO  G_T_GSBER.                 "n435991
    ENDCASE.                                                  "n435991
                                                               "n435991
    set the return code                                       "n435991
    MOVE  G_S_GSBER-RETCODE    TO  SY-SUBRC.                  "n435991
                                                               "n435991
    *ENDFORM.                     "authoritycheck_bseg           "n435991
                                                               "n435991

    ABAP provides few tools to analyse the perfomance of the objects, which was developed by us.
    Run time analysis transaction SE30
    This transaction gives all the analysis of an ABAP program with respect to the database and the non-database processing.
    SQL Trace transaction ST05
    by using this tool we can analyse the perfomance issues related to DATABASE calls.
    Perfomance Techniques for improve the perfomance of the object.
    1) ABAP/4 programs can take a very long time to execute, and can make other processes have to wait before executing. Here are some tips to speed up your programs and reduce the load your programs put on the system:
    2) Use the GET RUN TIME command to help evaluate performance. It's hard to know whether that optimization technique REALLY helps unless you test it out.
    3) Using this tool can help you know what is effective, under what kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so you should use it to test small pieces of your program, rather than the whole program.
    4) Generally, try to reduce I/O first, then memory, then CPU activity. I/O operations that read/write to hard disk are always the most expensive operations. Memory, if not controlled, may have to be written to swap space on the hard disk, which therefore increases your I/O read/writes to disk. CPU activity can be reduced by careful program design, and by using commands such as SUM (SQL) and COLLECT (ABAP/4).
    5) Avoid 'SELECT *', especially in tables that have a lot of fields. Use SELECT A B C INTO instead, so that fields are only read if they are used. This can make a very big difference.
    6) Field-groups can be useful for multi-level sorting and displaying. However, they write their data to the system's paging space, rather than to memory (internal tables use memory). For this reason, field-groups are only appropriate for processing large lists (e.g. over 50,000 records). If you have large lists, you should work with the systems administrator to decide the maximum amount of RAM your program should use, and from that, calculate how much space your lists will use. Then you can decide whether to write the data to memory or swap space.
    Use as many table keys as possible in the WHERE part of your select statements.
    7)Whenever possible, design the program to access a relatively constant number of records (for instance, if you only access the transactions for one month, then there probably will be a reasonable range, like 1200-1800, for the number of transactions inputted within that month). Then use a SELECT A B C INTO TABLE ITAB statement.
    8) Get a good idea of how many records you will be accessing. Log into your productive system, and use SE80 -> Dictionary Objects (press Edit), enter the table name you want to see, and press Display. Go To Utilities -> Table Contents to query the table contents and see the number of records. This is extremely useful in optimizing a program's memory allocation.
    9) Try to make the user interface such that the program gradually unfolds more information to the user, rather than giving a huge list of information all at once to the user.
    10) Declare your internal tables using OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to be accessing. If the number of records exceeds NUM_RECS, the data will be kept in swap space (not memory).
    11) Use SELECT A B C INTO TABLE ITAB whenever possible. This will read all of the records into the itab in one operation, rather than repeated operations that result from a SELECT A B C INTO ITAB... ENDSELECT statement. Make sure that ITAB is declared with OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to access.
    12) If the number of records you are reading is constantly growing, you may be able to break it into chunks of relatively constant size. For instance, if you have to read all records from 1991 to present, you can break it into quarters, and read all records one quarter at a time. This will reduce I/O operations. Test extensively with GET RUN TIME when using this method.
    13) Know how to use the 'collect' command. It can be very efficient.
    14) Use the SELECT SINGLE command whenever possible.
    15) Many tables contain totals fields (such as monthly expense totals). Use these avoid wasting resources by calculating a total that has already been calculated and stored.
    Some tips:
    1) Use joins where possible as redundant data is not fetched.
    2) Use select single where ever possible.
    3) Calling methods of a global class is faster than calling function modules.
    4) Use constants instead of literals
    5) Use WHILE instead of a DO-EXIT-ENDDO.
    6) Unnecessary MOVEs should be avoided by using the explicit work area operations
    see the follwing links for a brief insifght into performance tuning,
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_Introduction.asp
    1. Debuggerhttp://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    2. Run Time Analyser
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
    3. SQL trace
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
    4. CATT - Computer Aided Testing Too
    http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm
    5. Test Workbench
    http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm
    6. Coverage Analyser
    http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm
    7. Runtime Monitor
    http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm
    8. Memory Inspector
    http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm
    9. ECATT - Extended Computer Aided testing tool.
    http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm
    Performance tuning for Data Selection Statement
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm

  • Why this code is not working for alv

    Dear
    Regards,
    i have implemented the same program for ALV which i have used earlier in the reports. but now it is showing no output:
    *& Report  ZTCT1_ALV2                                                  *
    REPORT  ztct1_alv2                              .
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    * INCLUDING TABLES.
    TABLES: vbrk,
            vbrp,
            kna1,
            t001w,
            makt.
    * DECLARATION OF INTERNAL TABLES.
    DATA: BEGIN OF itab OCCURS 0,  "Including the fields of VBRK and VBRP
            kunag LIKE vbrk-kunag, "Customer Code
            name1 LIKE kna1-name1, "Customer Name
            vbeln LIKE vbrk-vbeln, "Invoice #
            fkdat LIKE vbrk-fkdat, "Invoice Date
            werks LIKE vbrp-werks, "Plant
            name2 LIKE t001w-name1,"Plant Description
            matnr LIKE vbrp-matnr, "Material #
            maktx LIKE makt-maktx, "Material Description
            meins LIKE vbrp-meins, "Unit of Measure
            fklmg LIKE vbrp-fklmg, "Quantity
            netwr LIKE vbrp-netwr, "Amount
          END OF itab,
          BEGIN OF itnm OCCURS 0,  "Including the fields of VBRK and KNA1
            kunag LIKE vbrk-kunag, "Customer Code
            name1 LIKE kna1-name1, "Customer Name
          END OF itnm,
          BEGIN OF itpt OCCURS 0,  "Including the fields of VBRP and T001W
            werks LIKE vbrp-werks, "Plant
            name1 LIKE t001w-name1,"Plant Description
          END OF itpt,
          BEGIN OF itmt OCCURS 0,  "Including the fields of VBRP and MAKT
            matnr LIKE vbrp-matnr, "Material #
            maktx LIKE makt-maktx, "Material description
          END OF itmt,
          BEGIN OF itsm OCCURS 0,
            kunag LIKE kna1-kunnr,
            name1 LIKE kna1-name1,
            fklmg LIKE vbrp-fklmg,
            netwr LIKE vbrp-netwr,
          END OF itsm,
          ok_code            LIKE sy-ucomm,
          save_ok            LIKE sy-ucomm,
          g_max              TYPE i VALUE 100,
          g_repid            LIKE sy-repid,
          gs_layout          TYPE lvc_s_layo,
          g_container        TYPE scrfname VALUE 'CUST_CONT',
          grid1              TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          grid2              TYPE REF TO cl_gui_alv_grid,
          gt_sort            TYPE lvc_t_sort,
          gt_fieldcatalog    TYPE lvc_t_fcat,
          w_tot_qty          LIKE vbrp-fklmg,
          w_tot_amt          LIKE vbrp-netwr,
    * Reference to Dialogbox Container.
          dialogbox_container TYPE REF TO cl_gui_dialogbox_container,
    * Reference to local class that handles events of GRID1 and
    * DIALOGBOX_CONTAINER
          event_receiver TYPE REF TO lcl_event_receiver.
    * SELECT-OPTIONS
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF BLOCK input WITH FRAME TITLE text-000.
    SELECT-OPTIONS: s_werks FOR vbrp-werks, "Plant
                    s_kunag FOR vbrk-kunag, "Customer
                    s_matnr FOR vbrp-matnr, "Material Number
                    s_fkdat FOR vbrk-fkdat. "Invoice Date
    SELECTION-SCREEN END OF BLOCK input .
    SELECTION-SCREEN SKIP 1.
    * START-OF-SELECTION
    START-OF-SELECTION.
      SET SCREEN 100.
    * CLEARING INTERNAL TABLES.
      CLEAR: itab,
             itnm,
             itmt,
             itpt.
    * QUERY FOR JOINING TABLES VBRK AND VBRP
      SELECT vbrk~kunag
             vbrk~vbeln
             vbrk~fkdat
             vbrp~werks
             vbrp~matnr
             vbrp~meins
             vbrp~fklmg
             vbrp~netwr
             INTO CORRESPONDING FIELDS OF TABLE itab
             FROM vbrk
             INNER JOIN vbrp
                 ON vbrk~vbeln = vbrp~vbeln
             WHERE vbrk~kunag IN s_kunag
               AND vbrk~fkdat IN s_fkdat
               AND vbrp~matnr IN s_matnr
               AND vbrp~werks IN s_werks.
    * QUERY FOR JOINING TABLES VBRK AND KNA1
      SELECT kna1~kunnr AS kunag
             kna1~name1
             INTO TABLE itnm
             FROM kna1
             WHERE kna1~kunnr IN s_kunag.
    * QUERY FOR JOINING TABLES VBRP AND T001W
      SELECT t001w~werks
             t001w~name1
             INTO TABLE itpt
             FROM t001w
             WHERE t001w~werks IN s_werks.
    * QUERY FOR JOINING TABLES VBRP AND MAKT
      SELECT makt~matnr
             makt~maktx
             INTO TABLE itmt
             FROM makt
             WHERE makt~matnr IN s_matnr.
    * SORTING INTERNAL TABLES.
      SORT itab BY kunag.
    *    LOOP AT itab.
    *      CLEAR: itmt, itnm, itpt.
    *      READ TABLE itnm WITH KEY kunag = itab-kunag.
    *      READ TABLE itmt WITH KEY matnr = itab-matnr.
    *      READ TABLE itpt WITH KEY werks = itab-werks.
    *      itab-name1 = itnm-name1.
    *      itab-maktx = itmt-maktx.
    *      itab-name2 = itpt-name1.
    *      MODIFY itab.
    *    ENDLOOP.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'KUNAG' 'C' 'Customer Code'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C' 'Customer Name'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'VBELN' 'C' 'Invoice #'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKDAT' 'DATS' 'Invoice Date'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'WERKS' 'C' 'Plant'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME2' 'C' 'Plant Description'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MATNR' 'C' 'Material #'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MAKTX' 'C' 'Material Description'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MEINS' 'C' 'UoM'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKLMG' 'QUAN' 'Quantity'.
    *    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETWR' 'CURR' 'Amount'.
        LOOP AT itab.
          CLEAR itsm.
          READ TABLE itnm WITH KEY kunag = itab-kunag.
          itsm-kunag = itab-kunag.
          itsm-name1 = itnm-name1.
          itsm-fklmg = itab-fklmg.
          itsm-netwr = itab-netwr.
          COLLECT itsm.
        ENDLOOP.
        PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'KUNAG' 'C' 'Customer Code'.
        PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C' 'Customer Name'.
        PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKLMG' 'QUAN' 'Quantity'.
        PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETWR' 'CURR' 'Amount'.
      PERFORM sort_build USING gt_sort[].
      PERFORM layout_init USING gs_layout.
    *   LOCAL CLASSES: Definition
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_double_click
            FOR EVENT double_click OF cl_gui_alv_grid
                IMPORTING e_row e_column,
        handle_close
            FOR EVENT close OF cl_gui_dialogbox_container
                IMPORTING sender.
      PRIVATE SECTION.
        DATA: dialogbox_status TYPE c.  "'X': does exist, SPACE: does not ex.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *   LOCAL CLASSES: Implementation
    CLASS lcl_event_receiver IMPLEMENTATION.
    *   §3.At doubleclick(1): The event DOUBLE_CLICK provides
    *      parameters of the clicked row and column.
    *      Use row parameter to select a line of the
    *      corresponding internal table.
      METHOD handle_double_click.
        DATA: ls_sm LIKE LINE OF itsm,
              wa_itab LIKE ITAB.
    *   read selected row from internal table gt_sflight
        READ TABLE itsm INDEX e_row-index INTO ls_sm.
    *   §4.At Doubleclick(2): Select booking data
    *    READ TABLE ITAB WITH KEY KUNAG = LS_SM-KUNAG.    .
        READ TABLE ITAB INTO WA_ITAB WITH KEY KUNAG = LS_SM-KUNAG.
    *   §5.At doubleclick(3): Create dialogbox to show detail list
    *     (if not already existent)
        IF dialogbox_status IS INITIAL.
          dialogbox_status = 'X'.
          PERFORM create_detail_list.
        ELSE.
          CALL METHOD dialogbox_container->set_visible
            EXPORTING
              visible = 'X'.
          CALL METHOD grid2->refresh_table_display.
        ENDIF.
      ENDMETHOD.                    "handle_double_click
      METHOD handle_close.
    *   §6.Handle the CLOSE-button of the dialogbox
    *   set dialogbox invisible
    *   (the dialogbox is destroyed outomatically when the user
    *   switches to another dynpro).
        CALL METHOD sender->set_visible
          EXPORTING
            visible = space.
    *   In this example closing the dialogbox leads
    *   to make it invisible. It is also conceivable to destroy it
    *   and recreate it if the user doubleclicks a line again.
    *   Displaying a great amount of data has a greater impact on performance.
      ENDMETHOD.                    "handle_close
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    *   lcl_event_receiver (Implementation)
    *=====================================================================
    *       FORM EXIT_PROGRAM                                             *
    FORM exit_program.
      CALL METHOD g_custom_container->free.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc NE 0.
    * add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel = g_repid
            txt2  = sy-subrc
            txt1  = 'Error in FLush'(500).
      ENDIF.
      LEAVE TO SCREEN 0.
    ENDFORM.                    "exit_program
    *  MODULE PBO_ALV OUTPUT
    MODULE pbo_alv OUTPUT.
      SET PF-STATUS 'MAIN'.
      SET TITLEBAR 'MAIN100'.
      g_repid = sy-repid.
      IF g_custom_container IS INITIAL.
        READ TABLE itsm.
        CREATE OBJECT g_custom_container
          EXPORTING
            container_name = g_container
          EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc NE 0.
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = g_repid
              txt2  = sy-subrc
              txt1  = 'The control could not be created'(510).
        ENDIF.
        CREATE OBJECT grid1
          EXPORTING
            i_parent = g_custom_container.
        gs_layout-grid_title = 'Invoice Summary'.
        CALL METHOD grid1->set_table_for_first_display
          EXPORTING
            is_layout       = gs_layout
          CHANGING
            it_outtab       = itsm[]
            it_fieldcatalog = gt_fieldcatalog
            it_sort         = gt_sort.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_double_click FOR grid1.
      ENDIF.
      CALL METHOD cl_gui_control=>set_focus
        EXPORTING
          control = grid1.
    ENDMODULE.                    "PBO_ALV OUTPUT
    *  MODULE PAI_ALV INPUT
    MODULE pai_alv INPUT.
      CALL METHOD cl_gui_cfw=>dispatch.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                    "PAI_ALV INPUT
    *&      Form  fieldcatalog_init
    *       text
    *      -->LT_FIELDCATtext
    *      -->VALUE(FIELDtextE)
    *      -->VALUE(FIELDtextE)
    *      -->VALUE(FIELDtextT)
    FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat
                           value(field_name) value(field_type) value(field_text).
      DATA: ls_fieldcatalog TYPE lvc_s_fcat.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname = field_name.
      ls_fieldcatalog-datatype  = field_type.
      ls_fieldcatalog-reptext   = field_text.
      ls_fieldcatalog-coltext  =  field_text.
      ls_fieldcatalog-seltext  =  field_text.
      ls_fieldcatalog-tooltip  =  field_text.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ENDFORM.                    "fieldcatalog_init
    *&      Form  sort_build
    *       text
    *      -->LT_SORT    text
    FORM sort_build USING lt_sort TYPE lvc_t_sort.
      DATA: ls_sort TYPE lvc_s_sort.
      ls_sort-fieldname = 'KUNAG'.    "Fieldname on which to sort
      ls_sort-up        = 'X'.        "Sort Ascending
      APPEND ls_sort TO lt_sort.
      ls_sort-fieldname = 'NAME1'.    "Fieldname on which to sort
      ls_sort-up        = 'X'.        "Sort Ascending
      APPEND ls_sort TO lt_sort.
    ENDFORM.                    "sort_build
    *&      Form  layout_init
    *       text
    *      -->LS_LAYOUT  text
    FORM layout_init USING ls_layout TYPE lvc_s_layo.
      ls_layout-zebra      = 'X'.
      ls_layout-grid_title = 'Customer Details'.
      ls_layout-sel_mode   = 'A'.
      ls_layout-cwidth_opt = 'X'.
    ENDFORM.                    "layout_init
    *&      Form  create_detail_list
    *         text
    *    -->  p1        text
    *    <--  p2        text
    FORM create_detail_list.
    *   create dialogbox container as dynpro-instance
    *   When the user switches to another screen, it is
    *   destroyed by lifetime mangagement of CFW
      CREATE OBJECT dialogbox_container
          EXPORTING
            top = 150
            left = 150
            lifetime = cntl_lifetime_dynpro
            caption = 'INVOICE DETAILS'(200)
            width = 800
            height = 200.
      CREATE OBJECT grid2
          EXPORTING i_parent = dialogbox_container.
    *   Register ABAP OO event 'CLOSE'. It is not necessary to register this
    *   event at the frontend (this is done during creation).
      SET HANDLER event_receiver->handle_close FOR dialogbox_container.
    *   display data
      gs_layout-grid_title = 'Invoice Details'(100).
      CALL METHOD grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'itab'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = itab[]
          it_fieldcatalog  = gt_fieldcatalog
          it_sort          = gt_sort.
      CALL METHOD cl_gui_control=>set_focus
        EXPORTING
          control = grid2.
    ENDFORM.                    " create_detail_list[code][/
    code]

    Hi,
    I also copied and pasted the same code check once again by copying this code and create screens by double clicking on 100.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    * INCLUDING TABLES.
    TABLES: vbrk,
            vbrp,
            kna1,
            t001w,
            makt.
    * DECLARATION OF INTERNAL TABLES.
    DATA: BEGIN OF itab OCCURS 0,  "Including the fields of VBRK and VBRP
            kunag LIKE vbrk-kunag, "Customer Code
            name1 LIKE kna1-name1, "Customer Name
            vbeln LIKE vbrk-vbeln, "Invoice #
            fkdat LIKE vbrk-fkdat, "Invoice Date
            werks LIKE vbrp-werks, "Plant
            name2 LIKE t001w-name1,"Plant Description
            matnr LIKE vbrp-matnr, "Material #
            maktx LIKE makt-maktx, "Material Description
            meins LIKE vbrp-meins, "Unit of Measure
            fklmg LIKE vbrp-fklmg, "Quantity
            netwr LIKE vbrp-netwr, "Amount
          END OF itab,
          BEGIN OF itnm OCCURS 0,  "Including the fields of VBRK and KNA1
            kunag LIKE vbrk-kunag, "Customer Code
            name1 LIKE kna1-name1, "Customer Name
          END OF itnm,
          BEGIN OF itpt OCCURS 0,  "Including the fields of VBRP and T001W
            werks LIKE vbrp-werks, "Plant
            name1 LIKE t001w-name1,"Plant Description
          END OF itpt,
          BEGIN OF itmt OCCURS 0,  "Including the fields of VBRP and MAKT
            matnr LIKE vbrp-matnr, "Material #
            maktx LIKE makt-maktx, "Material description
          END OF itmt,
          BEGIN OF itsm OCCURS 0,
            kunag LIKE kna1-kunnr,
            name1 LIKE kna1-name1,
            fklmg LIKE vbrp-fklmg,
            netwr LIKE vbrp-netwr,
          END OF itsm,
          ok_code            LIKE sy-ucomm,
          save_ok            LIKE sy-ucomm,
          g_max              TYPE i VALUE 100,
          g_repid            LIKE sy-repid,
          gs_layout          TYPE lvc_s_layo,
          g_container        TYPE scrfname VALUE 'CUST_CONT',
          grid1              TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          grid2              TYPE REF TO cl_gui_alv_grid,
          gt_sort            TYPE lvc_t_sort,
          gt_fieldcatalog    TYPE lvc_t_fcat,
          w_tot_qty          LIKE vbrp-fklmg,
          w_tot_amt          LIKE vbrp-netwr,
    * Reference to Dialogbox Container.
          dialogbox_container TYPE REF TO cl_gui_dialogbox_container,
    * Reference to local class that handles events of GRID1 and
    * DIALOGBOX_CONTAINER
          event_receiver TYPE REF TO lcl_event_receiver.
    * SELECT-OPTIONS
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF BLOCK input WITH FRAME TITLE text-000.
    SELECT-OPTIONS: s_werks FOR vbrp-werks, "Plant
                    s_kunag FOR vbrk-kunag, "Customer
                    s_matnr FOR vbrp-matnr, "Material Number
                    s_fkdat FOR vbrk-fkdat. "Invoice Date
    SELECTION-SCREEN END OF BLOCK input .
    SELECTION-SCREEN SKIP 1.
    * START-OF-SELECTION
    START-OF-SELECTION.
    SET SCREEN 100.
    * CLEARING INTERNAL TABLES.
      CLEAR: itab,
             itnm,
             itmt,
             itpt.
    * QUERY FOR JOINING TABLES VBRK AND VBRP
      SELECT vbrk~kunag
             vbrk~vbeln
             vbrk~fkdat
             vbrp~werks
             vbrp~matnr
             vbrp~meins
             vbrp~fklmg
             vbrp~netwr
             INTO CORRESPONDING FIELDS OF TABLE itab
             FROM vbrk
             INNER JOIN vbrp
                 ON vbrk~vbeln = vbrp~vbeln
             WHERE vbrk~kunag IN s_kunag
               AND vbrk~fkdat IN s_fkdat
               AND vbrp~matnr IN s_matnr
               AND vbrp~werks IN s_werks.
    * QUERY FOR JOINING TABLES VBRK AND KNA1
      SELECT kna1~kunnr AS kunag
             kna1~name1
             INTO TABLE itnm
             FROM kna1
             WHERE kna1~kunnr IN s_kunag.
    * QUERY FOR JOINING TABLES VBRP AND T001W
      SELECT t001w~werks
             t001w~name1
             INTO TABLE itpt
             FROM t001w
             WHERE t001w~werks IN s_werks.
    * QUERY FOR JOINING TABLES VBRP AND MAKT
      SELECT makt~matnr
             makt~maktx
             INTO TABLE itmt
             FROM makt
             WHERE makt~matnr IN s_matnr.
    * SORTING INTERNAL TABLES.
      SORT itab BY kunag.
        LOOP AT itab.
          CLEAR itsm.
          READ TABLE itnm WITH KEY kunag = itab-kunag.
          itsm-kunag = itab-kunag.
          itsm-name1 = itnm-name1.
          itsm-fklmg = itab-fklmg.
          itsm-netwr = itab-netwr.
          COLLECT itsm.
        ENDLOOP.
    * END-OF-SELECTION.
    * If not itsm[] is initial.
    *    CALL SCREEN 100.
    * endif.
    *   LOCAL CLASSES: Definition
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_double_click
            FOR EVENT double_click OF cl_gui_alv_grid
                IMPORTING e_row e_column,
        handle_close
            FOR EVENT close OF cl_gui_dialogbox_container
                IMPORTING sender.
      PRIVATE SECTION.
        DATA: dialogbox_status TYPE c.  "'X': does exist, SPACE: does not ex
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *   LOCAL CLASSES: Implementation
    CLASS lcl_event_receiver IMPLEMENTATION.
    *   §3.At doubleclick(1): The event DOUBLE_CLICK provides
    *      parameters of the clicked row and column.
    *      Use row parameter to select a line of the
    *      corresponding internal table.
      METHOD handle_double_click.
        DATA: ls_sm LIKE LINE OF itsm,
              wa_itab LIKE ITAB.
    *   read selected row from internal table gt_sflight
        READ TABLE itsm INDEX e_row-index INTO ls_sm.
    *   §4.At Doubleclick(2): Select booking data
    *    READ TABLE ITAB WITH KEY KUNAG = LS_SM-KUNAG.    .
        READ TABLE ITAB INTO WA_ITAB WITH KEY KUNAG = LS_SM-KUNAG.
    *   §5.At doubleclick(3): Create dialogbox to show detail list
    *     (if not already existent)
        IF dialogbox_status IS INITIAL.
          dialogbox_status = 'X'.
          PERFORM create_detail_list.
        ELSE.
          CALL METHOD dialogbox_container->set_visible
            EXPORTING
              visible = 'X'.
          CALL METHOD grid2->refresh_table_display.
        ENDIF.
      ENDMETHOD.                    "handle_double_click
      METHOD handle_close.
    *   §6.Handle the CLOSE-button of the dialogbox
    *   set dialogbox invisible
    *   (the dialogbox is destroyed outomatically when the user
    *   switches to another dynpro).
        CALL METHOD sender->set_visible
          EXPORTING
            visible = space.
    *   In this example closing the dialogbox leads
    *   to make it invisible. It is also conceivable to destroy it
    *   and recreate it if the user doubleclicks a line again.
    *   Displaying a great amount of data has a greater impact on
    *performance.
      ENDMETHOD.                    "handle_close
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    *   lcl_event_receiver (Implementation)
    *=====================================================================
    *       FORM EXIT_PROGRAM                                             *
    FORM exit_program.
      CALL METHOD g_custom_container->free.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc NE 0.
    * add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel = g_repid
            txt2  = sy-subrc
            txt1  = 'Error in FLush'(500).
      ENDIF.
      LEAVE TO SCREEN 0.
    ENDFORM.                    "exit_program
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module STATUS_0100 output.
      SET PF-STATUS 'MAIN'.
      SET TITLEBAR 'MAIN100'.
      g_repid = sy-repid.
      IF g_custom_container IS INITIAL.
        READ TABLE itsm.
        CREATE OBJECT g_custom_container
          EXPORTING
            container_name = g_container
          EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc NE 0.
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = g_repid
              txt2  = sy-subrc
              txt1  = 'The control could not be created'(510).
        ENDIF.
        CREATE OBJECT grid1
          EXPORTING
            i_parent = g_custom_container.
        gs_layout-grid_title = 'Invoice Summary'.
    PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'KUNAG' 'C'
    'Customer Code'.
        PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C'
    'Customer Name'.
        PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKLMG' 'QUAN'
    'Quantity'.
        PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETWR' 'CURR'
    'Amount'.
      PERFORM sort_build USING gt_sort[].
      PERFORM layout_init USING gs_layout.
        CALL METHOD grid1->set_table_for_first_display
          EXPORTING
            is_layout       = gs_layout
          CHANGING
            it_outtab       = itsm[]
            it_fieldcatalog = gt_fieldcatalog
            it_sort         = gt_sort.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_double_click FOR grid1.
      ENDIF.
      CALL METHOD cl_gui_control=>set_focus
        EXPORTING
          control = grid1.
    endmodule.                 " STATUS_0100  OUTPUT
    *  MODULE PAI_ALV INPUT
    MODULE USER_COMMAND_0100.
    CALL METHOD cl_gui_cfw=>dispatch.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'EXIT' OR 'CANC'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                    "PAI_ALV INPUT
    *&      Form  fieldcatalog_init
    *       text
    *      -->LT_FIELDCATtext
    *      -->VALUE(FIELDtextE)
    *      -->VALUE(FIELDtextE)
    *      -->VALUE(FIELDtextT)
    FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat
                           value(field_name) value(field_type)
    value(field_text).
      DATA: ls_fieldcatalog TYPE lvc_s_fcat.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname = field_name.
      ls_fieldcatalog-datatype  = field_type.
      ls_fieldcatalog-reptext   = field_text.
      ls_fieldcatalog-coltext  =  field_text.
      ls_fieldcatalog-seltext  =  field_text.
      ls_fieldcatalog-tooltip  =  field_text.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ENDFORM.                    "fieldcatalog_init
    *&      Form  sort_build
    *       text
    *      -->LT_SORT    text
    FORM sort_build USING lt_sort TYPE lvc_t_sort.
      DATA: ls_sort TYPE lvc_s_sort.
      ls_sort-fieldname = 'KUNAG'.    "Fieldname on which to sort
      ls_sort-up        = 'X'.        "Sort Ascending
      APPEND ls_sort TO lt_sort.
      ls_sort-fieldname = 'NAME1'.    "Fieldname on which to sort
      ls_sort-up        = 'X'.        "Sort Ascending
      APPEND ls_sort TO lt_sort.
    ENDFORM.                    "sort_build
    *&      Form  layout_init
    *       text
    *      -->LS_LAYOUT  text
    FORM layout_init USING ls_layout TYPE lvc_s_layo.
      ls_layout-zebra      = 'X'.
      ls_layout-grid_title = 'Customer Details'.
      ls_layout-sel_mode   = 'A'.
      ls_layout-cwidth_opt = 'X'.
    ENDFORM.                    "layout_init
    *&      Form  create_detail_list
    *         text
    *    -->  p1        text
    *    <--  p2        text
    FORM create_detail_list.
    *   create dialogbox container as dynpro-instance
    *   When the user switches to another screen, it is
    *   destroyed by lifetime mangagement of CFW
      CREATE OBJECT dialogbox_container
          EXPORTING
            top = 150
            left = 150
            lifetime = cntl_lifetime_dynpro
            caption = 'INVOICE DETAILS'(200)
            width = 800
            height = 200.
      CREATE OBJECT grid2
          EXPORTING i_parent = dialogbox_container.
    *   Register ABAP OO event 'CLOSE'. It is not necessary to register this
    *   event at the frontend (this is done during creation).
      SET HANDLER event_receiver->handle_close FOR dialogbox_container.
    *   display data
      gs_layout-grid_title = 'Invoice Details'(100).
      CALL METHOD grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'itab'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = itab[]
          it_fieldcatalog  = gt_fieldcatalog
          it_sort          = gt_sort.
      CALL METHOD cl_gui_control=>set_focus
        EXPORTING
          control = grid2.
    ENDFORM.                    " create_detail_list
    Nothing wrong in the code i am able to see the output with five records and the pop-up screen on double clicking a value.
    Kindly close the thread or revert back

  • Please see my code and helpme out pls

    //Making Circle here
    gridx=20;
    gridy=20;
    num=0;
    for (var i=0;i < 10;i++)
    for (var j=0;j < 10;j++)
    dot.duplicateMovieClip("dot"+num,num);
    mc=this["dot"+num];
    mc._x=gridx*i;
    mc._y=gridy*j;
    num++;
    dot._visible=0;
    // here i make plain circle, but problam is my all circle
    open in fornt side, i want to that all my circle in background
    //hide all selection MovieClip
    for(i=1; i<=100; i++){
    this.createEmptyMovieClip("test_mc"+i,
    this.getNextHighestDepth());
    this["test"+i]._visible = false;
    // here i make fill circle mc, all hide with this code, but
    problam is all circle come in background
    //selection area
    _root.onMouseDown = function() {
    sel = this.createEmptyMovieClip("sel", 1);
    sel.startx = _xmouse; // we need to reference these later,
    so add them as properties of the selection clip
    sel.starty = _ymouse;
    this.onEnterFrame = function() {
    with(sel){
    clear();
    lineStyle( 1, 000000, 100 );
    moveTo(sel.startx, sel.starty);
    lineTo(_xmouse, starty);
    lineTo(_xmouse, _ymouse);
    lineTo(sel.startx, _ymouse);
    lineTo(sel.startx, sel.starty);
    _root.onMouseUp = function() {
    _root.select(sel.startx,sel.starty,sel._xmouse,sel._ymouse);
    // call the selection function
    removeMovieClip(sel);
    this.onEnterFrame = undefined;
    _root.select =
    function(x1:Number,y1:Number,x2:Number,y2:Number){
    // in case you dragged the selection box from right to left
    or bottom to top, we need
    // to work out the top left and bottom right coordinates..
    var sx = Math.min(x1,x2);
    var ex = Math.max(x1,x2);
    var sy = Math.min(y1,y2);
    var ey = Math.max(y1,y2);
    for(var item in this){ // loop through all items in the
    _root
    if(typeof(this[item])=="movieclip"){ // if the current item
    is a movieclip..
    this[item]._visible = isInside(this[item],sx,sy,ex,ey);
    function
    isInside(mc:MovieClip,x1:Number,y1:Number,x2:Number,y2:Number):Boolean{
    // check whether the selection coordinates enclose the mc
    coordinates
    return (x1<=mc._x && x2>=mc._x+mc._width
    && y1<=mc._y && y2>=mc._y+mc._height);
    // here u can find selection option, selection option is
    wroking, but same problam, it work in background, & hide my all
    MC (that Plain Circle also) and highlight only which we select
    // Some brif here:
    i want to create plain circle in background, after that some
    one want to slecte that palin circle highlight that circle only
    with fill circle ( for better explaination see my fla file which is
    attach here
    Please see this
    Pls pls help me out
    thanks
    praful damania

    for better explaination pls see my fla file which is attache
    there & I have some quation about it as under
    1) here i make fill circle mc, all hide with this code, but
    problam is all circle come in background
    2) here i make fill circle mc, all hide with this code, but
    problam is all circle come in background
    3) here u can find selection option, selection option is
    wroking, but same problam, it work in background, & hide my all
    MC (that Plain Circle also) and highlight only which we select
    i want to create plain circle in background, after that some
    one want to slecte that palin circle highlight that circle only
    with fill circle
    thanks for reply
    Praful Damania

  • See my code that no me error after complied but not give me pdf result and

    hi master
    sir i use this code for create the pdf
    ExternalContext econtext = getExternalContext();
    InputStream stream = econtext.getResourceAsStream(PREFIX);
    try {
    JRResultSetDataSource mcon = new JRResultSetDataSource(getSessionBean1().getChartofaccRowSet());
    JasperPrint jasperPrint = null;
    jasperPrint = JasperFillManager.fillReport(stream, null, mcon);
    JRExporter exporter = null;
    HttpServletResponse response = (HttpServletResponse)econtext.getResponse();
    FacesContext fcontext = FacesContext.getCurrentInstance();
    exporter = new JRPdfExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,
    response.getOutputStream());
    exporter.exportReport();
    fcontext.responseComplete();
    } catch (Exception ex) {
    log(" Error Description" , ex);
    error("Error counting rows: " + ex.getMessage() );
    error("Error counting rows: " + ex ); }
    sir this code not give any error but also not create /display the pdf
    i try to find the where problem occurred i get textfiled and send some value after one by one line
    like is this
    first time try
    JRResultSetDataSource mcon = new JRResultSetDataSource(getSessionBean1().getChartofaccRowSet());
    textField2.setValue(PREFIX);
    is given me right result and show /WEB-INF/reports/mfa.jasper in textfield2
    second time
    jasperPrint = JasperFillManager.fillReport(stream, null, mcon);
              textField2.setValue(PREFIX);
    when i press button second time this time page not give me result in textfield2 and show blank it means
    only this line have error but what i could not foud out jasperPrint = JasperFillManager.fillReport(stream, null, mcon);
    use see my code and give me idea or solution of my problem
    thank�s
    aamir

    I found and easier way to do it and wrote it up here: http://developers.sun.com/jscreator/learning/tutorials/2/reports.html

  • How we can replace the column in Core Table plz see this msg

    Hi,
    How we can replace the column in Core Table plz see this msg
    Req:
    when i push the Insert button the data inserted into the Table
    like
    Cols Values
    FOCD      CUFZ14
    PRDCD FU6
    Month 082008
    AgencyCD AG02
    PLAN 123
    This is FO_Plan Table....
    Requirement:
    i need at table show to replace the Prd_CD to Prd_Desc while inserting the above Row....
    There is no Prd_Desc in FO Plan Table....
    Prd_desc comes from Product Table.
    did u get my point...
    how to solve.
    Thanks
    Ram
    Edited by: Ram Vungarala on Sep 24, 2008 9:09 AM
    Edited by: Ram Vungarala on Sep 24, 2008 9:15 AM

    Hi,
    I'm not sure if I understood what are you trying to do. But you can modify your table in a backing bean code. JSF page code for a table:
    <af:table id="product_search_results_tbl" binding="#{backingBean.boundTable}" ... />
    And a backing bean code:
    import oracle.adf.view.faces.component.core.data.CoreTable;
    public class YourBackingBean {
        private CoreTable boundTable;
        public void setBoundTable(CoreTable boundTable) {
            this.boundTable = boundTable;
        public CoreTable getBoundTable() {
            return boundTable;
       public String insertButtonAction() {
          // Bind your button action to this method and modify here your bound table
         return null;
    {code}
    Look for column modification methods in a CoreTable class documentation.
    Marius                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can you help me with this code

    hi am new to java so please bare with me , so in this code as you can see i comment some lines of code the one i comment works when i compile it , but why the one with fields does not ? can you please explain this to me
    public class Demo3
                   public static int a = 5;
                   public static int b = 6;
                   public static int c = a+b;
                   public static int d = b-a;
                   a*=5;
         public static void main (String [] args)
              /*int a = 5;
              int b = 6;
              int c = a+b;
              int d = b-a;
              a*=5;
              System.out.println (a);
              System.out.println (b);
              System.out.println (c);
              System.out.println (d);
    }

    >
    public class Demo3
                   public static int a = 5;
                   public static int b = 6;
                   public static int c = a+b;
                   public static int d = b-a;
                   a*=5;This is not possible. write this statement in a function.
    or
    in a static block like
    static  {
          a*=5;
    }>
         public static void main (String [] args)
              /*int a = 5;
              int b = 6;
              int c = a+b;
              int d = b-a;
              a*=5;
              System.out.println (a);
              System.out.println (b);
              System.out.println (c);
              System.out.println (d);

Maybe you are looking for

  • ST05 LOBSTA what is this and how to interpret it.

    Hi all, there is an object LOBSTA in sql trace called LOBSTA, which has quite big execution time and points to some Classes.  Have you any idea how to interpret this object and what to do to improve execution times on it.

  • How long does it takes to install Logic Pro x

    Can anyone tell me how long does it takes to install Logic Pro x?

  • How to show print dialog as soon as it opens in browser

    I need to open a pdf with print dialog through AcroJS. The code that I used is: console.show(); var pp = this.getPrintParams(); pp.interactive = pp.constants.interactionLevel.full; this.print(pp); In order to add the script I used iText. I made a Pdf

  • What are the commands for compiling c++ using the command line tools for xcode?

    Hi, I am taking a class in school for c++ and i would like ot be able to practice at home i found the command line tools for xcode and went ahead and installed it on my computer. now i need to know the commands and procedure to be able to compile and

  • Passing HTML column as filter

    Hi All, I have a requirement where i wrote go url syntax on the column formula if they click on that value it will navigate them to a real time environment page there in the data format of that column i made it as a HTML content i need to use this sa