How to make this code more simplified?

hi, is there any possiibilty or logic to simply my code than below one?
here my data is like that in a table
sql>> select * from drawn order by effdate,code desc;
CODE EFFDATE AMT
1 01-JAN-06 30
2 01-JUL-08 100
2 01-JUL-09 150
2 01-OCT-09 160
1 01-OCT-09 50
2 01-FEB-10 200
2 01-MAR-10 250
1 01-MAR-10 80
1 01-APR-10 100
from this my desired output should be:
EXEC DUE_DRAWN ('01-SEP-08');
code effdate amt(1+2)
2 01-SEP-08 130
2 01-JUL-09 180
2 01-OCT-09 210
2 01-FEB-10 250
2 01-MAR-10 330
1 01-APR-10 350
here i want to display total amt as on particular date and with the particular code. if date are same in different code then code 2 will be given as priority . here outputput of amt is amt(code1+code2). so i have written below
code...
PROCEDURE DUE_DRAWN(V_DATE IN DATE) IS
CURSOR C1(V_DATE IN DATE) IS SELECT * from drawn order by effdate,code desc;
PREV_REC C1%ROWTYPE;
CURR_REC C1%ROWTYPE;
V_FDATE DATE;
V_INL_GPY NUMBER(5):=0;
V_BPY     NUMBER(5):=0;
BEGIN
OPEN C1(V_DATE);
FETCH C1 INTO PREV_REC;
V_INL_GPY:=PREV_REC.AMT;
LOOP
     FETCH C1 INTO CURR_REC;
     EXIT WHEN C1%NOTFOUND;
     IF V_DATE > CURR_REC.EFFDATE THEN
          V_FDATE:=V_DATE;
     ELSE
          V_FDATE:=CURR_REC.EFFDATE;
     END IF;
     IF CURR_REC.CODE=2 THEN
          BEGIN
          SELECT AMT INTO V_INL_GPY FROM DRAWN WHERE CODE=1 AND EFFDATE=CURR_REC.EFFDATE;
          EXCEPTION
               WHEN OTHERS THEN
               NULL;
          END ;
          DBMS_OUTPUT.PUT_LINE(CURR_REC.CODE|| ' '||V_FDATE || ' '||(CURR_REC.AMT+V_INL_GPY));
     ELSIF CURR_REC.EFFDATE != PREV_REC.EFFDATE THEN
          SELECT AMT INTO V_BPY FROM DRAWN WHERE CODE=2 AND EFFDATE=(SELECT MAX(EFFDATE) FROM DRAWN
                                                                                                                        WHERE CODE=2 AND EFFDATE<=CURR_REC.EFFDATE);
               DBMS_OUTPUT.PUT_LINE(CURR_REC.CODE|| ' '||V_FDATE || ' '||(CURR_REC.AMT+V_BPY));
          END IF;           
     PREV_REC:=CURR_REC;     
END LOOP;
END;
please tell is there any other way to write this ...
thanks
Edited by: Hi FRNzzz!! on Jun 3, 2010 6:45 PM
Edited by: Hi FRNzzz!! on Jun 3, 2010 7:43 PM
Edited by: Hi FRNzzz!! on Jun 3, 2010 7:44 PM
Edited by: Hi FRNzzz!! on Jun 3, 2010 7:47 PM

The if condition is without an operator
ELSIF CURR_REC.EFFDATE PREV_REC.EFFDATE THENwhat operator did you apply?
When I run your code, with your sample data I get a different output to you, but I assumed a ">" operator for the above condition:
SQL> declare
  2 
  3  V_DATE DATE :=TO_DATE('010908','ddmmyy');
  4  cursor c1 is
  5    select * from drawn order by effdate, code desc;
  6   
  7    PREV_REC  C1%ROWTYPE;
  8    CURR_REC  C1%ROWTYPE;
  9    V_FDATE   DATE;
10    V_INL_GPY NUMBER(5) := 0;
11    V_BPY     NUMBER(5) := 0;
12   
13  begin
14 
15    OPEN C1;
16   
17    FETCH C1 INTO PREV_REC;
18    V_INL_GPY := PREV_REC.AMT;
19   
20    LOOP
21      FETCH C1 INTO CURR_REC;
22      EXIT WHEN C1%NOTFOUND;
23     
24      IF V_DATE > CURR_REC.EFFDATE THEN
25        V_FDATE := V_DATE;
26      ELSE
27        V_FDATE := CURR_REC.EFFDATE;
28      END IF;
29     
30      IF CURR_REC.CODE = 2 THEN
31        BEGIN
32          SELECT  AMT
33          INTO    V_INL_GPY
34          FROM    DRAWN
35          WHERE   CODE    = 1
36          AND     EFFDATE = CURR_REC.EFFDATE;
37   
38        EXCEPTION
39          WHEN OTHERS THEN
40            NULL;
41 
42        END ;
43        DBMS_OUTPUT.PUT_LINE(CURR_REC.CODE || ' ' ||V_FDATE || ' ' || ( (CURR_REC.AMT + V_INL_GPY) * 0.1) );
44 
45      ELSIF CURR_REC.EFFDATE = PREV_REC.EFFDATE THEN
46        SELECT  AMT
47        INTO    V_BPY
48        FROM    DRAWN
49        WHERE   CODE    = 2
50        AND     EFFDATE = (SELECT MAX(EFFDATE)
51                           FROM   DRAWN
52                           WHERE  CODE    = 2
53                           AND    EFFDATE <= CURR_REC.EFFDATE);
54                          
55        DBMS_OUTPUT.PUT_LINE( CURR_REC.CODE|| ' ' || V_FDATE || ' ' || ( (CURR_REC.AMT+V_BPY) * 0.1 ) );
56      END IF;
57 
58      PREV_REC := CURR_REC;
59 
60    END LOOP;
61 
62  END;
63  /
2 01-09-2008 00:00:00 13
2 01-07-2009 00:00:00 18
2 01-10-2009 00:00:00 21
1 01-10-2009 00:00:00 21
2 01-02-2010 00:00:00 25
2 01-03-2010 00:00:00 33
1 01-03-2010 00:00:00 33Also, could you kindly place before and after any code you post.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Anyone knows how to make this code to netbeans??

    anyone knows how to make this code to netbeans?? i just want to convert it into netbeans... im not really advance with this software... anyway..just reply if you have any idea...or steps how to build it... etc.... thanks guys...
       import javax.swing.*;
       import javax.swing.table.*;
       import java.awt.*;
       import java.awt.event.*;
       import java.util.regex.*;
       public class FilterTable {
         public static void main(String args[]) {
           Runnable runner = new Runnable() {
             public void run() {
               JFrame frame = new JFrame("Sorting JTable");
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               Object rows[][] = {
                 {"AMZN", "Amazon", 41.28},
                 {"EBAY", "eBay", 41.57},
                 {"GOOG", "Google", 388.33},
                 {"MSFT", "Microsoft", 26.56},
                 {"NOK", "Nokia Corp", 17.13},
                 {"ORCL", "Oracle Corp.", 12.52},
                 {"SUNW", "Sun Microsystems", 3.86},
                 {"TWX",  "Time Warner", 17.66},
                 {"VOD",  "Vodafone Group", 26.02},
                 {"YHOO", "Yahoo!", 37.69}
               Object columns[] = {"Symbol", "Name", "Price"};
               TableModel model =
                  new DefaultTableModel(rows, columns) {
                 public Class getColumnClass(int column) {
                   Class returnValue;
                   if ((column >= 0) && (column < getColumnCount())) {
                     returnValue = getValueAt(0, column).getClass();
                   } else {
                     returnValue = Object.class;
                   return returnValue;
               JTable table = new JTable(model);
               final TableRowSorter<TableModel> sorter =
                       new TableRowSorter<TableModel>(model);
               table.setRowSorter(sorter);
               JScrollPane pane = new JScrollPane(table);
               frame.add(pane, BorderLayout.CENTER);
               JPanel panel = new JPanel(new BorderLayout());
               JLabel label = new JLabel("Filter");
               panel.add(label, BorderLayout.WEST);
               final JTextField filterText =
                   new JTextField("SUN");
               panel.add(filterText, BorderLayout.CENTER);
               frame.add(panel, BorderLayout.NORTH);
               JButton button = new JButton("Filter");
               button.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                   String text = filterText.getText();
                   if (text.length() == 0) {
                     sorter.setRowFilter(null);
                   } else {
                     try {
                       sorter.setRowFilter(
                           RowFilter.regexFilter(text));
                     } catch (PatternSyntaxException pse) {
                       System.err.println("Bad regex pattern");
               frame.add(button, BorderLayout.SOUTH);
               frame.setSize(300, 250);
               frame.setVisible(true);
           EventQueue.invokeLater(runner);
       }

    its okay onmosh.....what we need to
    this...forum....is to have a good......relationship
    of programmers......and to start with .....we need to
    have a good attitude........right.....???.....no
    matter how good you are in programming but if you did
    not posses the right kind of attitude....everything
    is useless.....in the first place....all we
    want....is just to ask...some....help....but
    conflicts......but unluckily......we did not expect
    that there are members in here which......not
    good...to follow.....just as suggestion for those
    people not having the right kind of attidude...why
    can't you do in a very nice message sharing in a very
    nice....way....why we need to put some
    stupid....stuff...words.....can't you live with out
    ******* ****....its not.....lastly especially you
    have your children right now and people around...that
    somehow......idiolize...you even me....is one of
    them......but showing but attitude....is not
    good......tnx....hope you'll take it this....in the
    positive side.....be optimistic...guys....the
    world..is not yours....all of us will just past
    away....always..remember that one.....treasure..our
    stay in this....temporary home.....which...is
    world....Whoa. That post seems to be killing my brain.
    URK
    Join........us..........do not be..........afraid.......

  • How to make this code go faster?

    Hi,
    I have this code and its really slow. My question is how to make it faster since its taking about 10 hours.
    Code:
      loop at ti_equi.
        select matnr sernr lief_nr kunde datum uzeit bwart posnr
    appending corresponding fields of table ti_ser01
          from z_objk_ser01
         where sernr eq ti_equi-sernr
           and matnr eq ti_equi-matnr.
      endloop.
      delete ti_ser01 where not ( kunde in s_kunnr and
                                  bwart = '631' ).
      sort ti_ser01 by matnr sernr datum descending uzeit descending.
      delete adjacent duplicates from ti_ser01 comparing matnr sernr.
    What this code does is fetch all these fields and then just keeps the one that's been modified at last.
    I have created an index by sernr and matnr in table objk which makes it just a little bit faster.
    Any helpful answer will be appreciated.
    Regards,
    Roberto
    Edited by: Julius Bussche on Jan 27, 2009 4:29 PM
    Code tags added. Please use more meaningfull subject titles

    Hi roberto
    please avoid select statment inside loop.
    use code
    data: index type sy-tabix.
    data : ti-ser011 type standard table of zobjk-ser01 with header line.
    select matnr sernr lief_nr kunde datum uzeit bwart posnr
          from z_objk_ser01 into table ti_ser01.
    sort ti_ser01 by sernr matnr.
    sort ti_equi by sernr matnr.
    index = 1.
    loop at ti_equi.
        loop at ti_ser01 from index
         if  ti_ser01-sernr = ti_equi-sernr
              and ti_ser01-matnr = ti_equi-matnr.
            move-corresponding ti_ser01 to ti_ser011.
            append ti_ser011.
            index = sy-tabix.
            exit.  
         endif.
        endloop.
    endloop.
    here i have used one more internal table ti_ser011.
    you can delete specific record from ti_ser01 internal table on condition. at that time u don't need to create any other internal table like ti-ser011.
    in place of loop select statement---endloop.
    you can use this code. I think it will help you.
    please find if it is udeful.

  • How to make my code more modular? Please see thread.

    Question
    How do I go about doing something like the example below? Please see example.
    Example of current form
    My current method of painting to a component is as follows:
    public class Pane extends JPanel{
    public void paint(Graphics g){
    ... (all painting is done in here) ...
    }What I want to do is break the painting method into multiple methods and or classes, so my program is less cluttered and more modular. For instance,
    Method 1
    public class Pane extends JPanel{
    public void paintCustomButtons(Graphics g){
    // (all painting of my custom buttons are done in here) ...
    public void paintOtherComponents(2Graphics g){
    // (all other painting is done in here) ...
    }Or should I break it up into classes, the headers of those classes are:
    Method 2
    public class ButtonComponents extends JComponent
    public class OtherComponents extends JComponent
    //and then have a panel that contains all those components like so
    public class Pane extends JPanel{
    Pane(){
    add(ButtonComponents);
    Final Questions
    How can I break my painting code up? Is it possible to do method 1 or 2? If so, which would you suggest? Or would you suggest another way of organizing blocks of code?
    -Thanks for any suggestions as they are much appreciated
    Edited by: watwatacrazy on Feb 6, 2010 10:17 AM

    To break the paint method up you can always do the following:
        @Override
        public void paintComponent(Graphics g) {
            g2d = (Graphics2D) g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            paintAxis(g2d);
            paintCrossHair(g2d);
        public void paintCrossHair(Graphics2D g2d) {
         public void paintAxis(Graphics2D g2d) {{
         }Edited by: calypso on Feb 6, 2010 1:39 PM

  • How to make this query more efficient

    Hi, i have query to find out the count of records based on certain conditions like below.
    SELECT count(*)
    FROM new_orders WHERE card_number IS NOT NULL
    AND exp_date IS NOT NULL
    AND card_id in ( select card_id from old_orders );
    There are millions of records in both the tables. , so it is taking long time to run. Is there any solution to optimize this query.....thanks for help. Bcj

    you might want to give this a try.
    SELECT count(*)
      FROM new_orders no
    WHERE no.card_number IS NOT NULL
       AND no.exp_date IS NOT NULL
       AND exists (select 'x'
                     from old_orders oo
                    where oo.card_id = no.card_id);it would also help if you can post the information needed as suggested by rob.

  • Make this query more elegant?

    can anybody tell me how to make this subquery more elegant?
    select 1 lfdidx from dual union
    select 2 lfdidx from dual union
    select 49 lfdidx from dual union
    select 50 lfdidx from dual
    Thanks in advance

    Sergey, thanks, that's what I hoped for.
    http://www.sqlsnippets.com/en/topic-11821.html has some additional info concerning this.
    Regards, Thomas

  • How do I make this code generate a new pro when the "NEXT" button is pushed

    How do I make this code generate a new set of problem when the "NEXT" Button is pushed
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    /* Figure out how to create a new set of problms
    * Type a list of specifications, include a list of test cases
    * DONE :]
    package javaapplication1;
    import java.awt.GridLayout;
    import java.awt.Window;
    import javax.swing.*;
    import java.awt.event.*;
    * @author Baba Akinlolu -
    class Grid extends JFrame{
        int done = 0;
        final int score = 0;
        final int total = 0;           
            //Create Panels
            JPanel p2 = new JPanel();
            JPanel p3 = new JPanel();
            final JPanel p1 = new JPanel();
            //Create Radio buttons & group them
            ButtonGroup group = new ButtonGroup();
            final JRadioButton ADD = new JRadioButton("Addition");
            final JRadioButton SUB = new JRadioButton("Subtraction");
            final JRadioButton MUL = new JRadioButton("Multiplication");
            final JRadioButton DIV = new JRadioButton("Division");
            //Create buttons
            JButton NEXT = new JButton("NEXT");
            JButton END = new JButton("End");
            //Create Labels
            JLabel l1 = new JLabel("First num");
            JLabel l2 = new JLabel("Second num");
            JLabel l3 = new JLabel("Answer:");
            JLabel l4 = new JLabel("Score:");
            final JLabel l5 = new JLabel("");
            JLabel l6 = new JLabel("/");
            final JLabel l7 = new JLabel("");
            //Create Textfields
            final JTextField number = new JTextField(Generator1());
            final JTextField number2 = new JTextField(Generator1());
            final JTextField answer = new JTextField(5);
        Grid(){
            setLayout(new GridLayout(4, 4, 2 , 2));
            p2.add(ADD);
            p2.add(SUB);
            group.add(ADD);
            group.add(SUB);
            group.add(MUL);
            group.add(DIV);
            p2.add(ADD);
            p2.add(SUB);
            p2.add(DIV);
            p2.add(MUL);
            //Add to panels
            p1.add(l1);
            p1.add(number);
            p1.add(l2);
            p1.add(number2);
            p1.add(l3);
            p1.add(answer);
            p1.add(l4);
            p1.add(l5);
            p1.add(l6);
            p1.add(l7);
            p3.add(NEXT);
            p3.add(END);
            //Add panels
            add(p2);
            add(p1);
            add(p3);
            //Create Listners
            Listeners();
    void Listeners(){
          NEXT.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
             int answer1 = 0;
             //Grab the numbers entered
             int numm1 = Integer.parseInt(number.getText());
             int numm2 = Integer.parseInt(number2.getText());
             int nummsanswer = Integer.parseInt(answer.getText());
             //Set the score and total into new variabls
             int nummscore = score;
             int nummtotal = total;
             //Check if the add radio button is selected if so add
             if (ADD.isSelected() == true){
                 answer1 = numm1 + numm2;
             //otherwise check if the subtract button is selected if so subtract
             else if (SUB.isSelected() == true){
                 answer1 = numm1 - numm2;
             //check if the multiplication button is selected if so multiply
             else if (MUL.isSelected() == true){
                 answer1 = numm1 * numm2;
             //check if the division button is selected if so divide
             else if (DIV.isSelected() == true){
                 answer1 = numm1 / numm2;
             //If the answer user entered is the same with th true answer
             if (nummsanswer == answer1){
                 //add to the total and score
                 nummtotal += 1;
                 nummscore += 1;
                 //Convert the input back to String
                 String newscore = String.valueOf(nummscore);
                 String newtotal = String.valueOf(nummtotal);
                 //Set the text
                 l5.setText(newscore);
                 l7.setText(newtotal);
             //Otherwise just increase the total counter
             else {
                 nummtotal += 1;
                 String newtotal = String.valueOf(nummtotal);
                 l7.setText(newtotal);
      //Create End listener
    END.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // get the root window and call dispose on it
            Window win = SwingUtilities.getWindowAncestor(p1);
            win.dispose();
    //new Grid();
    String Generator1(){
         int randomnum;
         randomnum = (1 + (int)(Math.random() * 100));
         String randomnumm = String.valueOf(randomnum);
         return randomnumm;
    public class Main {
         * @param args the command line arguments
        public static void main(String[] args) {
            // TODO code application logic here
            JFrame frame = new Grid();
            frame.setTitle("Flashcard Testing");
            frame.setSize(500, 200);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
    }Edited by: SirSaula on Dec 7, 2009 10:17 AM

    Not only are you continuing to post in the wrong forum but now you are multiposting: [http://forums.sun.com/thread.jspa?threadID=5418935]
    If people haven't answered you other posting its probably because we don't understand the question. Quit cluttering the forum by asking the same question over and over and then next time you have a new question post it in the proper forum. Your first posting was moved becuase you didn't post it properly.

  • How to follow best coding practices and make this code runable.

    How to change this code to make it work and follow best coding practices.
    This code is to add fields to internal table LIST which already exist.
    In the loop are all the selections which are to be made.
    But i am new to ABAP and not sure how to make this work.
    please help me.
    DATA: wa_list LIKE LINE OF list,
          l_v_index TYPE i.
    DATA: t_price_result1 TYPE STANDARD TABLE OF komv WITH HEADER LINE INITIAL SIZE 0.
    DATA: wa_result LIKE LINE OF t_price_result1.
    LOOP AT list INTO wa_list.
      l_v_index = sy-tabix.
    *GET MATERIAL DOCUMENT(MBLNR) AND DELIVERY NUMBER(XBLNR)
      SELECT  mkpf~mblnr
              mkpf~xblnr
       into (wa_list-mblnr, wa_list-xblnr )
    *            INTO i_list
       from mkpf inner join mseg
    *   up to 1 rows
        on mkpf~mandt = mseg~mandt
        and mkpf~mblnr = mseg~mblnr
        and mkpf~mjahr = mseg~mjahr
        where mseg~matnr = wa_list-matnr
         and mseg~charg = wa_list-charg
         and mseg~kunnr = wa_list-kunnr
         and mseg~sobkz = wa_list-sobkz
         and mseg~werks = wa_list-werks
         and mkpf~budat in budat.
                                                                "RFC3762
      ENDSELECT.
      wa_list-mblnr = list-mblnr.
      wa_list-xblnr = list-xblnr.
    * GET POSNR FROM TABLE LIPS
      SELECT posnr
      FROM lips
      INTO list-posnr
      up to 1 rows
      WHERE vbeln = wa_list-xblnr AND
                 matnr = wa_list-matnr.
      ENDSELECT.
      wa_list-posnr = list-posnr.
    * GET SALES ORDER #
      SELECT vbelv
      FROM vbfa
      INTO list-vbelv
      up to 1 rows
    *        INTO wa_list
      WHERE vbeln =  wa_list-xblnr.
      ENDSELECT.
      wa_list-vbelv = list-vbelv.
    *GET PO
      SELECT bstkd
      FROM vbkd
      INTO list-bstkd
      up to 1 rows
      WHERE vbeln =  wa_list-vbelv
          AND posnr = 0.
      ENDSELECT.
      wa_list-bstkd = list-bstkd.
    *get serial number
      SELECT SINGLE obknr
       FROM ser01
       INTO list-obknr
       WHERE lief_nr = wa_list-xblnr
           AND posnr = wa_list-posnr.
    wa_list-obknr = list-obknr.
    SELECT sernr
    FROM objk
    INTO list-sernr
    up to 1 rows
    WHERE obknr = wa_list-obknr.
    ENDSELECT.
    wa_list-sernr = wa_list-sernr.
    *get date
    SELECT budat FROM mkpf
    INTO list-budat
    up to 1 rows
    where mblnr = wa_list-mblnr.
    ENDSELECT.
    wa_list-budat = list-budat.
    *get CLP
    SELECT   vkorg vtweg spart
    INTO (list-vkorg, list-vtweg, list-spart)
    up to 1 rows
    FROM vbak WHERE vbeln = wa_list-vbelv.
    ENDSELECT.
    wa_list-vkorg = list-vkorg.
    wa_list-vtweg = list-vtweg.
    wa_list-spart = list-spart.
    SELECT pstyv
    INTO list-pstyv
    FROM  vbap
    up to 1 rows
    WHERE vbeln = wa_list-vbelv AND posnr = wa_list-posnr.
    ENDSELECT.
    wa_list-pstyv = list-pstyv.
    CALL FUNCTION 'Z_SD_PRICING_CONDITION'
    EXPORTING
    i_organization                  = wa_list-vkorg
    i_dist_channel                  = wa_list-vtweg
    i_division                      = wa_list-spart
    i_customer                      = wa_list-kunnr
    i_plant                         = wa_list-werks
    *      i_pricng_date                   = sy-datum
    i_material                      = wa_list-matnr
    *   I_SALES_UNIT                    = 'EA'
    *   I_QUANTITY                      = '1.000'
    i_stor_loc                      = '0001'
    i_item_cat                      = 'TAN'
    *   I_AUART                         =
    *   I_REFRESH                       = 'X'
    *   I_KOMP                          =
    *   I_KOMK                          =
    * IMPORTING
    *   E_MES_TYPE                      =
    *   E_MES_NUMBER
    *   E_MESSAGE                       =
    TABLES
    t_price_result                  = t_price_result1
    * EXCEPTIONS
    *   CUSTOMER_NOT_FOUND              = 1
    *   PLANT_NOT_FOUND                 = 2
    *   MATERIAL_NOT_FOUND              = 3
    **   PLANT_MATERIAL_NOT_FOUND       = 4
    *   SALES_DATA_NOT_FOUND            = 5
    *   ORG_UNIT_NOT_FOUND              = 6
    *   UNABLE_TO_CALCULATE_PRICE       = 7
    *   UNABLE_TO_FORMAT_PRICE          = 8
    *   MANDATORY_INFOR_MISSING         = 9
    *   OTHERS                          = 10
    LOOP AT t_price_result1.
      IF  t_price_result1-kschl = 'ZPR2'.
        wa_list-kbetr = t_price_result1-kbetr.
      ELSE.
        wa_list-kbetr = 0.
      ENDIF.
    ENDLOOP.
    MODIFY list FROM wa_list INDEX l_v_index.
    ENDLOOP.

    Hi,
    Lets first start from your Select Statement.....Replace your SELECT ....ENDSELECT by SELECT Into Internal Table
    Your program is having a SELECT...ENDSELECT within LOOP...ENDLOOP........One should avoid doing this as far as possible.
    SELECT  mkpf~mblnr
                  mkpf~xblnr
    INTO itab
    for all entires i_list
    from    mkpf inner join mseg
        on   mkpfmandt = msegmandt
        and mkpfmblnr = msegmblnr
        and mkpfmjahr = msegmjahr
        where mseg~matnr = i_list-matnr
           and mseg~charg = i_list-charg
           and mseg~kunnr = i_list-kunnr
           and mseg~sobkz = i_list-sobkz
           and mseg~werks = i_list-werks
           and mkpf~budat in budat.
    Restructure youe complete code with this approach and Share your Finding's.
    You can also think of using a SAP Standard FM.
    Anyway..What is the objective/Output of this report?

  • How to make a code in which i have to detect 3 objects

    Hello everyone,
    I am new in Labview. I want to make a code in which i have to detect 3 objects and they are in different shapes (rectangle, triangle etc).
    1. How many objects in image.
    2. What is the size of each object in image
    3. At what position they are laying.
    4. Data array of histogram of each object.
    5. What is the color of each object.
    Please help me out. I am confused with the tool. Which tool i will use for this Vision Assistant or Vision Builder AI or if i use labview directly to make the code what steps should follow to make this code.
    Thanks
    Zeeshan

    Hello Zeeshan,
    this is Vanessa, AE from Germany. I really like to help you with your project but like the other members already told you it would be easier if you have a certain problem.
    Using your Shapes.jpg you have several options in the Vision Assistant. For identifiying circular objects of different size the tool "Find circular Edge" from the "Machine Vision" tab is the right choice (see screenshot attached). The result will be the center position and the radius so on. The pattern match function is not the right option because each of your objects has a different shape. In order to use this tool you need several copies of your object.
    Do you really need colored images? For most application it is sufficient to use grayscale images. Be aware that some functions are only available for grayscale and your program will speed up.
    Please tell us more details about your project.
    Kind regards,
    Vanessa
    Attachments:
    vision assistant.PNG ‏305 KB

  • Suggestions on how to make this coding better?

    Hey everyone, I was just wondering if anyone had any suggestions on how to make my code better. It's for a project and I want to get a good grade on it. It works fine but I just want to see what everyone thought before I hand it in.
    import java.io.*;
    import java.util.StringTokenizer;
         This class process the input expressions containing rational expressions and proecesses them and then outputs the results.
         @author *****
         @version 1.0
    public class Proj1
         private static String buffer = null; //User input
         private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         private static PrintWriter outfile = null;
         private static int totCount = 0, goodCount = 0, badCount = 0; //Total, Valid, and Invalid counts
         private static boolean fileInput = false; //File to read data
         private static boolean fileOutput = false; //Output for the data
         private static boolean screenOutput = false; //Output so the user can view it
         private static String outFile = null; //File for output
         private static String inFile = null; //File for input
              Main method
         public static void main (String[] args) throws Exception
              Proj1 proj1 = new Proj1();
              proj1(args);
              runs the program
         private static void proj1(String [] args) throws Exception
              if (args.length == 0)
                   printBanner();
                   System.out.println("\n" + "\n" + "Please enter an expression, or type quit");
                   do
                        screenOutput=true;
                        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                        processData();
                   }while(!buffer.equals("quit"));//exits if quit is entered
              if (args[0].charAt(0) != '-')
                   badOption("Invalid Option Specified ");
              for(int i=1; i<args[0].length(); i++)
                   switch(args[0].charAt(i))
                        case 'f': fileInput = true;
                                    break;
                        case 'o': fileOutput = true;
                                    break;
                        case 'b': fileOutput = true;
                                    screenOutput = true;
                                    break;
                        default:  printBanner();
                                    invalidOption("Proj1: Invalid Option Found: " + args[0].charAt(i));
              if(fileInput && args[0].length() == 2)
                   screenOutput = true;
              if(fileInput && !fileOutput)
                   if(args.length == 1)
                        badOption("No Input File Specified.");
                   else
                        File inFile = new File(args[1]);
                        if(!inFile.exists())
                             nonExist("Input File " + args[1] + " not found");
                   br = new BufferedReader(new FileReader(args[1]));
                   printBanner();
                   processData();
                   closeFiles();
              if(fileOutput && fileInput)
                   printBanner();
                   if(args.length > 2)
                        outFile = args[2];
                   else
                        if(args.length > 1)
                             outFile = "proj1.dat";
                             noOut("No output file specified , defaulting to proj1.dat");
                   inFile = args[1];
                   br = new BufferedReader(new FileReader(inFile));
                   processData();
                   closeFiles();
              if(fileOutput && screenOutput)
                   printBanner();
                   if(args.length == 1)
                        outFile = "proj1.dat";
                        noOut("No output file specified, defaulting to proj1.dat");
                        System.out.println("\n" + "\n" + "Please enter an expression, or type quit");
                        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
                        processData();
                        closeFiles();
                   else
                        outFile=args[1];
                        System.out.println("\n" + "\n" + "Please enter an expression, or type quit");
                        br = new BufferedReader(new InputStreamReader(System.in));
                        processData();
                        closeFiles();
         Processes the input data by the user by doing the specified operations and then displays the output
         private static void processData() throws Exception
              if(fileOutput)
                   outfile = new PrintWriter(new FileOutputStream(outFile), true);
              else if(fileOutput && screenOutput)
                   outfile = new PrintWriter(new FileOutputStream(outFile), true);
              buffer = br.readLine();
              while(!buffer.equals(""))
                   StringTokenizer reader = new StringTokenizer(buffer);
                   int count = 0;
                   String number1 = null;
                   String number2 = null;
                   String op = null;
                   boolean valid = true;
                   boolean secondNumber = true;
                   while (reader.hasMoreTokens())
                        switch(count)
                             case 1: number1 = reader.nextToken();
                                       break;
                             case 2: op = reader.nextToken();
                                       break;
                             case 3: number2 = reader.nextToken();
                                       break;
                        count++;
                   if(number1 == null || number1.equals("quit"))
                        printSummary(goodCount, badCount, totCount);
                        closeFiles();
                   if(number2 == null)
                        secondNumber = false;
                   char character;
                   int position = 0;
                   String s = "0123456789/-";
                   for(int i = 0; i < number1.length(); i++)
                        character = number1.charAt(i);
                        position = s.indexOf(character);
                        if(position == -1)
                             valid = false;
                   if(secondNumber)
                        for(int i = 0; i < number2.length(); i++)
                             character = number2.charAt(i);
                             position = s.indexOf(character);
                             if(position == -1)
                                  valid=false;
                   int denomin2 = 0;
                   int numer2 = 0;
                   String n1 = null;
                   String d1 = null;
                   int izerCount = 0;
                   StringTokenizer st2 = new StringTokenizer(number1,"/");
                   while(st2.hasMoreTokens())
                        switch(izerCount)
                             case 1: n1 = st2.nextToken();
                                       d1 = "1";
                                       break;
                             case 2: d1 = st2.nextToken();
                        izerCount++;
                   int numer1;
                   int denomin1;
                   int tokenCount = 0;
                   if(valid)
                        numer1 = Integer.parseInt(n1);
                        denomin1 = Integer.parseInt(d1);
                        String n2 = null;
                        String d2 = null;
                        if(secondNumber)
                             StringTokenizer st3 = new StringTokenizer(number2, "/");
                             while(st3.hasMoreTokens())
                                  switch(tokenCount)
                                       case 1: n2 = st3.nextToken();
                                                 d2 = "1";
                                                 break;
                                       case 2: d2 = st3.nextToken();
                                  tokenCount++;
                             numer2 = Integer.parseInt(n2);
                             denomin2 = Integer.parseInt(d2);
                             RationalNumber z1 = new RationalNumber(numer2, denomin2);
                        RationalNumber z = new RationalNumber(numer1,denomin1);
                        RationalNumber z1 = new RationalNumber(numer2,denomin2);
                        boolean lt = true; //whether the first number is less than the second
                        boolean gt = true; //whether the first number is greater than the second
                        boolean eq = true; //whether the first number is equal to the second
                        boolean le = true; //whether the first number is less or equal to the second
                        boolean ge = true; //whether the first number is greater than or equal to the second
                        boolean zeroDenom = true; //whether the denominator is zero
                        if(denomin1 == 0 || denomin2 == 0)
                             zeroDenom = true;
                             badCount++;
                        else
                             zeroDenom = false;
                        if(!zeroDenom && secondNumber)
                             if(op.equals("+"))
                                  RationalNumber z2 = z.add(z1);
                                  if(screenOutput)
                                       System.out.println(buffer + " = " + z2.getNumerator()+ "/" +z2.getDenominator());
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println(buffer + " = " + z2.getNumerator()+ "/" +z2.getDenominator());
                                  goodCount++;
                             else if(op.equals("-"))
                                  RationalNumber z3 = z.sub(z1);
                                  if(screenOutput)
                                       System.out.println(buffer + " = " + z3.getNumerator()+ "/" +z3.getDenominator());
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println(buffer + " = " + z3.getNumerator()+ "/" +z3.getDenominator());
                                  goodCount++;
                             else if(op.equals("*"))
                                  RationalNumber z4 = z.mlt(z1);
                                  if(screenOutput)
                                       System.out.println(buffer + " = " + z4.getNumerator()+ "/" +z4.getDenominator());
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println(buffer + " = " + z4.getNumerator()+ "/" +z4.getDenominator());
                                  goodCount++;
                             else if(op.equals("/"))
                                  RationalNumber z5 = z.div(z1);
                                  if(screenOutput)
                                       System.out.println(buffer + " = " + z5.getNumerator()+ "/" +z5.getDenominator());
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println(buffer + " = " + z5.getNumerator()+ "/" +z5.getDenominator());
                                  goodCount++;
                             else if(op.equals("<"))
                                  lt=z.lt(z1);
                                  if(screenOutput)
                                       System.out.println(buffer + " is " + lt);
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println(buffer + " is " + lt);
                                  goodCount++;
                             else if(op.equals(">"))
                                  gt=z.gt(z1);
                                  if(screenOutput)
                                       System.out.println(buffer + " is " + gt);
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println(buffer + " is " + gt);
                                  goodCount++;
                             else if(op.equals("="))
                                  eq=z.eq(z1);
                                  if(screenOutput)
                                       System.out.println(buffer + " is " +  eq);
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println(buffer + " is " +  eq);
                                  goodCount++;
                             else if(op.equals("<="))
                                  le=z.le(z1);
                                  if(screenOutput)
                                       System.out.println(buffer + " is " + le);
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println(buffer + " is " + le);
                                  goodCount++;
                             else if(op.equals(">="))
                                  ge=z.ge(z1);
                                  if(screenOutput)
                                       System.out.println(buffer + " is " + ge);
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println(buffer + " is " + ge);
                                  goodCount++;
                             else
                                  if(op==null)
                                       if(screenOutput)
                                            System.out.println("Invalid expression: " + buffer);
                                       if(fileOutput || fileOutput && screenOutput)
                                            outfile.println("Invalid Expression: " + buffer);
                                       badCount++;
                             else
                                  if(screenOutput)
                                       System.out.println("Invalid expression: " + buffer );
                                  if(fileOutput || fileOutput && screenOutput)
                                       outfile.println("Invalid expression: " + buffer);
                                  badCount++;
                        else
                             if(screenOutput)
                                  System.out.println("Invalid operand: " + buffer);
                             if(fileOutput || fileOutput && screenOutput)
                                  outfile.println("Invalid operand: " + buffer);
                   else
                        if(screenOutput)
                             System.out.println("Invalid operand: " + buffer);
                        if(fileOutput || fileOutput && screenOutput)
                             outfile.println("Invalid operand: " + buffer);
                        badCount++;
                   buffer = br.readLine();
         Prints the banner for the program
         private static void printBanner()
              System.out.println("+++++++++++++++++++++++++++++++++++++++++"+"\n"+"+Welcome to the expression connection   +"+"\n"+"+++++++++++++++++++++++++++++++++++++++++");
         Prints the total number of expressions, total number of valid expressions, and total number of bad expressions.
         private static void printSummary(int goodCount, int badCount, int totCount)
              totCount = goodCount + badCount;
              System.out.println("\n");
              System.out.println("+++++++++++++++++++++++++++++++++++++++++");
              System.out.println("+ Total Expressions:        "+totCount);
              System.out.println("+ Total Valid Expressions   "+goodCount);
              System.out.println("+ Total Bad Expressions     "+badCount);
              System.out.println("+++++++++++++++++++++++++++++++++++++++++");
         Prints the error message if there is no output file specified
         private static void noOut(String errorString)
              System.out.println("\n");
              System.out.println("Proj1: " + errorString);
         Prints the error message if there is an invalid option input by the user
         private static void invalidOption(String errorString)
              System.out.println("\n");
              System.out.println("Proj1: " + errorString);
              System.out.println("Proj1: Usage is: java proj1 [-fob] [input] [output]");
              System.exit(0);
         Prints the error message if there is a bad option input by the user
         private static void badOption(String errorString)
              System.out.println("\n");
              System.out.println("Proj1: " + errorString);
              System.out.println("Proj1: Usage is: java proj1 [-fob] [input] [output]");
              System.exit(0);
         Prints the error message if the input file does not exist
         private static void nonExist(String errorString)
              System.out.println("\n");
              System.out.println("Proj1: " +errorString);
              System.out.println("Proj1: Usage is: java proj1 [-fob] [input] [output]");
              System.exit(0);
         Closes the files used by the user
         private static void closeFiles( )
              if(fileOutput && !screenOutput)
                   outfile.close();
              System.exit(0);
    }

    Well working is good...
    The code itself is less than spectacular I'm afraid. There is very little
    OOness to this. For your future reference when you complete a program
    and it consists of nothing but static methods you have done something
    incorrectly.
    As far as the code you do have goes some refactoring would be nice.
    The two main methods you have (proj1 but especially processData) are
    too long and unwieldy. processData seems to be a program in an of
    itself. It's complicated and hard to follow.
    My recommendation to you would be to read this http://java.sun.com/docs/books/tutorial/java/index.html
    Especially focus on the sections dealing with explanation of Object
    programming. These terms and concepts can certainly be confusing to
    new programmers so you may also want to consider finding yourself a
    tutor to help you get a better grasp of these concepts.
    In short if it works that's good. And it's also good to see that you put the
    effort and time in that you have. However if I was grading your project
    I'd give it a C- at best because this is a Java program in syntax only.

  • How to make reason code compulsory while processing F-53

    Hi Boss,
    Can u plz. tell me How to make reason code compulsory while processing F-53. this is because I have defined differnet reason code and one is having blank text.
    Thanks
    S

    hi,
    Just check this one dont check previous one....
    goto TCODE OBC4 and then click on ur company FELD status variant and double click on field status group ....
    Then click on G067 RECONCILTION ACCOUNTS and then double clickn that in that and then click on payment transactions and then select REASON CODE AS REQUIRED.
    ur problem will solve...
    if useful assign points
    regards,
    santosh kumar

  • How to make this program terminate?

    hi,
    how to make the code below stop? is is hanging because UnicastRemoteObject has registered it, and no-one has unregistered it?
    thanks,
    asjf
    import java.rmi.*;
    import java.rmi.server.*;
    public class UniTest extends UnicastRemoteObject implements Remote {
         UniTest() throws RemoteException {}
         public static void main(String [] arg) throws Exception {
              UniTest ut = new UniTest();
    }

    having done some tests it possibly seems linked to the size of the environment
    my system is a win2k machine, with sdk 1.4.1_02 from sun
    if I run
    java UniTest
    then that terminates, but if I first run a batch file containing this
    set FILL0=aaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnoooooppppp
    set FILL1=bbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaa
    set FILL2=cccccdddddeeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbb
    set FILL3=dddddeeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbccccc
    set FILL4=eeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccddddd
    set FILL5=fffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeee
    set FILL6=ggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffff
    set FILL7=hhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggg
    set FILL8=iiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggghhhhh
    set FILL9=jjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiii
    set FILL0=kkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjjj
    set FILLa=lllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjjjkkkkk
    then it doesn't?
    any help would be really appreciated?
    asjf

  • Something keeps trying to download on my mac and I don't know what it is. It is not in the apple store and just comes out nowhere and request for my password to download something and I don't know what it is. How to make this stop?

    Something keeps trying to download on my mac and I don't know what it is. It is not in the apple store and just comes out nowhere and request for my password to download something and I don't know what it is. How to make this stop? It pops up every single day.

    Erica,
         I can, with 99.99% certainty, tell you that you are absolutely right in not wanting to download or install this "Helper," whatever it is (but we can be equally certain it would not "help" anything).
         I cannot comment as to Oglethorpe's recommendation of 'adwaremedic'; I am unfamiliar with it.  His links to the Apple discussion and support pages warrant your time and attention.
         It might be really simple -- Trying looking in your Downloads folder, trash anything that you don't know with certainty is something you want to keep, and then Secure Empty your Trash. Then remove the AdBlock extension, LastPass, and Web of Trust extensions to Safari and re-boot. If the issue goes away, still be extraordinarily careful in the future.
         Unfortunately, it's probably not going to be that simple to get rid of, in which case I'd then try the line by line editing in HT203987. 
         I have no further suggestions (other than a complete wipe and re-install...but that's a pain because trying to restore from Time Machine would simply ... restore the Mal).
       For the rest of us, please post when you find a solution.
         Best.
         BPW
      (Also, try to edit your second post -- black out your last name on the screenshot and re-post it for others)

  • TS2634 I bought a composite AV cable with 30 pin connector at a proper apple store for my ipad 2 which no longer works now i have updated to ios7 - please advise how to make this work ?

    I bought a composite AV cable with 30 pin connector at a proper apple store for my ipad 2 which no longer works now i have updated to ios7 - please advise how to make this work ?

    I have the same problem.
    Two similar discussions:
    https://discussions.apple.com/message/23081658#23081658
    https://discussions.apple.com/message/23281391#23281391
    I have not yet seen any official response to the question: "Is the Apple AV Composite cable fully supported with 30pin connector devices upgraded with iOS7 - specifically ? - eg. iPad 2, iPhone 4, iPhone 4s"
    If it is not currently supported is that then due to a bug / oversight and in that case is it something that will be fixed in the near future?
    Please let us know what feedback you got from asking Apple support.

  • How to make this in Adobe Photoshop CS5? PLEASE Help!

    Hey guys, i reallllllllly  want to know how to make this image in adobe photoshop.... the cone around the forecast track. Can you guys please show me how to do this? Id greatly appreciate it!

    There's a lot implied here, but you're not going to get around having to do the following in general:
    Use an unmarked map as a background.
    Draw shapes on layer(s) above the background and make them partially transparent.
    Obviously the key is to draw shapes that express the "cone of uncertainty" exactly as you want it to look, and with a minimum of fuss.
    I'd suggest drawing shapes with Path tools, then filling the shapes, applying a stroke (for the edge border), and using masking to hide parts you don't want to show (or which overlap with the other parts you're drawing).
    Are you needing to do this over and over or just once?
    -Noel

Maybe you are looking for