Need Help Urgently please

i'm not a Java expert but i like to think i'm not a beginner.
I've been working on a University Project now for a week and it must be submitted tomorrow . It is a Lexical Analyzer of sorts but for some reason the program freezes and kicks out this error "java.lang.ClassNotFoundException <uncaught>"thread=main", " when i debug to find the problem. it gives no errors on compile and just freezes. i can't figure this out . if anyone can help me it would be greatly appreciated.
Below is the code
My email is : [email protected]
I know the code might be a bit messy or cluttered, so i apologize ahead of time,
package components;
import java.io.Console;
import java.io.InputStreamReader;
import java.util.regex.*;
import java.lang.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
import java.util.ArrayList;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Container;
import javax.swing.*;
import javax.swing.filechooser.*;
public class LA extends JPanel implements ActionListener
    static private final String newline = "\n";
    JButton OpenButton, LexButton, ExitButton, ViewLexButton, ViewSymbolButton;
    JTextArea log;
    JFileChooser fc;
    String Filepath="";
    String Filedata="";
    String Scanloc="";
    int strlength=0;
    String temp="";
    String[] reswords={"abstract","do","if","package","synchronized","boolean",
                           "double","implements","private","this","break","else","enum",
                           "import","protected","throw","byte","extends","instanceof",
                           "public","throws","case","false","int","return","transient",
                           "catch","final","interface","short","true","char","finally",
                           "long","static","try","class","float","native","strictfp",
                           "void","const","for","new","super","volatile","continue",
                           "goto","null","switch","while","default","assert"};
    String[] symbols={"+","-","%","/","*","_","(",")","[","]","{","}","||","&&",
                          "=","==","++","--","!=",">",">=","<=","<",".",",",";",":","!","<>","=>","=<","+=","-="};
    String[] symident={"PLUS","MINUS","MODULUS","DIVIDE","MULTIPLY","UNDERSCORE",
                           "OPENING ROUND BRACKET","CLOSING ROUND BRACKET",
                           "OPENING SQUARE BRACKET","CLOSING SQUARE BRACKET","OPENING CURLY BRACE",
                           "CLOSING CURLY BRACE","OR","AND","EQUALS","INSTANCE COMPARE","INCREMENT",
                           "DECREMENT","NOT EQUAL","GREATER THAN","GREATER THAN OR EQUAL TO",
                           "LESS THAN OR EQUAL TO","LESS THAN","DOT","COMMA","SEMI-COLON","COLON","NOT","NOT EQUAL",
                           "EQUAL TO OR GREATER THAN","EQUAL TO OR LESS THAN","PLUS EQUALS","MINUS EQUALS"};
    boolean state=false;
    int i=0;
    int j=0;
    boolean match=false;
    String LexToken="C:\\LexToken.txt";
    String SymTable="C:\\SymbolT.txt";
    String Lexstring="";
    String SymbolTableString=" Symbol |   Kind  | Type \n";
    ArrayList<String> wordarray=new ArrayList<String>();
    String[] temparray1;
    String REPat="";
    public LA()
        super(new BorderLayout());
        log = new JTextArea(20,40);
        log.setMargin(new Insets(5,5,5,5));
        log.setEditable(false);
        JScrollPane logScrollPane = new JScrollPane(log);
        fc = new JFileChooser();
        OpenButton = new JButton("Open a File");
        OpenButton.addActionListener(this);
        ExitButton = new JButton("Exit");
        ExitButton.addActionListener(this);
        LexButton = new JButton("Analyze Lexically");
        LexButton.addActionListener(this);
        ViewLexButton = new JButton("View Token/Lexeme Table");
        ViewLexButton.addActionListener(this);
        ViewSymbolButton = new JButton("View Symbol Table");
        ViewSymbolButton.addActionListener(this);
        JPanel buttonPanel = new JPanel(); //use FlowLayout
        buttonPanel.add(OpenButton);
        buttonPanel.add(LexButton);
        buttonPanel.add(ViewLexButton);
        buttonPanel.add(ViewSymbolButton);
        buttonPanel.add(ExitButton);
        add(buttonPanel, BorderLayout.PAGE_START);
        add(logScrollPane, BorderLayout.CENTER);
    public static String StoreAsString(String FileName)throws Exception
             FileInputStream fis = new FileInputStream(FileName);
          int x= fis.available();
          byte b[]= new byte[x];
          fis.read(b);
          String content = new String(b);
          return content;
     public static void FileWrite(String filename,String Message)throws IOException
          try
          FileWriter fileWriter = new FileWriter(filename);
          BufferedWriter buffWriter = new BufferedWriter(fileWriter);
          buffWriter.write(Message);
          buffWriter.close();
          fileWriter.flush();
          fileWriter.close();
          catch(IOException e)
          System.out.println("Exception "+ e.getMessage());
     public boolean TestForResWord(int val)
          char marker=' ';
          for(i=0;i<reswords.length;i++)
                 if(reswords==wordarray.get(val))
               i=reswords.length+1;
               marker='Y';
     else
               marker='N';
          if(marker=='Y')
               return true;
          else
               return false;
     public boolean patmatch(String patstr)
     Pattern pattern= Pattern.compile(patstr);
          Matcher matcher= pattern.matcher(temparray1[j]);
          boolean temp=false;
          temp=matcher.find();
          if (temp=true)
               return true;
          else
               return false;
public void actionPerformed(ActionEvent e)
try
          if (e.getSource() == OpenButton)
     int returnVal = fc.showOpenDialog(LA.this);
     if (returnVal == JFileChooser.APPROVE_OPTION)
     File file = fc.getSelectedFile();
     Filepath = new String(file.getPath());
     log.append("Opening: " + file.getName() + "." + newline);
     log.append(Filepath + newline);
     Filedata=StoreAsString(Filepath);
     log.append(Filedata);
else
log.append("Open command cancelled by user." + newline);
     else if (e.getSource() == LexButton)
     //int answer = JOptionPane.showConfirmDialog(null,"Are you ready to analyze Lexically?");
          //          if (answer == JOptionPane.YES_OPTION)      // User clicked YES.
                         log.setText("");
               try
                    FileReader rd = new FileReader(Filepath);      // Create the tokenizer to read from a file
                    StreamTokenizer st = new StreamTokenizer(rd);
                    int linenum=0;
                    int colnum=0;
                    st.parseNumbers();           // Prepare the tokenizer for Java-style tokenizing rules
                    st.wordChars('_', '_');
                    st.eolIsSignificant(true);
                    // If whitespace is not to be discarded, make this call
                    st.ordinaryChars(0, ' ');
                    // These calls caused comments to be discarded
                    st.slashSlashComments(true);
                    st.slashStarComments(true);
                    // Parse the file
                    int token = st.nextToken();
                    while (token != StreamTokenizer.TT_EOF)
                    token = st.nextToken();
                         switch (token)
                              case StreamTokenizer.TT_NUMBER:
                              // A number was found; the value is in nval
                              double num = st.nval;
                              linenum=st.lineno();
                              temp=String.valueOf(num);
                              strlength=temp.length();
                              Lexstring=Lexstring+"\nLine : "+linenum+" |Column : "+colnum+" |Token: "+num+" |Lexeme: NUMBER";
                              colnum=colnum+strlength;
                              break;
                              case StreamTokenizer.TT_WORD:
                              // A word was found; the value is in sval
                              //String[] wordarray;
                              boolean match=false;
                              String word = st.sval;
                              int z=0;
                              if(z==0)
                                   wordarray.add(0,word);
                                   z++;
                              linenum=st.lineno();
                              char[] characters=word.toCharArray();
                         for(int x=0;x<characters.length;x++)
                                   for (int y=0;y<symbols.length;y++)
                                        String tempword="";
                                        tempword=tempword+characters[x];
                                        while((z>=1)&&(x<=characters.length))
                                        if (tempword==symbols[y])
                                             if((((characters[x]=='+')||(characters[x]=='-')||(characters[x]=='='))&&((wordarray.get(0+z-1)=="+")||(wordarray.get(0+z-1)=="-")||(wordarray.get(0+z-1)=="=")))||(tempword==wordarray.get(0+z-1))||(((tempword=="=")&&(wordarray.get(0+z-1)=="<"))||((tempword=="=")&&(wordarray.get(0+z-1)==">"))||((tempword==">")&&(wordarray.get(0+z-1)=="="))||((tempword=="<")&&(wordarray.get(0+z-1)=="="))||((tempword==">")&&(wordarray.get(0+z-1)=="<")) ) )
                                                  wordarray.add(0+z,wordarray.get(0+z)+characters[x]);
                                             else
                                             z++;//NOT SURE ABOUT THIS INCREMENT
                                             wordarray.add(0+z,""+characters[x]);
                                             z++;
                                   wordarray.add(0+z,wordarray.get(0+z)+characters[x]);
                         while(state=false)
                              overhere:                                                                       
                                                  for(j=0;j<wordarray.size();j++)
                                   String[] temparray1=(String[])wordarray.toArray();
                              temp=temparray1[j];
                                   strlength=temp.length();
                              if(strlength>1)
                              REPat="[\\W]";
                              match=patmatch(REPat);     
                              if(match=false)
                              for(i=0;i<reswords.length;i++)
                                   if(reswords[i]==wordarray.get(j))
                                        String lexemestr=reswords[i].toUpperCase();
                                        Lexstring=Lexstring+"\nLine : "+linenum+" |Column : "+colnum+" |Token: "+wordarray.get(j)+" |Lexeme: OP_"+lexemestr;
                                        colnum=colnum+strlength;
                                        i=reswords.length+1;
                                        j++;
                                        break overhere;
                              REPat="[(?i)[a-z][\\w*]*]";
                              match=patmatch(REPat);
                              if(match=true)
                                   boolean test1=false;
                                        test1=TestForResWord(j-1);
                                   boolean test2=false;
                                        test2=TestForResWord(j-2);
                                   boolean test3=false;
                                        test3=TestForResWord(j-3);
                                   String[] temparray2=(String[])wordarray.toArray();
                              temp=temparray2[j];
                                   strlength=temp.length();
                                   Lexstring=Lexstring+"\nLine : "+linenum+" |Column : "+colnum+" |Token: "+temp+" |Lexeme: VARIABLE";
                                   if(((test1==true)&&(test2==true)&&(test3==true))||((test1==true)&&(test2==true)&&(test3==false)))
                                        SymbolTableString=SymbolTableString+" "+temp+" | Method | "+wordarray.get(j-1)+"\n";
                                   else if((test1==true)&&(test2==false)&&(test3==false))
                                        SymbolTableString=SymbolTableString+" "+temp+" | Variable | "+wordarray.get(j-1)+"\n";
                                   colnum=colnum+strlength;
                                   i=reswords.length+1;
                              else if(match=false)
                              String[] temparray3=(String[])wordarray.toArray();
                              temp=temparray3[j];
                              strlength=temp.length();
                              Lexstring=Lexstring+"\nLine : "+linenum+" |Column : "+colnum+" |Token: "+temp+" |Lexeme: INVALID_WORD";
                              colnum=colnum+strlength;
                              i=reswords.length+1;
                              else
                              for(i=0;i<symbols.length;i++)
                                        if(symbols[i]==wordarray.get(j))
                                        Lexstring=Lexstring+"\nLine : "+linenum+" |Column : "+colnum+" |Token: "+wordarray.get(j)+" |Lexeme: OP_"+symident[i];
                                        colnum=colnum+strlength;                                    
                                        i=symbols.length+1;
                              else if(strlength==1)
                                   for(i=0;i<symbols.length;i++)
                                        if(symbols[i]==wordarray.get(j))
                                        Lexstring=Lexstring+"\nLine : "+linenum+" |Column : "+colnum+" |Token: "+wordarray.get(j)+" |Lexeme: OP_"+symident[i];
                                        colnum=colnum+strlength;                                    
                                        i=symbols.length+1;
                                        else
                                        boolean test1=false;
                                        test1=TestForResWord(j-1);
                                   boolean test2=false;
                                        test2=TestForResWord(j-2);
                                   boolean test3=false;
                                        test3=TestForResWord(j-3);
                                        Lexstring=Lexstring+"\nLine : "+linenum+" |Column : "+colnum+" |Token: "+wordarray.get(j)+" |Lexeme: VARIABLE";
                                        if(((test1==true)&&(test2==true)&&(test3==true))||((test1==true)&&(test2==true)&&(test3==false)))
                                                  SymbolTableString=SymbolTableString+" "+temp+" | Method | "+wordarray.get(j-1)+"\n";
                                        else if((test1==true)&&(test2==false)&&(test3==false))
                                                  SymbolTableString=SymbolTableString+" "+temp+" | Variable | "+wordarray.get(j-1)+"\n";
                                        colnum=colnum+strlength;
                                        i=symbols.length+1;     
                                                  if(wordarray.size()>=j)
                                   state=true;
                              //colnum=colnum+strlength;
                              break;
                              case '"':
                              // A double-quoted string was found; sval contains the contents
                              String dquoteVal = st.sval;
                              linenum=st.lineno();
                              strlength=dquoteVal.length();
                              colnum=colnum+strlength;
                              break;
                              case '\'':
                              // A single-quoted string was found; sval contains the contents
                              String squoteVal = st.sval;
                              linenum=st.lineno();
                              strlength=squoteVal.length();
                              colnum=colnum+strlength;
                              break;
                              case StreamTokenizer.TT_EOL:
                              // End of line character found
                              colnum=0;
                              break;
                              case StreamTokenizer.TT_EOF:
                              // End of file has been reached
                              break;
                              default:
                              // A regular character was found; the value is the token itself
                              char ch = (char)st.ttype;
                              break;
                              rd.close();
                    catch (IOException ex)
                         System.err.println("Exception with file! "+ex.getMessage());
                         log.append("Lexical Analysis Complete");
               //     else if (answer == JOptionPane.NO_OPTION)      // User clicked NO.
     //          log.append("Analyze command decided against by user." + newline);
          //          else if (answer == JOptionPane.CANCEL_OPTION)      // User clicked CANCEL.
     //          log.append("Analyze command cancelled by user." + newline);
     FileWrite(LexToken,Lexstring);
     FileWrite(SymTable,SymbolTableString);
     else if (e.getSource() == ViewLexButton)
          log.setText("");
          Filedata=StoreAsString("C:\\LexToken.txt");
          log.append(Filedata);
          log.append("LexToken.txt has been stored at C:\\LexToken.txt");
else if (e.getSource() == ViewSymbolButton)
          log.setText("");
          Filedata=StoreAsString("C:\\SymbolT.txt");
          log.append(Filedata);
          log.append("SymbolT.txt has been stored at C:\\SymbolT.txt");
else if (e.getSource() == ExitButton)
System.exit (0);
catch(FileNotFoundException ex)
               System.err.println("File not found! "+ex);
     catch(IOException ex)
               System.err.println("Exception with file! "+ex);
     catch(Exception ex)
               System.err.println("Exception with file! "+ex);
/** Returns an ImageIcon, or null if the path was invalid. */
protected static ImageIcon createImageIcon(String path)
java.net.URL imgURL = LA.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
System.err.println("Couldn't find file: " + path);
return null;
private static void createAndShowGUI()
//Create and set up the window.
JFrame frame = new JFrame("LA");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
JComponent newContentPane = new LA();
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args)throws IOException
// javax.swing.SwingUtilities.invokeLater(new Runnable()
// public void run()
createAndShowGUI();

I started to look at that code and saw that massive if statement and decided this was far too messy for me to waste my time on. That being said, I still have some recommendations.
First, I have a question: How are you debugging this? What are you doing to try to identify where your hang-up is occurring? Have you tried anything yourself yet, or is this your first attempt?
Second, my recommendation would be to add a few System.out.println() statements in that mess of for/while loops that you have to see how far into them you're getting and when/if you're ever exiting them. Once you don't get to one of those print statements, then you will know where you're buggered.
So why don't you take a little time and try to narrow your code down to a block or two to see where you're problems are coming from. Then you can come back and give us a place to look, because - quite frankly - no one here is going to want to sift through that mess of code.
Good luck.

Similar Messages

  • Sound trouble need help urgent please

    Could somebody tell me how i can fix my problem.
    problem: when my curve 8520 is in silence profile en i start typing in a phnoe number i hear nothing,
    but when my phone is in normal profile i hear i beep with every number of the phone number i enter.
    so i want to know how i can stop my bb from making this noise

    My friend it is a fillable form, can i email you the pdf that iam trying to fill out? then would you be able to tell me how to do it please mate?
    I have attached the form, i need to fill in those boxes so that everything is accuratly height + spacing is correct, and to do it fast, thats all im after.
    Date: Sun, 27 Jun 2010 18:31:58 -0600
    From: [email protected]
    To: [email protected]
    Subject: Need Help Urgent Please
    If is a fillable form, just tab to the next field. What we do not understand from you is IF it is a fillable form or not. If it is not, then the 3 options I gave can be used. Placing text is always a problem. You might find it useful to turn on the grid to help in placing your typewriter fields. However, if it is fillable you do not have to create any fields to type in, you just leave the tool as the hand tool and select the predefined fields with the cursor or the tab key and type accordingly. If the field is a checkbox, then you just use the space key to activate it.
    So, are we talking about a fillable form or something that has the appearance of a form, but not fields to fill in. This is what Bernd has been try to find out and you keep suggesting it is fillable as we read what you have said.
    >

  • I need help urgent please :(

    Hi i'm too much worried about my laptop because before 1 hours its working perfectly and while i working on my laptop suddenly laptop is off and now when i presss power on button its on for 4 seconds with a fast fan voice and no display on screen and then again off what i do can any one help me please thansk a lot advanced....
    Regards,
    Osman

    Please diagnose your PC using the detailed instructions in the link below.
    The "HP PC Hardware Diagnositcs" will test all the hardware components of your PC.
    Testing using HP PC Hardware Diagnostics (UEFI)

  • Ar aging report, need help urgent please help!

    Hey All Gurus,
    Im in a thick soup here. I am trying to do something like this -
    if you see the selection screen i have rep and super rep, when a user enters a rep value --- it should use the same value to pull all open items for the super rep as well, since they are essentially the same. please help! this one needs to be done fast. i am pasting the code so that it will be easier ...
    thanks a million!
    *& Report ZFDOFW04_NEW
    REPORT ZFDOFW04_NEW MESSAGE-ID FR
    LINE-SIZE 132
    LINE-COUNT 60.
    *==================================================================
    Program: ZFDOFW03 - Aged Trial Balance Report
    This produces an Accounts Receivable Past Due Aging Report
    in a more simplified/condensed format than the
    SAP supplied aging report program - RFDOPR10.
    This program is a modified copy of RFDOFW00, - a SAP
    Future-Due Report.
    This was a 'rush' job - program probably should be
    rewritten someday not using logical databases as that
    maybe why this runs so slowly!
    Original: Feb 1997.
    MAINTENANCE HISTORY:
    NES071797 Copied from ZFDOFW03. Adding parameter for saeles rep.
    JDEDERER - changed header text so it is differnet from ZFDORW03. 9/23
    *TEXT SYMBOLS :
    001 Open items per
    002 O p e n
    003 D u e o n
    004 cc ba in total
    005 until
    006 Days until
    007 Days over
    008 Days
    009 over
    011 valid until........
    012 Insurance limit.....
    016 F u t u r e
    017 + days
    018 D u e
    020 Last dunn.notice...
    021 Dunning level....
    030 S U M M A R Y S H E E T
    031 =====================
    050 Name Page
    051 Burton Snowboard
    SELECTION TEXTS:
    SUMMEN Output totals only
    TAGE1 Due date I until
    TAGE2 Due date II until
    TAGE3 Due date III until
    TAGE4 Due date IV until
    TABLES: T001, KNA1, KNB1, KNB5, BSID, BSEGA, RFPDO1, KNVP,
    T014, "credit control areas JAM
    KNVK, "cust master - contact partner JAM
    T014T, "Credit control areas names
    BKPF, "TONY ISSUE 4743
    TVKO, "TONY ISSUE 4743
    KNKK. "cust master - credit mgmt JAM
    TYPES: BEGIN OF TOT_TYPE, "DEVK939546
    BUKRS LIKE LFB1-BUKRS, "DEVK939546
    GSBER LIKE BSIK-GSBER, "DEVK939546
    KKBER LIKE BSID-KKBER,
    RAST1 TYPE P, "DEVK939546
    RAST2 TYPE P, "DEVK939546
    RAST3 TYPE P, "DEVK939546
    RAST4 TYPE P, "DEVK939546
    RAST5 TYPE P, "DEVK939546
    RAST6 TYPE P, "DEVK939546
    RAST7 TYPE P, "DEVK939546
    END OF TOT_TYPE, "DEVK939546
    TOT_TAB TYPE TOT_TYPE OCCURS 0. "DEVK939546
    CONSTANTS:
    C_FALSE TYPE I VALUE 0, "JAM
    C_TRUE TYPE I VALUE 1.
    DATA: BEGIN OF GTAB OCCURS 1000,
    SUPER(10) TYPE C, "TONYC
    REP(10) TYPE C, "TONYC
    FILKD(10), "tonyc show buying groups
    LAND1 LIKE KNA1-LAND1,
    GSBER LIKE BSIK-GSBER,
    REGIO LIKE KNA1-REGIO,
    NAME1 LIKE KNA1-NAME1,
    NAME2 LIKE KNA1-NAME2,
    ORT01 LIKE KNA1-ORT01,
    TELF1 LIKE KNVK-TELF1, "telephone number JAM
    CONT_NAME1 LIKE KNVK-NAME1, "contact name JAM
    NAMEV LIKE KNVK-NAMEV, "contact name JAM
    KUNNR LIKE KNA1-KUNNR, "TONYC
    BUKRS LIKE LFB1-BUKRS, "TONYC
    KKBER LIKE BSID-KKBER, "tonyc issue #2500
    ZTERM LIKE KNB1-ZTERM, "tonyc issue #2500
    KLIMK_TXT(22) TYPE C, "credit limit JAM
    WAERS LIKE T014-WAERS, "currency JAM
    SORT_GSB, "TONYC
    RAST1 TYPE P,
    RAST2 TYPE P,
    RAST3 TYPE P,
    RAST4 TYPE P,
    RAST5 TYPE P,
    RAST6 TYPE P,
    RAST7 TYPE P,
    T_IND,
    END OF GTAB.
    DATA HOLD_NAME(40).
    DATA HOLD_BUKRS LIKE T001-BUKRS. "tonyc
    DATA GOOD_SUPER_REP. "tonyc
    DATA: HOLD_REP LIKE KNA1-KUNNR, "tonyc
    SUPER_NAME LIKE KNA1-NAME1, "tonyc
    REP_NAME LIKE KNA1-NAME1. "tonyc
    DATA NAME_LENGTH(2) TYPE C. "tonyc
    DATA BACKSLASH(3) VALUE ' / '. "tonyc
    DATA REPS_INFO(70) TYPE C. "tonyc
    DATA REPORT_TYPE(12) TYPE C.
    DATA: C_CREDIT_ABTNR LIKE KNVK-ABTNR. "dept 003 = credit
    DATA Z_HOLD_LIMIT(22) TYPE N. "tonyc issue#2216
    DATA Z_DESCRIPTION(18). "tonyc issue#2216
    DATA WRITE_TOTAL.
    DATA HOLD_KLIMK LIKE KNKK-KLIMK.
    DATA HOLD_KLIMK2(22) TYPE C.
    DATA HOLD-CTLPC LIKE KNKK-CTLPC.
    DATA HOLD-CTLPC-TEXT LIKE T691T-RTEXT.
    DATA HOLD_ZTERM LIKE KNVV-ZTERM.
    DATA TOTAL_RAST7 TYPE P.
    DATA TOTAL_RAST2 TYPE P.
    DATA TOTAL_RAST3 TYPE P.
    DATA TOTAL_RAST4 TYPE P.
    DATA TOTAL_RAST5 TYPE P.
    DATA TOTAL_RAST6 TYPE P.
    DATA TOTAL_RAST1 TYPE P.
    DATA HOLD_BUKRS2 LIKE T001-BUKRS.
    DATA HOLD_KKBER LIKE BSID-KKBER.
    DATA HOLD_KKBER_DESC LIKE T014T-KKBTX.
    DATA HOLD_KKBER_DESC2 LIKE T014T-KKBTX.
    DATA HOLD_KUNNR2 LIKE KNA1-KUNNR.
    DATA L_FIRST_DAY_OF_FISCAL LIKE SY-DATUM. "tonyc issue #3047
    DATA: STAB TYPE TOT_TAB WITH HEADER LINE, "DEVK939546
    RTOT TYPE TOT_TAB WITH HEADER LINE, "DEVK939546
    STOT TYPE TOT_TAB WITH HEADER LINE, "DEVK939546
    OP,
    MAXMANDT LIKE DD_STIDA,
    MAXMANST TYPE P,
    SUMKLIMB TYPE P,
    SUMVLIBB TYPE P,
    VERZUG TYPE P,
    OBAD TYPE P,
    BLOCK_CNT TYPE P,
    INTENS,
    ONEBYTE(1) TYPE C,
    TAGE1A LIKE RFPDO1-ALLGFAEL,
    TAGE2A LIKE RFPDO1-ALLGFAEL,
    TAGE3A LIKE RFPDO1-ALLGFAEL,
    HOLD_KUNNR LIKE KNA1-KUNNR, "tonyc
    HOLD_SUPER LIKE KNA1-KUNNR, "tonyc
    HOLD_REP2 LIKE KNA1-KUNNR, "tonyc
    SUPER_REP LIKE KNA1-KUNNR, "tonyc
    TEMP_TELF1 LIKE KNA1-TELF1, "JAM
    IT_T014 LIKE T014 OCCURS 0 WITH HEADER LINE, "JAM
    G_KLIMK_TXT LIKE GTAB-KLIMK_TXT, "JAM
    G_WAERS LIKE GTAB-WAERS, "JAM
    G_CONT_NAME(50) TYPE C. "JA
    DATA FILL_REP_INFO.
    BC SUNILP 05/14/2007
    DATA: BEGIN OF ITAB_VBRP OCCURS 0.
    INCLUDE STRUCTURE VBRP.
    DATA: END OF ITAB_VBRP.
    DATA: T_PERC TYPE F,
    SUM_NETWR LIKE VBRP-NETWR.
    *DATA: GTAB_LINES LIKE GTAB OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF GTAB_LINES OCCURS 0.
    INCLUDE STRUCTURE GTAB.
    DATA: IND(1),
    OBAD TYPE P.
    DATA: END OF GTAB_LINES.
    DATA: BEGIN OF ITAB_VBRP1 OCCURS 0,
    VBELN LIKE VBRP-VBELN,
    NETWR LIKE VBRP-NETWR,
    ZZMREP LIKE VBRP-ZZMREP, "Super Rep
    ZZLREP LIKE VBRP-ZZLREP, "Rep
    PERC TYPE F,
    END OF ITAB_VBRP1.
    EC SUNILP 05/14/2007
    BEGIN_OF_BLOCK 2.
    PARAMETERS: REGIO LIKE KNA1-REGIO.
    PARAMETERS: CONSOL AS CHECKBOX. "TONYC
    PARAMETERS: P_KKBER AS CHECKBOX, "TONYC
    P_CONV AS CHECKBOX. "tonyc issue #3047
    PARAMETERS: SUMMEN LIKE RFPDO1-ALLGSUMM,
    TAGE1 LIKE RFPDO1-ALLGFAEL DEFAULT '30',
    TAGE2 LIKE RFPDO1-ALLGFAEL DEFAULT '60',
    TAGE3 LIKE RFPDO1-ALLGFAEL DEFAULT '90',
    TAGE4 LIKE RFPDO1-ALLGFAEL DEFAULT '120'.
    END_OF_BLOCK 2.
    BEGIN_OF_BLOCK 3.
    SELECT-OPTIONS: P_SUPREP FOR KNVP-KUNNR, "Super REP "DEVK939546
    P_REP FOR KNVP-KUNNR, "SALES REP "DEVK939546
    P_VKORG FOR TVKO-VKORG, "TONYC ISSUE 4743
    P_LOTKZ FOR BKPF-LOTKZ. "TONYC ISSUE 4743
    END_OF_BLOCK 3.
    INITIALIZATION. "JAM
    PERFORM LOAD_T014. "JAM
    refresh dd_augdt.
    clear dd_augdt.
    dd_augdt-option = 'EQ'.
    dd_augdt-sign = 'I'.
    dd_augdt-low = ' '.
    append dd_augdt.
    AT SELECTION-SCREEN.
    IF CONSOL = 'X'.
    IF NOT P_SUPREP[] IS INITIAL. "DEVK939546
    MESSAGE E999 WITH 'Consolidated report not allowed w/ Super Rep'.
    ENDIF.
    ENDIF.
    CHECK IF THE REP INFO IS ADDED OR NOT - VS
    IF NOT P_SUPREP IS INITIAL OR"TONY ISSUE 4743
    NOT P_REP IS INITIAL."TONY ISSUE 4743
    FILL_REP_INFO = 'X'."TONY ISSUE 4743
    ENDIF."TONY ISSUE 4743
    START-OF-SELECTION.
    get_frame_title 2.
    add function module to track usage JD 10/13/98 *****
    CALL FUNCTION 'Z_RUN_LOG'
    EXCEPTIONS
    OTHERS = 1.
    *IF NOT P_SUPREP IS INITIAL AND NOT P_REP IS INITIAL.
    P_SUPREP = ' '.
    *ENDIF.
    GET KNA1 FIELDS LAND1 REGIO KUNNR NAME1 NAME2 ORT01 TELF1. "JAM
    new-page.
    skip.
    TEMP_TELF1 = KNA1-TELF1.
    MAXMANDT = '19000101'.
    MAXMANST = 0.
    SUMVLIBB = 0.
    PERFORM GET_CUST_CONTACT. "JAM
    Check sales rep- NES071797
    Get any valid record and exit.
    IF NOT p_suprep[] IS INITIAL. "DEVK939546 "TONY ISSUE 4743 start
    good_super_rep = ' '.
    SELECT kunn2 INTO super_rep FROM knvp UP TO 1 ROWS
    WHERE
    kunnr = kna1-kunnr AND
    parvw = 'ZS' AND
    kunn2 IN p_suprep.
    EXIT.
    ENDSELECT.
    IF sy-subrc = 0.
    good_super_rep = 'X'.
    gtab-super = super_rep.
    super_rep = ' '.
    ENDIF.
    CHECK good_super_rep = 'X'.
    SELECT kunn2 INTO gtab-rep FROM knvp UP TO 1 ROWS
    WHERE
    kunnr = kna1-kunnr AND
    parvw = 'ZR' AND
    kunn2 IN p_rep.
    EXIT.
    ENDSELECT.
    CHECK sy-subrc = 0.
    ELSEIF NOT p_rep[] IS INITIAL. "DEVK939546
    SELECT kunn2 INTO gtab-rep FROM knvp UP TO 1 ROWS
    WHERE
    kunnr = kna1-kunnr AND
    parvw = 'ZR' AND
    kunn2 IN p_rep.
    EXIT.
    ENDSELECT.
    CHECK sy-subrc = 0.
    ENDIF. "TONY ISSUE 4743 end
    GET KNB1 FIELDS BUKRS VLIBB ZTERM. "tonyc #2500
    GTAB-BUKRS = KNB1-BUKRS.
    GTAB-ZTERM = KNB1-ZTERM.
    SUMVLIBB = SUMVLIBB + KNB1-VLIBB.
    GET KNB5.
    IF KNB5-MADAT > MAXMANDT.
    MAXMANDT = KNB5-MADAT.
    ENDIF.
    IF KNB5-MAHNS > MAXMANST.
    MAXMANST = KNB5-MAHNS.
    ENDIF.
    SUMKLIMB = SUMKLIMB + KLIMB.
    GET BSID.
    CHECK BSID-BSTAT = SPACE.
    field was intended for Business Area, changed to use Currency
    GTAB-GSBER = BSID-WAERS.
    IF P_KKBER = 'X'. "TONYC ISSUE #2500
    IF BSID-KKBER = ' '.
    GTAB-KKBER = BSID-BUKRS.
    ELSE.
    GTAB-KKBER = BSID-KKBER. "TONYC ISSUE #2500
    ENDIF.
    ENDIF. "TONYC ISSUE #2500
    SELECT SINGLE * FROM BKPF "TONY ISSUE 4743
    WHERE BUKRS = BSID-BUKRS "TONY ISSUE 4743
    AND BELNR = BSID-BELNR "TONY ISSUE 4743
    AND GJAHR = BSID-GJAHR. "TONY ISSUE 4743
    BC SUNILP 05/14/2007
    IF BKPF-XREF2_HD IS NOT INITIAL.
    CHECK BKPF-XREF2_HD IN P_SUPREP. "TONY ISSUE 4743
    ELSE.
    IF P_REP[] IS INITIAL.
    REFRESH: ITAB_VBRP, ITAB_VBRP1.
    IF NOT BKPF-XBLNR IS INITIAL.
    SELECT * FROM VBRP INTO ITAB_VBRP WHERE VBELN = BKPF-XBLNR.
    APPEND ITAB_VBRP. CLEAR ITAB_VBRP.
    ENDSELECT.
    CHECK ITAB_VBRP[] IS NOT INITIAL.
    CLEAR: SUM_NETWR.
    LOOP AT ITAB_VBRP.
    CHECK ITAB_VBRP-ZZMREP IN P_SUPREP.
    CHECK ITAB_VBRP-ZZLREP IN P_REP.
    MOVE-CORRESPONDING ITAB_VBRP TO ITAB_VBRP1.
    COLLECT: ITAB_VBRP1.
    SUM_NETWR = SUM_NETWR + ITAB_VBRP-NETWR.
    CLEAR ITAB_VBRP.
    ENDLOOP.
    CHECK ITAB_VBRP1[] IS NOT INITIAL.
    LOOP AT ITAB_VBRP1.
    CLEAR: T_PERC.
    T_PERC = ( ITAB_VBRP1-NETWR / SUM_NETWR ).
    ITAB_VBRP1-PERC = T_PERC.
    MODIFY ITAB_VBRP1 INDEX SY-TABIX TRANSPORTING PERC.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDIF.
    EC SUNILP 05/14/2007
    IF FILL_REP_INFO = 'X'.
    GTAB-SUPER = BKPF-XREF2_HD. "TONY ISSUE 4743 "MOVE THE CONTENTS OF XREF2_HD TO GTAB INTERNAL TABLE - VS
    ENDIF.
    BC SUNILP 05/14/2007
    IF BKPF-XREF1_HD IS NOT INITIAL.
    CHECK BKPF-XREF1_HD IN P_REP. "TONY ISSUE 4743 " ELSE MOVE THE CONTENTS OF - VS
    ELSE.
    REFRESH: ITAB_VBRP, ITAB_VBRP1.
    IF NOT BKPF-XBLNR IS INITIAL.
    SELECT * FROM VBRP INTO ITAB_VBRP WHERE VBELN = BKPF-XBLNR.
    APPEND ITAB_VBRP. CLEAR ITAB_VBRP.
    ENDSELECT.
    CHECK ITAB_VBRP[] IS NOT INITIAL.
    CLEAR: SUM_NETWR.
    LOOP AT ITAB_VBRP.
    CHECK ITAB_VBRP-ZZMREP IN P_SUPREP.
    CHECK ITAB_VBRP-ZZLREP IN P_REP.
    MOVE-CORRESPONDING ITAB_VBRP TO ITAB_VBRP1.
    COLLECT: ITAB_VBRP1.
    SUM_NETWR = SUM_NETWR + ITAB_VBRP-NETWR.
    CLEAR ITAB_VBRP.
    ENDLOOP.
    CHECK ITAB_VBRP1[] IS NOT INITIAL.
    LOOP AT ITAB_VBRP1.
    CLEAR: T_PERC.
    T_PERC = ( ITAB_VBRP1-NETWR / SUM_NETWR ).
    ITAB_VBRP1-PERC = T_PERC.
    MODIFY ITAB_VBRP1 INDEX SY-TABIX TRANSPORTING PERC.
    ENDLOOP.
    ENDIF.
    ENDIF.
    EC SUNILP 05/14/2007
    IF FILL_REP_INFO = 'X'.
    GTAB-REP = BKPF-XREF1_HD. "TONY ISSUE 4743
    ENDIF.
    CHECK BKPF-LOTKZ IN P_LOTKZ. "TONY ISSUE 4743
    CHECK BKPF-BRNCH IN P_VKORG. "TONY ISSUE 4743
    SELECT SINGLE FILKD INTO GTAB-FILKD FROM BSEG
    WHERE BUKRS = BSID-BUKRS
    AND BELNR = BSID-BELNR
    AND GJAHR = BSID-GJAHR
    AND BUZEI = BSID-BUZEI.
    gtab-gsber = bsid-gsber.
    get rep info for each bsid record
    IF NOT P_SUPREP IS INITIAL. "tonyc
    SELECT KUNNR FROM VBPA INTO HOLD_REP UP TO 1 ROWS "tonyc
    WHERE VBELN = BSID-VBELN "tonyc
    AND PARVW = 'ZR'. "tonyc
    ENDSELECT. "tonyc
    IF NOT P_REP IS INITIAL. "tonyc
    CHECK HOLD_REP = P_REP. "tonyc
    ENDIF. "tonyc
    GTAB-REP = HOLD_REP. "tonyc
    HOLD_REP = ' '. "tonyc
    ENDIF. "tonyc
    PERFORM GET_KNKK_INFO. "JAM
    GTAB-KLIMK_TXT = G_KLIMK_TXT.
    GTAB-WAERS = G_WAERS.
    GTAB-LAND1 = KNA1-LAND1.
    GTAB-REGIO = KNA1-REGIO.
    GTAB-KUNNR = KNA1-KUNNR.
    GTAB-NAME1 = KNA1-NAME1.
    GTAB-NAME2 = KNA1-NAME2.
    GTAB-ORT01 = KNA1-ORT01.
    *if there is no phone number for the contact, pull the phone
    *number from the sold-to
    IF KNVK-TELF1 = ' '.
    GTAB-TELF1 = TEMP_TELF1.
    ELSE.
    GTAB-TELF1 = KNVK-TELF1. "JAM
    ENDIF.
    GTAB-CONT_NAME1 = KNVK-NAME1.
    GTAB-NAMEV = KNVK-NAMEV.
    verzug = bsega-netdt - dd_stida.
    VERZUG = DD_STIDA - BSEGA-NETDT. "days past due calculation
    OP = 'X'.
    GTAB-RAST2 = GTAB-RAST3 = GTAB-RAST4 = 0.
    GTAB-RAST5 = GTAB-RAST6 = OBAD = GTAB-RAST7 = 0.
    IF VERZUG LE 0. "future due
    GTAB-RAST1 = BSEGA-WRSHB.
    ELSE.
    IF VERZUG LE TAGE1. "past due 1 to tage1 days
    GTAB-RAST1 = BSEGA-WRSHB.
    GTAB-RAST2 = BSEGA-WRSHB.
    OBAD = BSEGA-WRSHB.
    ELSE.
    IF VERZUG LE TAGE2. "past due tage1 to tage2 days
    GTAB-RAST1 = BSEGA-WRSHB.
    GTAB-RAST3 = BSEGA-WRSHB.
    OBAD = BSEGA-WRSHB.
    ELSE.
    IF VERZUG LE TAGE3. "past due tage2 to tage3 days
    GTAB-RAST1 = BSEGA-WRSHB.
    GTAB-RAST4 = BSEGA-WRSHB.
    OBAD = BSEGA-WRSHB.
    ELSE.
    IF VERZUG LE TAGE4. "past due tage3 to tage4 days
    GTAB-RAST1 = BSEGA-WRSHB.
    GTAB-RAST5 = BSEGA-WRSHB.
    OBAD = BSEGA-WRSHB.
    ELSE.
    IF VERZUG GT TAGE4. "past due > tage4 days
    GTAB-RAST1 = BSEGA-WRSHB.
    GTAB-RAST6 = BSEGA-WRSHB.
    OBAD = BSEGA-WRSHB.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    GTAB-RAST7 = GTAB-RAST1 - OBAD.
    stab = gtab.
    MOVE-CORRESPONDING GTAB TO STAB.
    BC SUNILP 05/15/2007
    IF ITAB_VBRP1[] IS NOT INITIAL.
    GTAB-T_IND = 'X'.
    LOOP AT ITAB_VBRP1.
    MOVE-CORRESPONDING GTAB TO GTAB_LINES.
    GTAB_LINES-SORT_GSB = '1'.
    GTAB_LINES-SUPER = ITAB_VBRP1-ZZMREP.
    GTAB_LINES-REP = ITAB_VBRP1-ZZLREP.
    GTAB_LINES-RAST1 = GTAB_LINES-RAST1 * ITAB_VBRP1-PERC.
    GTAB_LINES-RAST2 = GTAB_LINES-RAST2 * ITAB_VBRP1-PERC.
    GTAB_LINES-RAST3 = GTAB_LINES-RAST3 * ITAB_VBRP1-PERC.
    GTAB_LINES-RAST4 = GTAB_LINES-RAST4 * ITAB_VBRP1-PERC.
    GTAB_LINES-RAST5 = GTAB_LINES-RAST5 * ITAB_VBRP1-PERC.
    GTAB_LINES-RAST6 = GTAB_LINES-RAST6 * ITAB_VBRP1-PERC.
    GTAB_LINES-RAST7 = GTAB_LINES-RAST7 * ITAB_VBRP1-PERC.
    GTAB_LINES-OBAD = GTAB_LINES-OBAD * ITAB_VBRP1-PERC.
    COLLECT: GTAB_LINES.
    ENDLOOP.
    ELSE.
    MOVE-CORRESPONDING GTAB TO GTAB_LINES.
    GTAB_LINES-T_IND = 'X'.
    GTAB_LINES-SORT_GSB = '1'.
    IF GTAB_LINES-SUPER IN P_SUPREP OR GTAB_LINES-REP IN P_REP.
    COLLECT: GTAB_LINES.
    ENDIF.
    ENDIF.
    EC SUNILP 05/15/2007
    gtab-sort_gsb = stab-sort_gsb = '0'.
    collect: gtab, stab.
    gtab-gsber = stab-gsber = '****'.
    GTAB-SORT_GSB = '1'.
    IF REGIO = SPACE OR REGIO = GTAB-REGIO.
    IF GTAB_LINES-SUPER IN P_SUPREP OR GTAB_LINES-REP IN P_REP.
    COLLECT: GTAB, STAB.
    ENDIF.
    ENDIF.
    END-OF-SELECTION.
    TAGE1A = TAGE1 + 1.
    TAGE2A = TAGE2 + 1.
    TAGE3A = TAGE3 + 1.
    IF SUMMEN = ' '.
    sort gtab by bukrs land1 regio kunnr gsber sort_gsb.
    sort gtab by bukrs land1 regio name1 kunnr gsber sort_gsb. "JAM
    IF CONSOL = 'X'.
    SORT GTAB BY LAND1 REGIO NAME1 KUNNR BUKRS KKBER GSBER SORT_GSB.
    "TONYC
    REPORT_TYPE = 'consolidated'.
    ELSEIF NOT P_SUPREP[] IS INITIAL. "DEVK939546
    SORT GTAB
    BY SUPER REP NAME1 BUKRS KKBER LAND1 REGIO NAME1 GSBER SORT_GSB.
    BC SUNILP 05/15/2007
    SORT GTAB_LINES
    BY SUPER REP NAME1 BUKRS KKBER LAND1 REGIO NAME1 GSBER SORT_GSB.
    EC SUNILP 05/15/2007
    REPORT_TYPE = 'super rep'.
    CLEAR STAB. "tonyc 03/06/2004
    REFRESH STAB. "tonyc 03/06/2004
    ELSEIF NOT P_REP[] IS INITIAL. "DEVK939546
    SORT GTAB "DEVK939546
    BY REP NAME1 BUKRS KKBER LAND1 REGIO NAME1 GSBER SORT_GSB.
    "DEVK939546
    BC SUNILP 05/15/2007
    SORT GTAB_LINES
    BY REP NAME1 BUKRS KKBER LAND1 REGIO NAME1 GSBER SORT_GSB.
    EC SUNILP 05/15/2007
    REPORT_TYPE = 'rep'. "DEVK939546
    CLEAR STAB. "tonyc 03/06/2004
    REFRESH STAB. "tonyc 03/06/2004
    ELSE.
    SORT GTAB BY BUKRS KKBER LAND1 REGIO NAME1 KUNNR GSBER SORT_GSB.
    BC SUNILP 05/15/2007
    SORT GTAB_LINES BY BUKRS KKBER LAND1 REGIO NAME1 KUNNR GSBER SORT_GSB.
    EC SUNILP 05/15/2007
    REPORT_TYPE = 'regular'.
    ENDIF.
    BC SUNILP 05/15/2007
    DELETE ADJACENT DUPLICATES FROM GTAB COMPARING BUKRS NAME1.
    LOOP AT GTAB_LINES.
    IF P_REP[] IS INITIAL.
    IF GTAB_LINES-SUPER NOT IN P_SUPREP.
    DELETE GTAB_LINES.
    ENDIF.
    ELSE.
    IF GTAB_LINES-SUPER NOT IN P_SUPREP OR GTAB_LINES-REP NOT IN P_REP.
    DELETE GTAB_LINES.
    ENDIF.
    ENDIF.
    ENDLOOP.
    LOOP AT GTAB.
    READ TABLE GTAB_LINES WITH KEY BUKRS = GTAB-BUKRS
    NAME1 = GTAB-NAME1.
    IF SY-SUBRC NE '0'.
    DELETE GTAB.
    ENDIF.
    ENDLOOP.
    EC SUNILP 05/15/2007
    LOOP AT GTAB.
    MOVE GTAB-BUKRS TO T001-BUKRS. READ TABLE T001.
    RESERVE 5 LINES.
    CASE REPORT_TYPE.
    WHEN 'regular'.
    IF HOLD_BUKRS <> GTAB-BUKRS.
    IF SY-TABIX > 1. "TONYC
    NEW-PAGE. SKIP. "TONYC
    ENDIF. "TONYC
    ENDIF.
    PERFORM WRITE_CUST_INFO. "TONYC
    PERFORM WRITE_DETAIL.
    hold_bukrs = gtab-bukrs. "tonyc
    WHEN 'consolidated'.
    IF HOLD_KUNNR <> GTAB-KUNNR. "TONYC
    PERFORM WRITE_CUST_INFO. "TONYC
    ENDIF. "TONYC
    HOLD_KUNNR = GTAB-KUNNR. "TONYC
    PERFORM WRITE_DETAIL.
    WHEN 'super rep'.
    IF GTAB-T_IND NE 'X'.
    BC SUNILP 05/22/2007
    READ TABLE GTAB_LINES WITH KEY BUKRS = GTAB-BUKRS
    NAME1 = GTAB-NAME1.
    EC SUNILP 05/22/2007
    IF ( HOLD_SUPER <> GTAB_LINES-SUPER ) OR
    ( HOLD_REP2 <> GTAB_LINES-REP ).
    NEW-PAGE.
    PERFORM GET_AND_WRITE_SUPERINFO.
    ENDIF.
    HOLD_REP2 = GTAB_LINES-REP.
    HOLD_SUPER = GTAB_LINES-SUPER.
    IF HOLD_KUNNR <> GTAB-KUNNR. "TONYC
    WRITE :/. "TONYC
    ULINE. "TONYC
    PERFORM WRITE_CUST_INFO. "TONYC
    ENDIF. "TONYC
    HOLD_KUNNR = GTAB-KUNNR. "TONYC
    PERFORM WRITE_DETAIL. "TONYC
    AT END OF REP. "DEVK939546
    SKIP. "DEVK939546
    RESERVE 7 LINES. "DEVK939546
    FORMAT COLOR COL_TOTAL INTENSIFIED. "DEVK939546
    WRITE: / 'Summary for Rep:', "DEVK939546
    GTAB-REP, '/', REP_NAME, 132 ONEBYTE."DEVK939546
    PERFORM WRITE_TOTS TABLES RTOT. "DEVK939546
    REFRESH RTOT. "DEVK939546
    ENDAT. "DEVK939546
    AT END OF SUPER. "DEVK939546
    CLEAR STAB. "tonyc 03/06/2004
    REFRESH STAB. "tonyc 03/06/2004
    NEW-PAGE. SKIP. "DEVK939546
    FORMAT COLOR COL_TOTAL INTENSIFIED. "DEVK939546
    WRITE: / 'Summary for Super Rep:', "DEVK939546
    GTAB-SUPER, '/', SUPER_NAME, 132 ONEBYTE."DEVK939546
    PERFORM WRITE_TOTS TABLES STOT. "DEVK939546
    REFRESH STOT. "DEVK939546
    ENDAT. "DEVK939546
    ELSE.
    LOOP AT GTAB_LINES WHERE BUKRS = GTAB-BUKRS
    AND NAME1 = GTAB-NAME1.
    IF ( HOLD_SUPER <> GTAB_LINES-SUPER ) OR
    ( HOLD_REP2 <> GTAB_LINES-REP ).
    NEW-PAGE.
    PERFORM GET_AND_WRITE_SUPERINFO.
    ENDIF.
    HOLD_REP2 = GTAB_LINES-REP.
    HOLD_SUPER = GTAB_LINES-SUPER.
    IF HOLD_KUNNR <> GTAB_LINES-KUNNR.
    WRITE :/.
    ULINE.
    PERFORM WRITE_CUST_INFO.
    ENDIF.
    HOLD_KUNNR = GTAB_LINES-KUNNR.
    PERFORM WRITE_DETAIL.
    AT END OF REP.
    SKIP.
    RESERVE 7 LINES.
    FORMAT COLOR COL_TOTAL INTENSIFIED.
    WRITE: / 'Summary for Rep:',
    GTAB_LINES-REP, '/', REP_NAME, 132 ONEBYTE.
    PERFORM WRITE_TOTS TABLES RTOT.
    REFRESH RTOT.
    ENDAT.
    AT END OF SUPER.
    CLEAR STAB. "tonyc 03/06/2004
    REFRESH STAB. "tonyc 03/06/2004
    NEW-PAGE. SKIP.
    FORMAT COLOR COL_TOTAL INTENSIFIED.
    WRITE: / 'Summary for Super Rep:',
    GTAB_LINES-SUPER, '/', SUPER_NAME, 132 ONEBYTE.
    PERFORM WRITE_TOTS TABLES STOT.
    REFRESH STOT.
    ENDAT.
    ENDLOOP.
    ENDIF.
    WHEN 'rep'. "DEVK939546
    LOOP AT GTAB_LINES WHERE BUKRS = GTAB-BUKRS
    AND NAME1 = GTAB-NAME1.
    IF HOLD_REP2 <> GTAB_LINES-REP. "DEVK939546
    NEW-PAGE. "DEVK939546
    PERFORM GET_AND_WRITE_REPINFO. "DEVK939546
    ENDIF. "DEVK939546
    HOLD_REP2 = GTAB_LINES-REP. "DEVK939546
    IF HOLD_KUNNR <> GTAB_LINES-KUNNR. "DEVK939546
    WRITE :/. "DEVK939546
    ULINE. "DEVK939546
    PERFORM WRITE_CUST_INFO. "DEVK939546
    ENDIF. "DEVK939546
    HOLD_KUNNR = GTAB_LINES-KUNNR. "DEVK939546
    PERFORM WRITE_DETAIL. "DEVK939546
    AT END OF REP. "DEVK939546
    SKIP. "DEVK939546
    RESERVE 7 LINES. "DEVK939546
    FORMAT COLOR COL_TOTAL INTENSIFIED. "DEVK939546
    WRITE: / 'Summary for Rep:', "DEVK939546
    GTAB_LINES-REP, '/', REP_NAME, 132 ONEBYTE."DEVK939546
    PERFORM WRITE_TOTS TABLES RTOT. "DEVK939546
    REFRESH RTOT. "DEVK939546
    ENDAT. "DEVK939546
    ENDLOOP.
    ENDCASE.
    ENDLOOP.
    ENDIF.
    OP = ' '.
    REFRESH GTAB.
    IF NOT REPORT_TYPE = 'super rep'.
    ULINE.
    ENDIF.
    SKIP 1.
    IF SUMMEN = ' '. "if 'output totals only' bypass new-page
    NEW-PAGE. SKIP.
    ENDIF.
    WRITE: /25 TEXT-030, 132 ONEBYTE, /25 TEXT-031, 132 ONEBYTE.
    PERFORM WRITE_TOTS TABLES STAB. "DEVK939546
    TOP-OF-PAGE.
    INTENS = SPACE.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    WRITE: / SY-VLINE, 1 TEXT-001, DD_STIDA, 75 TEXT-051, 132 SY-VLINE.
    ULINE.
    WRITE: / SY-VLINE, 13 SY-VLINE, 30 SY-VLINE,
    47 SY-VLINE, 58 TEXT-003, 81 SY-VLINE,
    92 TEXT-003, 115 SY-VLINE, 118 TEXT-003, 132 SY-VLINE,
    / SY-VLINE, 02 TEXT-004, 13 SY-VLINE, TEXT-002,
    30 SY-VLINE, 32 TEXT-018, 47 SY-VLINE,
    50 '1', 54 TEXT-040, 57 TAGE1, 64 SY-VLINE, " 65 tage2,
    67 TAGE1A, 72 TEXT-040, 75 TAGE2,
    81 SY-VLINE, 83 TAGE2A, 89 TEXT-040, 91 TAGE3, 98 SY-VLINE,
    101 TAGE3A, 107 TEXT-040, 110 TAGE4, 115 SY-VLINE,
    117 TAGE4, 123 TEXT-017, 132 SY-VLINE.
    ULINE.
    SKIP 1.
    SUMMARY.
    FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    FORM write_tots *
    --> PTAB *
    FORM WRITE_TOTS TABLES PTAB TYPE TOT_TAB. "DEVK939546
    CLEAR INTENS. "DEVK939546
    FORMAT COLOR COL_HEADING INTENSIFIED OFF. "DEVK939546
    IF P_CONV = 'X'. "tonyc issue #3047 begin
    WRITE /4 TEXT-101.
    WRITE: /4 TEXT-102,
    50 TEXT-100.
    ENDIF. "tonyc issue #3047 end
    ULINE. "DEVK939546
    SORT PTAB BY BUKRS GSBER. "DEVK939546
    LOOP AT PTAB. "DEVK939546
    IF SY-TABIX > 1.
    WRITE_TOTAL = 'X'.
    ENDIF.
    MOVE PTAB-BUKRS TO T001-BUKRS. READ TABLE T001. "DEVK939546
    MOVE PTAB-GSBER TO T001-WAERS. "DEVK939546
    IF P_CONV = 'X'. "tonyc issue #3047 begin
    PERFORM CONVERT_VALUES USING STAB-RAST1
    STAB-GSBER.
    PERFORM CONVERT_VALUES USING STAB-RAST2
    STAB-GSBER.
    PERFORM CONVERT_VALUES USING STAB-RAST3
    STAB-GSBER.
    PERFORM CONVERT_VALUES USING STAB-RAST4
    STAB-GSBER.
    PERFORM CONVERT_VALUES USING STAB-RAST5
    STAB-GSBER.
    PERFORM CONVERT_VALUES USING STAB-RAST6
    STAB-GSBER.
    PERFORM CONVERT_VALUES USING STAB-RAST7
    STAB-GSBER.
    ENDIF. "TOnyc issue #3047 end
    MOVE-CORRESPONDING PTAB TO STAB.
    COLLECT STAB.
    IF P_KKBER = 'X'. "TONYC ISSUE #2500
    CLEAR HOLD_KKBER_DESC2.
    SELECT SINGLE KKBTX INTO HOLD_KKBER_DESC2 FROM T014T
    WHERE KKBER = STAB-KKBER AND
    SPRAS = 'E'.
    IF SY-SUBRC <> '0'.
    HOLD_KKBER_DESC2 = 'Undetermined'.
    ENDIF.
    FORMAT COLOR OFF.
    WRITE: / SY-VLINE.
    FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    WRITE: 6 STAB-GSBER, HOLD_KKBER_DESC2, SY-VLINE.
    ULINE.
    FORMAT COLOR OFF.
    WRITE: / SY-VLINE.
    FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    IF P_CONV = 'X'. "tonyc issue #3047 begin
    T001-WAERS = 'USD'.
    ENDIF. "tonyc issue #3047 end
    WRITE: 13 STAB-RAST1 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) STAB-RAST7 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) STAB-RAST2 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) STAB-RAST3 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) STAB-RAST4 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) STAB-RAST5 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) STAB-RAST6 NO-ZERO CURRENCY T001-WAERS, SY-VLINE.
    HOLD_BUKRS2 = STAB-BUKRS. "TONYC ISSUE #2500
    ULINE.
    FORMAT COLOR OFF.
    TOTAL_RAST1 = STAB-RAST1 + TOTAL_RAST1.
    TOTAL_RAST2 = STAB-RAST2 + TOTAL_RAST2.
    TOTAL_RAST3 = STAB-RAST3 + TOTAL_RAST3.
    TOTAL_RAST4 = STAB-RAST4 + TOTAL_RAST4.
    TOTAL_RAST5 = STAB-RAST5 + TOTAL_RAST5.
    TOTAL_RAST6 = STAB-RAST6 + TOTAL_RAST6.
    TOTAL_RAST7 = STAB-RAST7 + TOTAL_RAST7.
    ELSE.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF. "DEVK939546
    IF INTENS = SPACE. "DEVK939546
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF. "DEVK939546
    INTENS = 'X'. "DEVK939546
    ELSE. "DEVK939546
    FORMAT COLOR COL_NORMAL INTENSIFIED ON. "DEVK939546
    INTENS = SPACE. "DEVK939546
    ENDIF. "DEVK939546
    WRITE: / SY-VLINE, PTAB-BUKRS, PTAB-GSBER, SY-VLINE, "DEVK939546
    (14) PTAB-RAST1 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
    (14) PTAB-RAST7 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
    (14) PTAB-RAST2 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
    (14) PTAB-RAST3 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
    (14) PTAB-RAST4 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
    (14) PTAB-RAST5 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
    (14) PTAB-RAST6 NO-ZERO CURRENCY T001-WAERS, SY-VLINE."DEVK939546
    TOTAL_RAST1 = STAB-RAST1 + TOTAL_RAST1.
    TOTAL_RAST2 = STAB-RAST2 + TOTAL_RAST2.
    TOTAL_RAST3 = STAB-RAST3 + TOTAL_RAST3.
    TOTAL_RAST4 = STAB-RAST4 + TOTAL_RAST4.
    TOTAL_RAST5 = STAB-RAST5 + TOTAL_RAST5.
    TOTAL_RAST6 = STAB-RAST6 + TOTAL_RAST6.
    TOTAL_RAST7 = STAB-RAST7 + TOTAL_RAST7.
    ENDIF.
    ENDLOOP. "DEVK939546
    ULINE. "DEVK939546
    IF P_KKBER = 'X'. "TONYC ISSUE #2500
    IF P_CONV = 'X'. "tonyc issue #3047 begin
    FORMAT COLOR OFF.
    FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    WRITE: SY-VLINE,
    6 'TOTAL ', SY-VLINE.
    ULINE.
    FORMAT COLOR OFF.
    WRITE: / SY-VLINE.
    FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    WRITE: 13 TOTAL_RAST1 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST7 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST2 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST3 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST4 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST5 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST6 NO-ZERO CURRENCY T001-WAERS, SY-VLINE.
    ULINE.
    ENDIF. "tonyc issue #3047 end
    ELSE.
    IF P_CONV = 'X'.
    FORMAT COLOR OFF.
    FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    WRITE: SY-VLINE,
    6 'TOTAL ', SY-VLINE.
    ULINE.
    FORMAT COLOR OFF.
    WRITE: / SY-VLINE.
    FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    WRITE: 13 TOTAL_RAST1 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST7 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST2 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST3 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST4 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST5 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
    (14) TOTAL_RAST6 NO-ZERO CURRENCY T001-WAERS, SY-VLINE.
    ULINE.
    ENDIF.
    ENDIF.
    SKIP 1. "DEVK939546
    ENDFORM. "DEVK939546
    *& Form GET_KNKK_INFO
    text
    --> p1 text
    <-- p2 text
    FORM GET_KNKK_INFO.
    CLEAR: G_WAERS,
    G_KLIMK_TXT,
    KNKK-KLIMK.
    get credit control area (KKBER) for comp code (BUKRS)
    SELECT SINGLE KLIMK
    INTO KNKK-KLIMK
    FROM KNKK
    WHERE KUNNR = KNA1-KUNNR AND
    KKBER = T001-KKBER.
    IF SY-SUBRC = 0.
    get currency for cred ctrl area
    CLEAR IT_T014.
    READ TABLE IT_T014 WITH KEY KKBER = T001-KKBER BINARY SEARCH.
    G_WAERS = IT_T014-WAERS.
    WRITE KNKK-KLIMK TO G_KLIMK_TXT CURRENCY G_WAERS.
    ENDIF.
    ENDFORM. " GET_KNKK_INFO
    *& Form SELECT_KNKK
    text
    -->P_KKBER Credit Limit Controlling Area
    <--P_FOUND_KNKK Indicates if record found
    FORM SELECT_KNKK USING P_KKBER
    CHANGING P_FOUND_KNKK.
    CLEAR: G_WAERS,
    G_KLIMK_TXT,
    KNKK-KLIMK.
    SELECT SINGLE KLIMK
    INTO KNKK-KLIMK
    FROM KNKK
    WHERE KUNNR = KNA1-KUNNR AND
    KKBER = P_KKBER.
    IF SY-SUBRC = 0.
    P_FOUND_KNKK = C_TRUE.
    get currency for cred ctrl area
    CLEAR IT_T014.
    READ TABLE IT_T014 WITH KEY KKBER = P_KKBER BINARY SEARCH.
    G_WAERS = IT_T014-WAERS.
    WRITE KNKK-KLIMK TO G_KLIMK_TXT CURRENCY G_WAERS.
    ELSE.
    P_FOUND_KNKK = C_FALSE.
    ENDIF.
    ENDFORM. " SELECT_KNKK
    *& Form GET_CUST_CONTACT & PHONE NUMBER
    FORM GET_CUST_CONTACT.
    CLEAR KNVK.
    C_CREDIT_ABTNR = '0003'. "look for contact in credit dept
    SELECT NAME1
    NAMEV
    TELF1
    INTO (KNVK-NAME1,
    KNVK-NAMEV,
    KNVK-TELF1)
    FROM KNVK
    WHERE KUNNR = KNA1-KUNNR AND
    ABTNR = C_CREDIT_ABTNR.
    ENDSELECT.
    If there wasn't a contact person for the credit dept, then just
    pull up the first contact info we find regardless of dept
    IF SY-SUBRC <> 0.
    CLEAR KNVK.
    SELECT NAME1
    NAMEV
    TELF1
    INTO (KNVK-NAME1,
    KNVK-NAMEV,
    KNVK-TELF1)
    FROM KNVK
    WHERE KUNNR = KNA1-KUNNR.
    IF SY-SUBRC = 0.
    EXIT.
    ENDIF.
    ENDSELECT.
    ELSE.
    EXIT.
    ENDIF. "not contact found in credit dept.
    ENDFORM. " GET_CUST_CONTACT
    *& Form LOAD_T014
    FORM LOAD_T014.
    SELECT *
    INTO TABLE IT_T014
    FROM T014.
    SORT IT_T014.
    ENDFORM. " LOAD_T014
    *& Form WRITE_CUST_INFO "TONYC
    text moved code and created a form. for cleaner code "TONYC
    --> p1 text
    <-- p2 text
    FORM WRITE_CUST_INFO.
    IF NOT REPORT_TYPE = 'super rep'.
    IF SY-TABIX > 1.
    ULINE.
    ENDIF.
    ENDIF.
    CONCATENATE GTAB-NAMEV "JAM
    GTAB-CONT_NAME1
    INTO G_CONT_NAME
    SEPARATED BY SPACE.
    FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
    IF REPORT_TYPE = 'super rep'.
    IF GTAB-T_IND NE 'X'.
    WRITE: / GTAB-KUNNR, GTAB-NAME1, GTAB-ORT01, GTAB-REGIO, GTAB-LAND1,
    "g_cont_name,
    132 ONEBYTE.
    ELSE.
    WRITE: / GTAB_LINES-KUNNR, GTAB_LINES-NAME1, GTAB_LINES-ORT01, GTAB_LINES-REGIO, GTAB_LINES-LAND1,
    "g_cont_name,
    132 ONEBYTE.
    ENDIF.
    WRITE: /21 onebyte, 12 gtab-name2, 45 gtab-ort01,
    gtab-telf1, "gtab-klimk_txt, gtab-waers.
    132 onebyte.
    ELSE.
    WRITE: / GTAB-KUNNR, GTAB-NAME1, GTAB-ORT01, GTAB-REGIO, GTAB-LAND1,
    "g_cont_name, "JAM
    132 ONEBYTE.
    WRITE: /11 onebyte, 12 gtab-name2, 45 gtab-ort01,
    gtab-telf1, "gtab-klimk_txt, gtab-waers, "JAM
    132 onebyte.
    ENDIF.
    ENDFORM. " WRITE_CUST_INFO
    *& Form GET_AND_WRITE_SUPERINFO
    text
    --> p1 text
    <-- p2 text
    FORM GET_AND_WRITE_SUPERINFO.
    ULINE.
    IF GTAB-T_IND NE 'X'.
    SELECT SINGLE NAME1 FROM KNA1 INTO SUPER_NAME "TONYC
    WHERE KUNNR = GTAB-SUPER. "TONYC
    SELECT SINGLE NAME1 FROM KNA1 INTO REP_NAME "TONYC
    WHERE KUNNR = GTAB-REP. "TONYC
    CONCATENATE SUPER_NAME REP_NAME INTO REPS_INFO "TONYC
    SEPARATED BY BACKSLASH. "TONYC
    FORMAT COLOR COL_TOTAL INTENSIFIED. "TONYC
    WRITE:/ GTAB-SUPER, '/', "TONYC
    GTAB-REP, "TONYC
    25 REPS_INFO, 132 ONEBYTE. "TONYC
    ELSE.
    SELECT SINGLE NAME1 FROM KNA1 INTO SUPER_NAME
    WHERE KUNNR = GTAB_LINES-SUPER.
    SELECT SINGLE NAME1 FROM KNA1 INTO REP_NAME
    WHERE KUNNR = GTAB_LINES-REP.
    CONCATENATE SUPER_NAME REP_NAME INTO REPS_INFO
    SEPARATED BY BACKSLASH.
    FORMAT COLOR COL_TOTAL INTENSIFIED.
    WRITE:/ GTAB_LINES-SUPER, '/',
    GTAB_LINES-REP,
    25 REPS_INFO, 132 ONEBYTE.
    ENDIF.
    ENDFORM. " GET_AND_WRITE_SUPERINFO
    *& Form GET_AND_WRITE_REPINFO
    text
    --> p1 text
    <-- p2 text
    FORM GET_AND_WRITE_REPINFO.
    ULINE.
    SELECT SINGLE NAME1 FROM KNA1 INTO REP_NAME
    WHERE KUNNR = GTAB-REP.
    FORMAT COLOR COL_TOTAL INTENSIFIED.
    WRITE:/ GTAB-REP,
    25 REP_NAME, 132 ONEBYTE.
    ENDFORM. " GET_AND_WRITE_REPINFO
    *& Form WRITE_DETAIL
    text
    --> p1 text
    <-- p2 text
    FORM WRITE_DETAIL.
    clear z_description. "TONYC #2216
    move GTAB-KLIMK_TXT to z_hold_limit.
    IF z_hold_limit = 400.
    z_description = 'COD/Check'.
    elseif z_hold_limit = 500.
    z_description = 'COD/Cash'.
    elseif z_hold_limit = 600.
    z_description = 'Need Dealer Agree'.
    elseif z_hold_limit = 700.
    z_description = 'Need PDCs'.
    elseif z_hold_limit = 800.
    z_description = 'Need Fin Statements'.
    elseif z_hold_limit = 900.
    z_description = 'Past Due Balance'.
    elseif z_hold_limit = 1000.
    z_description = 'Miracle?'.
    endif. "TONYC #2216
    MOVE GTAB-GSBER TO T001-WAERS.
    FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
    IF HOLD_KUNNR2 <> GTAB-KUNNR. "TONYC
    IF REPORT_TYPE = 'super rep'.
    WRITE: /3 ONEBYTE, GTAB-BUKRS.
    WRITE: 92 gtab-klimk_txt, gtab-waers, 132 onebyte. "TONYC
    WRITE: 92 gtab-klimk_txt, z_description,132 onebyte."TONYC #2500
    ELSE.
    WRITE: / ONEBYTE, GTAB-BUKRS.
    WRITE: 92 gtab-klimk_txt, z_description,132 onebyte."TONYC #2500
    WRITE: 92 gtab-klimk_txt, gtab-waers, 132 onebyte. "TONYC
    ENDIF.
    ENDIF.
    FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
    IF P_KKBER = 'X'. "TONYC ISSUE# 2500
    CLEAR HOLD_KKBER_DESC.
    SELECT SINGLE KKBTX INTO HOLD_KKBER_DESC FROM T014T
    WHERE KKBER = GTAB-KKBER AND
    SPRAS = 'E'.
    IF SY-SUBRC <> '0'.
    HOLD_KKBER_DESC = 'Undetermined'.
    ENDIF.
    SELECT SINGLE KLIMK CTLPC
    INTO (HOLD_KLIMK, HOLD-CTLPC)
    FROM KNKK
    WHERE KUNNR = GTAB-KUNNR AND
    KKBER = GTAB-KKBER.
    SELECT SINGLE RTEXT INTO HOLD-CTLPC-TEXT FROM T691T
    WHERE SPRAS = 'EN' AND
    CTLPC = HOLD-CTLPC AND
    KKBER = GTAB-KKBER.
    WRITE HOLD_KLIMK TO HOLD_KLIMK2 CURRENCY GTAB-WAERS.
    WRITE: /7 GTAB-KKBER,
    12 HOLD_KKBER_DESC,
    80 HOLD_KLIMK2,
    103 GTAB-GSBER,
    108 HOLD-CTLPC-TEXT.
    ENDIF. "TONYC ISSUE# 2500
    FORMAT COLOR COL_NORMAL INTENSIFIED ON. "TONYC
    MOVE STAB-GSBER TO T001-WAERS.
    CLEAR HOLD_NAME.
    SELECT SINGLE NAME1 FROM KNA1 INTO HOLD_NAME
    WHERE KUNNR = GTAB-FILKD.
    WRITE: /15 GTAB-FILKD,
    30 HOLD_NAME.
    IF GTAB-T_IND NE 'X'.
    WRITE: /15(14) GTAB-RAST1 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB-RAST7 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB-RAST2 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB-RAST3 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB-RAST4 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB-RAST5 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB-RAST6 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    132 ONEBYTE.
    ELSE.
    IF REPORT_TYPE NE 'super rep'.
    LOOP AT GTAB_LINES WHERE KUNNR = GTAB-KUNNR.
    WRITE: / GTAB_LINES-SUPER, ONEBYTE,
    15(14) GTAB_LINES-RAST1 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST7 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST2 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST3 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST4 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST5 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST6 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    132 ONEBYTE.
    ENDLOOP.
    ELSE.
    WRITE: / GTAB_LINES-SUPER, ONEBYTE,
    15(14) GTAB_LINES-RAST1 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST7 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST2 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST3 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST4 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST5 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    (14) GTAB_LINES-RAST6 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
    132 ONEBYTE.
    ENDIF.
    ENDIF.
    HOLD_BUKRS = GTAB-BUKRS. "Tonyc
    HOLD_KUNNR2 = GTAB-KUNNR. "TONYC
    HOLD_KKBER = GTAB-KKBER. "TONYC ISSUE #2500
    IF REPORT_TYPE = 'super rep' OR REPORT_TYPE = 'rep'. "DEVK939546
    IF GTAB-T_IND NE 'X'.
    MOVE-CORRESPONDING GTAB TO RTOT. "DEVK939546
    COLLECT RTOT. "DEVK939546
    ELSE.
    MOVE-CORRESPONDING GTAB_LINES TO RTOT.
    COLLECT RTOT.
    ENDIF.
    IF REPORT_TYPE = 'super rep'. "DEVK939546
    IF GTAB-T_IND NE 'X'.
    MOVE-CORRESPONDING GTAB TO STOT. "DEVK939546
    COLLECT STOT. "DEVK939546
    ELSE.
    MOVE-CORRESPONDING GTAB_LINES TO STOT.
    COLLECT STOT.
    ENDIF.
    ENDIF. "DEVK939546
    ENDIF. "DEVK939546
    ENDFORM. " WRITE_DETAIL
    *& Form convert_values
    text
    -->P_STAB_RAST1 text
    -->P_STAB_GSBER text
    FORM CONVERT_VALUES USING P_STAB_RAST1 "tonyc issue #3047 begin
    P_STAB-GSBER.
    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
    EXPORTING
    CLIENT = SY-MANDT
    DATE = SY-DATUM
    FOREIGN_AMOUNT = P_STAB_RAST1
    FOREIGN_CURRENCY = P_STAB-GSBER
    LOCAL_CURRENCY = 'USD'
    RATE = 0
    TYPE_OF_RATE = 'M'
    READ_TCURR = 'X'
    IMPORTING
    EXCHANGE_RATE =
    FOREIGN_FACTOR =
    LOCAL_AMOUNT = P_STAB_RAST1
    LOCAL_FACTOR =
    EXCHANGE_RATEX =
    FIXED_RATE =
    DERIVED_RATE_TYPE =
    EXCEPTIONS
    NO_RATE_FOUND = 1
    OVERFLOW = 2
    NO_FACTORS_FOUND = 3
    NO_SPREAD_FOUND = 4
    DERIVED_2_TIMES = 5
    OTHERS = 6 .
    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. " convert_values

    solved

  • MacBook Pro dead, need help urgently please!

    My mac has died. It's really urgent to fix because I have a degree project to submit in 2 days! Many thanks in advance for help;
    Yesterday my mac froze up ( nothing would move appart from the cursor ). I hit the off button and my mac takes about 15-20 minutes to load up. When it does load its veeerrrryyyy sluggish and the beach ball whirls. It also popped up with a circle with a line through it, its stopped doing that since turning on and off a few times.. I tried reinstalling lion from command R at restart. This worked but didn't fully erase everything and I still have the same issue. I now can't go to the recovery menu on restart it just goes straight to log in so I am unable to fully erase everything.
    Computer specs:
    MacBook pro mid 2009 running 10.7.3 Lion.
    2.66 dual core
    8 gig ram
    320 hard drive.
    Any help would be most appreciated!!!
    Many thanks!

    James.thatcher wrote:
    I have the disc assistant on an SD connected to USB but my computer will only open it with disc utility. Is there anything I coud do?
    The program you download is meant to be downloaded and run from OS X on a working Lion Mac (not your sick one) to copy the Recovery HD Partiton of their Lion Mac to the USB thumb drive (properly formatted) then you take it to the sick Mac and can hold the option key boot off of it.
    http://osxdaily.com/2011/08/08/lion-recovery-disk-assistant-tool-makes-external- lion-boot-recovery-drives/
    Once you get your computer booted off the Recovery USB, you connect a blank external drive and install Recovery HD and OS X Lion onto that from the Recovery USB using your AppleID and password.
    Once you got that done, then you hold the option key down and boot the computer off the external drive, which the internal drive can be seen when you do Finder > Go menu > Computer and click on your internal boot drive.
    Then you open the Users folder and copy your User to the external drive your booted from.
    Once you have gotten your User folder copied off the machine, you can choose to run the comptuer off the external drive until your ready to have it fixed.
    If you can't handle all this, then call a local Mac/PC computer person to do it for you, as Apple may just replace the drive and tell you tough luck charlie, you should have made a backup.

  • Compiling error need help urgently please

    im trying to compile a java file but i get the following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
    and im typing in the right location of the file, and the package has been set properly, some please please please help me.

    Hiya.
    I seem to get this error message too, but there was more to it. It points out a classB i'm creating an instance of in the main() of classA, that it can't find or doesn't know where to get classB.
    The program easily works in VisualAge or in Forte, but when i tried using the command line compiler from the JDK1.3, it doesn't work right.
    They are all in the same package, and I did use the package statement to also indicate that, and they are public so that's not the problem.
    Seems, i can only compile and run programs where all the custom classes are in the same java file.
    Anybody know of a tutorial that consists of a program that uses 2 or more java files (1 custom class in each file), and then shows you how to use the command line to compile and run them?

  • Files opening in unreadable code need help urgently please

    When I was given my new Toshiba laptop as a gift in 2007 Microsoft Office with Word and Excel etc were already set up so I do not have any discs or keycodes. .Being a senior person, it is also possible that my son who gifted it to me may have installed the above mentioned discs to help set me up, but he does not have any recollection of this, except that he gave me the Toshiba Recovery Disc which I do have.
    My laptop had to go back to Toshiba some time ago for a Manufacture- related issue. They also informed me that some of my files were corrupted. All features remained on my computer as prior to repair, so nothing was lost or had to be re-loaded.
    I have found that since then all my docs are opening in code form and are unreadable. Microsoft Word seems to have disappeared and I have had to install an old Microsoft Works 2001 disc in order to be able to work on new documents. Microsoft Onenote was on the disc but not Word, so the docs will not open with Onenote, so I am stuck.
    Is it possible for me to find out if Toshiba holds the keycode to my original Microsoft Office and would I be able to download it again.? I cannot afford to buy a full new Office system and I have no way of knowing which Microsoft Office ( 2007? )created the documents. I have to know if there is any way I can read these documents and also to establish which of them may be corrupted so that I can delete them. Would a system restore make the documents readable? I am very untechnical minded with regard to computers as you can observe from my wording and would really appreciate any help you can give as I cannot afford to pay someone who keeps my computer for a day or more and then charges me an extortionate amount.
    Thank you so much in advance if you can help me in any way with easy to follow instructions/advice.

    What is the model number of your laptop?
    A Trial version of MS Office may have been pre-installed. If you activated Office (Purchased a license), then you could try calling Microsoft to re-activate it.
    If you reinstall Windows using your Toshiba Recovery Disc, the Office installation should be installed. (Note that the Recovery Disc will delete your data, so back up your files first).
    Alternatively, you could use OpenOffice to read your documents. OpenOffice (free) works with Microsoft Office files.

  • Need Help, URGENT PLEASE!!!

    Hello word!
    I have to deliver a project tomorow, and I<m experiencing
    a serious trouble!
    I've created all parts of my project on separate director
    projects.
    but when I try to integrate the "ALL" in one project, by
    importing exe files of the parts (of project let's say partA and
    partB).
    but whene I import the exe file of partA I get this error "
    Having trouble readind C:/projectX/partA.exe" -1 !!!
    any Idea plzzzzzzzzzzzzz !

    zicco_n wrote:
    > I used a "open (QUOTE & the moviePath &
    "clic_ar.exe")" to open each relative
    > part (partA, B, ....) and a "halt" to close the main
    window. its not the
    > better way to do that but it works !!!
    Hi Zicco,
    As Sean mentioned, just create one EXE (stub projector) that
    links to your
    Director movies. You can convert DIRs into DXR through the
    Xtras menu. DXR is a
    protected format so will prevent people having access to the
    source - you cannot
    open DXRs in Director.
    I have a tutorial on creating a stub projector at:
    http://www.fbe.unsw.edu.au/learning/director/publishing/projector.asp
    To link one movie to another, you can use:
    go to movie "nameofmovie"
    where nameofmovie is the file name minus the extension.
    Or
    you can use the 'Jump to Movie' in the Library Palette in the
    Controls category.
    regards
    Dean
    Director Lecturer / Consultant / Director Enthusiast
    http://www.fbe.unsw.edu.au/learning/director
    http://www.multimediacreative.com.au
    email: [email protected]

  • Need help urgent,my iphone is stuck at connect to itunes screen.when i restore with itunes it shows error -1. please help me

    need help urgent, my iphone is stuck at connect to itunes screen, when i restore it using itunes, it shows error -1...may someone help me plz....

    See:
    iOS: Unable to Update or Restore
    http://support.apple.com/kb/ht1808

  • Need help urgently with OS X and Windows 7

    I need help urgently.
    I installed Windows 7 on my macbook pro with OS X Lion. After installing Windows7, I accidently converted the basic volumes to dynamic volumes and now i can't even boot to OS X.
    Please help me how to recover my OS X Lion. If I have to delete Windows and bootcamp partitions, it is OK.
    I just want to get back my OS X bootable.
    Thanks

    thihaoo wrote:
    Sorry
    I can't even see the OS X partition when I hold down the "Option" key.
    I could see OS X and Windows partitions if I hold down Option key before changing the partitions to Dynamic partitions from Basic in Windows 7.
    Now can't see OS X partiton and only see Winodws partition but when I tried to boot onto Windows7 , I got BSOD and macbook pro restart.
    Please help
    The usual reason for the OSX partition to be invisible under these circumstances is that it has been trashed by Windows.
    Do you have a backup?

  • Woogly - I need U Urgent - please reply if U R there !

    Woogly - I need U Urgent - please reply if U R there !

    Thanks.
    Its already posted:
    http://forum.java.sun.com/thread.jsp?forum=54&thread=480050
    Woogly had gave me last time very useful help getting a container over a container.
    Now I'm dealing with converting the same stuff to Applet, but of course..
    I'll be glad and thankful for help also from others.
    Thanks agian.

  • BB Curve 8900 need help urgently!!!!!

    hey my blackberry 8900 rebooted but now it says "Reload Software:552" and no matter what buttons I press it just won't work, please tel me what to do I really need help urgently!!
    Solved!
    Go to Solution.

    Before you do anything else:  Do a simple reboot on the BlackBerry in this manner: With the BlackBerry device POWERED ON, remove the battery for a minute, and then reinsert the battery to reboot. A reboot in this manner is prescribed for most glitches and operating system errors, and you will lose no data on the device doing this.
    Please let us know if that reboots the device properly or not.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Username and password- Need help urgently!

    Hi
    1) First of all, i have received an email stating that my account under Removed personal information to comply withCommunity GuidelinesandTerms and Conditions of Use.
    is being banned as there is multiple obsence post. I need to clarify that i have never used my account to post in BBM forum before. Even if i did, is when i need help urgently for my BBM application. Currently i am holding 4 bbms now. Have never came across this issue. Pls check and advise
    2) I urgently need to setup my email accounts. But this time round, when i logged in, they required for my email id and password. And yes my email id is Removed personal information to comply withCommunity GuidelinesandTerms and Conditions of Use. all the while for the past 4 years. I am unable to log in. I tried all kinds of password but unable to log into my mobile settings
    Verfiy Blackberry ID
    This application requires u to verify ur blackberry id to continue.
    blackberry ID username:
    Removed personal information to comply withCommunity GuidelinesandTerms and Conditions of Use.
    password:
    I went to the forget password option, unfortunately as i have never retrieved my password before, i am unable to remember the security question as i did not use it for the past 4 years.
    Pls advise.
    Urgent and thanks

    Hi,
    I have been trying this technique for the past 4 days. It doesnt work no matter how i change the password at the link that u gave me. Even though it's being reset accordingly, i am still unable to log in the password at my mobile. i am 100% sure that i have entered the correct password at my mobile. ( verify blackberry id) . I want to setup new email accounts under "setup" . Upon me clicking " email accounts", it prompt for the one key password. I have never faced this issue before. I am very very sure that my password is correct. Pls advise as i need to add email accounts. Other programs are working fine without any password required being prompt. ie. blackberry world
    This is very very urgent to be resolved. Pls help.

  • My screen is completely white, i've tried holding lock and home buttons as seen on you tube something called 'white screen of death' its goes black (think it switches off) then back to the white screen need help fast please!

    my screen is completely white, i've tried holding lock and home buttons as seen on you tube something called 'white screen of death' its goes black (think it switches off) then back to the white screen need help fast please!

    If you have not done a factory reset on the device, I recommend doing a complete  factory reset.  
    Factory Reset  - Warning this will reset device back to original factory settings.
    This method will not erase any MDN/MIN information
    Turn off the phone 
    Press Power + Volume Up/Down at the same time and hold until display will show a triage android screen 
    Display will show: 
    Reboot system Now 
    Apply sdcard:update.zip 
    Wipe Data/Factory Reset 
    Wipe Cache Partition
    Use VOL Down key to scroll down to "Wipe Data/Factory Reset", press home icon to select option and wipe device. 
    Display shows "All user data will be wiped out", press VOLUME Up to continue or VOLUME Down to exit. 
    Press Volume Up 
    Press Home to select "Reset System Now" - device will reboot
    If the problem persist I recommend having a store technician take a look at the device.
    Copy and paste the link below into your browser's address bar for the store locator.  
    http://www.verizonwireless.com/b2c/storelocator/index.jsp

  • Help Urgent please !!

    Hello, i've got an great problem:
    Ihave an frameset with 2 frames. these 2 frames should be loaded dynamicaly, that means i call the frameset
    frameset.html#NameOfTheRightFrame#Titleoftheframeset#browsertyp
    the extraction of the sendet data works without problems and under Internet Explorer i can call the right frame by document.FrameName.href. But under Netscape it doesn't work.
    Do anybody of you know how i could call an frame out of the frameste under netscape?????
    Thaknks
    J�rg

    Help Urgent please !!And the winner of this weeks Lest Perspicuous Subject Line - award goes to...
    "Help Urgent please !!"
    <applause/>
    While including all the magic words "help", "urgent", and "please", multiple exclamation marks and some mis-capitalization, and not describing the actual message at all, it's not perfect in style: "urgent" is not written in all caps and there are too few exclamation marks. But the fact that the body of the post itself is totally off-topic is an amendment to failing in these.
    To the actual question I'd answer: have you tried checking the javascript reference?

Maybe you are looking for