Problem with programming logic in code
I have hit a programming logic problem. What I wanted is for my main program to create a jDialog according to user's choice selection from a jOptionPane and the code in the main body to stop running and rather wait for the user to select the option in the jDialog and then go back to running the main code body but somehow my program doesn't work that way. Anyone have any ideas how to fix it ?
Object[] obj = {"Specific Date","Month/Year"};
String input = (String) JOptionPane.showInputDialog(this,"Choose the following ways to select a date.","Select Date",JOptionPane.INFORMATION_MESSAGE,null,obj,obj[0]);
if(input.equals("Specific Date")){
jDialog1.setSize(400,250);
jDialog1.setVisible(true);
//while(option!=1){
//System.out.println("waiting");
if(option==1){
System.out.println("Year: "+chosenYear);
//break;
data.append("<H1>Other Day / Month / Year Record</H1>");
data.append("<p>Date: "+todayDay+"/"+todayMonth+"/"+todayYear+"</p><br>");
System.out.println("breaking out soon...");
} else if(input.equals("Month/Year")){
jDialog2.setSize(300,200);
jDialog2.setVisible(true);
//while(option!=1){
//System.out.println("waiting");
if(option==1){
System.out.println("Year: "+chosenYear);
//break;
data.append("<H1>Other Day / Month / Year Record</H1>");
data.append("<p>Date: "+todayDay+"/"+todayMonth+"/"+todayYear+"</p><br>");
System.out.println("breaking out soon...");
// data.append("<H1>Other Day / Month / Year Record</H1>");
// data.append("<p>Date: "+todayDay+"/"+todayMonth+"/"+todayYear+"</p><br>");
System.out.println("break executed...");As you can see...I was originally thinking to use a while loop but it failed so I commented it out. I have been stuck in this programming logic of waiting for the user to choose an option form the jDialog before continuning in the main body. The jDialogs are already initiatized and both jDialogs would set the 'option' variable which has been init earlier on (the code is really too long to be placed here to '1' when it is ready for the program to resume to run the main body of the codes as you can see.
So anyone have any ideas how to get it solved ?
I do need a solution fast because these codes have a deadline in 2 weeks time.
null
Here's the entire code for this java class.
* ExportRecord.java
* Created on September 7, 2007, 2:03 PM
package lkgaccount;
import java.util.ArrayList;
import java.util.Calendar;
import javax.swing.*;
import java.awt.*;
import java.io.*;
* @author Owner
public class ExportRecord extends javax.swing.JInternalFrame {
export exp = new export();
String filepath = "";
File toFile;
StringBuffer data;
HTMLBrowser htmlbrowser;
int subOption = 0;
int chosenDay;
int chosenMonth;
String chosenMth;
int chosenYear;
CodeManager cm = new CodeManager();
/** Creates new form ExportRecord */
public ExportRecord() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
jDialog1 = new javax.swing.JDialog();
jPanel2 = new javax.swing.JPanel();
jButton6 = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
jCalendar1 = new com.toedter.calendar.JCalendar();
jDialog2 = new javax.swing.JDialog();
jPanel4 = new javax.swing.JPanel();
jButton10 = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
jComboBox2 = new javax.swing.JComboBox();
jSpinner1 = new javax.swing.JSpinner();
jLabel8 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
jButton1 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jButton5 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jDialog1.setTitle("Search By Date");
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Search By: Date ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
jButton6.setText("Submit");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
jLabel6.setText("Date Parameter:");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(255, Short.MAX_VALUE)
.addComponent(jButton6)
.addContainerGap())
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
.addComponent(jButton6)
.addContainerGap())
jDialog1.getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Search By: Month/Year", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
jButton10.setText("Submit");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
jLabel7.setText("Month: ");
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "*" }));
jLabel8.setText(" Year: ");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jSpinner1)
.addComponent(jComboBox2, 0, 167, Short.MAX_VALUE)))
.addComponent(jButton10, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton10)
.addContainerGap())
jDialog2.getContentPane().add(jPanel4, java.awt.BorderLayout.CENTER);
setTitle("Export Record");
jLabel1.setText("Export by: ");
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Daily Record", "Current Month's Record", "Current Year's Record", "Other Day / Month / Year Record", "Supplier Names", "All Account Records" }));
jButton1.setText("Close");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
jLabel2.setText("Export as: ");
jTextField1.setEditable(false);
jTextField1.setText(".html");
jLabel3.setText("Save to: ");
jButton2.setText("...");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
jLabel4.setText("File Name: ");
jLabel5.setText("( do not add a file extension behind )");
jButton5.setText("Clear");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
jPanel1.add(jButton5);
jButton4.setText("Preview");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
jPanel1.add(jButton4);
jButton3.setText("Export");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
jPanel1.add(jButton3);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
.addComponent(jTextField1)
.addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE))))))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jButton1))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)
.addComponent(jButton1)
.addContainerGap())
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
// TODO add your handling code here:
String mth = (String)jComboBox2.getSelectedItem();
Integer yr = (Integer)jSpinner1.getValue();
subOption = 2;
chosenMth = mth;
chosenYear = (int)yr;
}//GEN-LAST:event_jButton10ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
// TODO add your handling code here:
Calendar calendar = jCalendar1.getCalendar();
int day = calendar.get(Calendar.DATE);
int month = calendar.get(Calendar.MONTH);
int year = calendar.get(Calendar.YEAR);
month ++;
System.out.println("calendar: "+day+"/"+month+"/"+year);
subOption = 1;
chosenDay = day;
chosenMonth = month;
chosenYear = year;
}//GEN-LAST:event_jButton6ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
int index = jComboBox1.getSelectedIndex();
String folderExt = jTextField2.getText();
String fileName = jTextField3.getText();
String urlpath = folderExt+"\\"+fileName+".html";
System.out.println(urlpath);
if(folderExt.equals("")||fileName.equals("")){
JOptionPane.showMessageDialog(this,"Please specific which folder and the name of the file you want to save your exported documents.","Folder and file not specified",JOptionPane.INFORMATION_MESSAGE);
} else{
toFile = new File(urlpath);
if(toFile.exists()){
JOptionPane.showMessageDialog(this,urlpath+" has already existed. Please enter a new file name. ","File Exist",JOptionPane.WARNING_MESSAGE);
data = new StringBuffer();
data = getData(data,index,fileName);
exp.writeHTML(data,toFile);
if(htmlbrowser!=null){
htmlbrowser.dispose();
htmlbrowser = new HTMLBrowser("file:/"+urlpath);
htmlbrowser.setVisible(true);
} else{
htmlbrowser = new HTMLBrowser("file:/"+urlpath);
htmlbrowser.setVisible(true);
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
int index = jComboBox1.getSelectedIndex();
toFile = new File("C:\\Documents and Settings\\Owner\\LKGAccount\\dist\\preview.html");
if(toFile.exists()){
data = new StringBuffer();
data = getData(data,index,"Preview");
exp.writeHTML(data,toFile);
if(htmlbrowser!=null){
htmlbrowser.dispose();
htmlbrowser = new HTMLBrowser("file:/C:\\Documents and Settings\\Owner\\LKGAccount\\dist\\preview.html");
htmlbrowser.setVisible(true);
} else{
htmlbrowser = new HTMLBrowser("file:/C:\\Documents and Settings\\Owner\\LKGAccount\\dist\\preview.html");
htmlbrowser.setVisible(true);
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
jComboBox1.setSelectedIndex(0);
jTextField2.setText("");
jTextField3.setText("");
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = chooser.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
filepath = chooser.getSelectedFile().getAbsolutePath();
jTextField2.setText(filepath);
}//GEN-LAST:event_jButton2ActionPerformed
public StringBuffer getData(StringBuffer data, int option, String filename){
ArrayList aList = new ArrayList();
Date date = new Date();
int todayDay = date.getDay();
int todayMonth = date.getMonth();
int todayYear = date.getYear();
data.append("<html>");
data.append("<head>");
data.append("<title>Lim Kim Guan Accounting Record: "+filename+"</title>");
data.append("</head>");
data.append("<body>");
if(option==0){
data.append("<H1>Daily Record</H1>");
data.append("<p>Date: "+todayDay+"/"+todayMonth+"/"+todayYear+"</p><br>");
aList = cm.searchByDate(todayDay,todayMonth,todayYear);
if(aList==null||aList.isEmpty()){
data.append("<p><center><b>There is no data transaction for today.</b></center></p>");
} else{
data.append("<center><table border=\"1\">");
data.append("<tr>");
data.append("<td colspan=\"7\"><center><b>Accounting Records</b></center></td>");
data.append("</tr>");
data.append("<tr>");
data.append("<td><center><B>Acct ID</B></center></td>");
data.append("<td><center><B>Supplier Name</B></center></td>");
data.append("<td><center><B>Invoice #</B></center></td>");
data.append("<td><center><B>Original $ before GST</B></center></td>");
data.append("<td><center><B>GST(%)</B></center></td>");
data.append("<td><center><B>$ after GST</B></center></td>");
data.append("<td><center><B>Date</B></center></td>");
data.append("</tr>");
for(int i=0;i<aList.size();i++){
account acct = (account)aList.get(i);
if(acct != null) {
data.append("<tr>");
data.append("<td>"+Integer.toString(acct.getId())+"</td>");
data.append("<td>"+acct.getSupplierName()+"</td>");
data.append("<td>"+acct.getInvoiceid()+"</td>");
data.append("<td>"+Double.toString(acct.getBeforeGST$())+"</td>");
data.append("<td>"+Integer.toString(acct.getGst())+"</td>");
data.append("<td>"+Double.toString(acct.getAfterGST$())+"</td>");
data.append("<td>"+acct.getDay()+" / "+acct.getMonth()+" / "+acct.getYear()+"</td>");
data.append("</tr>");
data.append("</table></center>");
} else if(option==1){
data.append("<H1>Current Month's Record</H1>");
data.append("<p>Date: "+todayDay+"/"+todayMonth+"/"+todayYear+"</p><br>");
aList = cm.searchByIntMonthYear(todayMonth,todayYear);
if(aList==null||aList.isEmpty()){
data.append("<p><center><b>There is no data transaction for current month.</b></center></p>");
} else{
data.append("<center><table border=\"1\">");
data.append("<tr>");
data.append("<td colspan=\"7\"><center><b>Accounting Records</b></center></td>");
data.append("</tr>");
data.append("<tr>");
data.append("<td><center><B>Acct ID</B></center></td>");
data.append("<td><center><B>Supplier Name</B></center></td>");
data.append("<td><center><B>Invoice #</B></center></td>");
data.append("<td><center><B>Original $ before GST</B></center></td>");
data.append("<td><center><B>GST(%)</B></center></td>");
data.append("<td><center><B>$ after GST</B></center></td>");
data.append("<td><center><B>Date</B></center></td>");
data.append("</tr>");
for(int i=0;i<aList.size();i++){
account acct = (account)aList.get(i);
if(acct != null) {
data.append("<tr>");
data.append("<td>"+Integer.toString(acct.getId())+"</td>");
data.append("<td>"+acct.getSupplierName()+"</td>");
data.append("<td>"+acct.getInvoiceid()+"</td>");
data.append("<td>"+Double.toString(acct.getBeforeGST$())+"</td>");
data.append("<td>"+Integer.toString(acct.getGst())+"</td>");
data.append("<td>"+Double.toString(acct.getAfterGST$())+"</td>");
data.append("<td>"+acct.getDay()+" / "+acct.getMonth()+" / "+acct.getYear()+"</td>");
data.append("</tr>");
data.append("</table></center>");
} else if(option==2){
data.append("<H1>Current Year's Record</H1>");
data.append("<p>Date: "+todayDay+"/"+todayMonth+"/"+todayYear+"</p><br>");
aList = cm.searchByMonthYear("*",todayYear);
if(aList==null||aList.isEmpty()){
data.append("<p><center><b>There is no data transaction for today.</b></center></p>");
} else{
data.append("<center><table border=\"1\">");
data.append("<tr>");
data.append("<td colspan=\"7\"><center><b>Accounting Records</b></center></td>");
data.append("</tr>");
data.append("<tr>");
data.append("<td><center><B>Acct ID</B></center></td>");
data.append("<td><center><B>Supplier Name</B></center></td>");
data.append("<td><center><B>Invoice #</B></center></td>");
data.append("<td><center><B>Original $ before GST</B></center></td>");
data.append("<td><center><B>GST(%)</B></center></td>");
data.append("<td><center><B>$ after GST</B></center></td>");
data.append("<td><center><B>Date</B></center></td>");
data.append("</tr>");
for(int i=0;i<aList.size();i++){
account acct = (account)aList.get(i);
if(acct != null) {
data.append("<tr>");
data.append("<td>"+Integer.toString(acct.getId())+"</td>");
data.append("<td>"+acct.getSupplierName()+"</td>");
data.append("<td>"+acct.getInvoiceid()+"</td>");
data.append("<td>"+Double.toString(acct.getBeforeGST$())+"</td>");
data.append("<td>"+Integer.toString(acct.getGst())+"</td>");
data.append("<td>"+Double.toString(acct.getAfterGST$())+"</td>");
data.append("<td>"+acct.getDay()+" / "+acct.getMonth()+" / "+acct.getYear()+"</td>");
data.append("</tr>");
data.append("</table></center>");
} else if(option==3){
data.append("<H1>Other Day / Month / Year Record</H1>");
data.append("<p>Date: "+todayDay+"/"+todayMonth+"/"+todayYear+"</p><br>");
Object[] obj = {"Specific Date","Month/Year"};
String input = (String) JOptionPane.showInputDialog(this,"Choose the following ways to select a date.","Select Date",JOptionPane.INFORMATION_MESSAGE,null,obj,obj[0]);
if(input.equals("Specific Date")){
jDialog1.setSize(400,250);
jDialog1.setVisible(true);
while(true){
System.out.println("waiting");
if(subOption==1){
System.out.println("Year: "+chosenYear);
break;
} else if(input.equals("Month/Year")){
jDialog2.setSize(300,200);
jDialog2.setVisible(true);
while(true){
System.out.println("waiting");
if(subOption==2){
System.out.println("Year: "+chosenYear);
break;
System.out.println("break executed...");
} else if(option==4){
data.append("<H1>Supplier Names</H1>");
data.append("<p>Date: "+todayDay+"/"+todayMonth+"/"+todayYear+"</p><br>");
aList = cm.getCompanyList();
if(aList==null||aList.isEmpty()){
data.append("<p><center><b>There is no data transaction for today.</b></center></p>");
} else{
data.append("<center><table border=\"1\">");
data.append("<tr>");
data.append("<td colspan=\"1\"><center><b>Supplier Names</b></center></td>");
data.append("</tr>");
for(int i=0;i<aList.size();i++){
String result = (String)aList.get(i);
if(result != null||result.isEmpty()) {
data.append("<tr>");
data.append("<td>"+result+"</td>");
data.append("</tr>");
data.append("</table></center>");
} else if(option==5){
data.append("<H1>All Account Records</H1>");
data.append("<p>Date: "+todayDay+"/"+todayMonth+"/"+todayYear+"</p><br>");
aList = cm.getAccountRecords();
if(aList==null||aList.isEmpty()){
data.append("<p><b>There is no data transaction for today.</b></p>");
} else{
data.append("<center><table border=\"1\">");
data.append("<tr>");
data.append("<td colspan=\"7\"><center><b>Accounting Records</b></center></td>");
data.append("</tr>");
data.append("<tr>");
data.append("<td
Similar Messages
-
hi, me havin a very funny prob w one of my mtd. here's a mtd from my bean class.
public boolean checkForEvent (String searchdate) {
boolean hasEvent = true;
try {
// This is the sql statement to modify.
sql = "select * from event where eventstart <= to_date('" +
searchdate + "','dd-mon-yy') and eventend >= to_date('" +
searchdate + "', 'dd-mon-yy') and eventoption = 'yes' order by eventname asc";
stmt = conn.createStatement ();
rs = stmt.executeQuery (sql);
if(rs.next())
hasEvent = true;
else
hasEvent = false;
rs.close ();
} // end try
catch (SQLException e) {}
catch (Exception exp) {}
return hasEvent;
} // end method
the thing i dun understand is that my program will return whatever boolean i initialise hasEvent to, regardless of what goes on inside the resultset. i'm quite sure that it's not problem of database or the if-else part. it just seems like the program dun enter the if-else condition statement. i have debugged many many times but still same old prob. any1 has any idea wat is wrong with my program logic?thksLooks like your getting some exceptions.
Try to see that by putting some print statements in your catch blocks. -
Hello all,
Ok reposted using code tags, sorry about that.
I'm trying to write some code to take in a 2D int array, loop through the array to identify where certain blocks of numbers begin and record that location so that I an jump straight to it at a later time. The number blocks go up iteratively from a point from 0 to 9 and are surrounded by nodata values(-9999).
The problem is that when I print out the numbers they are only being recognised up to 6 (7th number) and when I check the locations against the original text file they dont match. I think it's just a problem with my logic but I'm not sure why.
The text file is converted to ints and placed in an array from a buffered file reader in a seperate class. I can put this up if needed.
Any help would be much appreciated.
Thanks.
Duncan
* Class imports text file which contains a collection of values, either nodata(-9999) or a location
* represented by numbers moving away from a point; 0 closest then 1, then 2 etc.
* records the first location of each number to avoid having to loop through the whole file each time.
* i.e. can later jump straight to the first recorded location of each number.
* In current text file there are 10 numbers(0 - 9) but for some reason it stops finding them after
* 6(seventh no.) and having checked the location values against the original text file these are wrong
* by a fair way as well.
import java.io.*;
//import java.awt.*;
//import java.awt.event.*;
public class Hydrograph {
int width = 0;
int height = 0;
int dZeroC, dZeroD = 0;
int dOneC, dOneD = 0;
int dTwoC, dTwoD = 0;
int dThreeC, dThreeD = 0;
int dFourC, dFourD = 0;
int dFiveC, dFiveD = 0;
int dSixC, dSixD = 0;
int dSevenC, dSevenD = 0;
int dEightC, dEightD = 0;
int dNineC, dNineD = 0;
public Hydrograph() {
/* Ignore this bit it's being used for something else
//File file = new File("c:/Users/Duncan/Documents/MODULES/MSc Dissertation/Code/A1.txt");
//File file = new File("M:/java/code/A1.txt");
ArrayRead ar = null;
ar = new ArrayRead(file);
int rows = ar.getRows();
int columns = ar.getColumns();
int steps = ar.getSteps();
int[][][] threeDIntArray = ar.getThreeDIntArray();
// Creates a new instance of delay class which takes in a text file and converts
// it to int form, placing it into a 2D int array.
Delay dLay = null;
dLay = new Delay();
width = dLay.getWidth();
height = dLay.getHeight();
int[][] twoDDelayFile = dLay.getTwoDintArray();
int delayCount = 0;
// Loops through 2D int array to identify when number first equals 0, then passes
// the height and width values to storeDelayPos method below. Then finds for 1, 2
// 3, 4,...etc by adding 1 to delayCount.
System.out.println(" ");
for (int a=0; a<width; a++) {
for (int b=0; b<height; b++) {
if (twoDDelayFile[a] == delayCount) {
int c, d = 0;
c = a;
d = b;
storeDelayPos(c, d, delayCount);
System.out.println(delayCount);
delayCount++;
break;
//System.out.println(" ");
System.out.println(" ");
System.out.print(dZeroC + " " + dZeroD);
System.out.println(" ");
System.out.print(dOneC + " " + dOneD);
System.out.println(" ");
System.out.print(dTwoC + " " + dTwoD);
System.out.println(" ");
System.out.print(dThreeC + " " + dThreeD);
System.out.println(" ");
System.out.print(dFourC + " " + dFourD);
System.out.println(" ");
System.out.print(dFiveC + " " + dFiveD);
System.out.println(" ");
System.out.print(dSixC + " " + dSixD);
System.out.println(" ");
System.out.print(dSevenC + " " + dSevenD);
// Takes in width, height and delayCount value and sets variables according to
// the value of delayCount.
void storeDelayPos (int setC, int setD, int setDCount) {
int dCount = 0;
dCount = setDCount;
switch(dCount) {
case 0:
dZeroC = setC;
dZeroD = setD;
break;
case 1:
dOneC = setC;
dOneD = setD;
break;
case 2:
dTwoC = setC;
dTwoD = setD;
break;
case 3:
dThreeC = setC;
dThreeD = setD;
break;
case 4:
dFourC = setC;
dFourD = setD;
break;
case 5:
dFiveC = setC;
dFiveD = setD;
break;
case 6:
dSixC = setC;
dSixD = setD;
break;
case 7:
dSevenC = setC;
dSevenD = setD;
break;
case 8:
dEightC = setC;
dEightD = setD;
break;
case 9:
dNineC = setC;
dNineD = setD;
break;
default:
System.out.println("OUT OF BOUNDS");
break;
public static void main (String args[]) {
new Hydrograph();Hi,
I am working on a hydrograph program in java as well... I am trying to represent rainfall data. Do you think that you could share some of the code that you came up with, so that I don't have to go through the whole process.
thank you so much,
Kevin -
unable to update itunes. help. error message when trying to update to latest version of itunes. "the installer has encountered an unexpected error installing this package. this may indicate a problem with this package. error code 2721"
Hello chae84swangin,
I recommend following the steps in the article below when getting an error message trying to install iTunes:
Trouble installing iTunes or QuickTime for Windows
http://support.apple.com/kb/HT1926
Thank you for using Apple Support Communities.
Best,
Sheila M. -
Problem with program hanging randomly on certain commands from win 7 pro client to SB Server
Having a problem with program hanging randomly on certain commands from Win-7 Pro Client to SB Server Both 64-Bit
Five other slower XP-Pro 32 Bit systems though they are older and slower systems do not seem to hang as readily if at all.
It has been very frustrating as the Client-System, SB-Server and Program should work w/o any hitches, but this seems to work fine @ times and then hang randomly.
Would appreciate any and all suggestions in assisting.... JimBAgde-MSSYou can try this, as I have had similar problems with another MS Access .MDB file and slow access before. This fixed my problem for me. On the slow computer, make sure the program is set to see the .mdb file via UNC path, not a mapped drive letter. ex.
USE: \\yourserver\shared\dental\file.mdb
DO NOT: S:\\shared\dental\file.mdb
hope this helps -
I have ipad 2 and facing problem with programs swtching off
I have ipad 2 and facing problem with programs it's swtching off while working and turn to home page. Am using ios 5
If it's happening on all the apps that you've downloaded from the App Store, but not the Apple built-in ones, then try downloading any free app from the store (as that appears to reset something) and then re-try them - the free app can then be deleted.
If it's happening on all apps then try closing them all completely and then see if they work when you re-open them : from the home screen (i.e.not with any app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of each app to close them, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
If that doesn't work then you could try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot. -
I am trying to get the free trial to cc but it said there seems to be a problem with the files (Error code: 205) please help
BOILERPLATE TEXT:
Note that this is boilerplate text.
If you give complete and detailed information about your setup and the issue at hand,
such as your platform (Mac or Win),
exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
your settings in Photoshop > Preference > Performance
the type of file you were working on,
machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
what troubleshooting steps you have taken so far,
what error message(s) you receive,
if having issues opening raw files also the exact camera make and model that generated them,
if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
etc.,
someone may be able to help you (not necessarily this poster, who is not a Windows user).
a screen shot of your settings or of the image could be very helpful too.
Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
http://forums.adobe.com/thread/419981?tstart=0
Thanks! -
Guys,
I really am having a lot of problems with a program. I got the program to compile but it looks absolutely nothing like it is supposed to look. I have a deadline for tomorrow and sent my teacher an email but the chances of him getting back to me by tomorrow night for a weekend is pretty much slim to none. Anyways I am sending my output and if anyone could give me advice or feedback on why it does not look right if it is something small and if its alot of things go ahead and call me dumb.
here is my code:
import javax.swing.JOptionPane;
import java.awt.*;
import java.awt.event.*;
public class Checkerboard extends Frame implements ActionListener
private Panel topPanel;
private TextArea topDisplay[];
private Panel bottomPanel;
private TextField startField = new TextField(10);
private TextField stopField = new TextField(10);
private TextField stepField = new TextField(10);
private Label startLabel = new Label ("Start");
private Label stopLabel = new Label ("Stop");
private Label stepLabel = new Label ("Step");
private Button goButton;
private Button clearButton;
private boolean clearText;
private boolean first;
private int start;
private int stop;
private int step;
//constructor methods
public Checkerboard()
//construct components and initialize beginning values
topPanel = new Panel();
topDisplay = new TextArea[16];
goButton = new Button("Go");
clearButton = new Button("Clear");
first = true;
bottomPanel = new Panel();
int start = 0;
int stop = 0;
int step = 0;
bottomPanel.add(startField);
bottomPanel.add(stopField);
bottomPanel.add(stepField);
bottomPanel.add(startLabel);
bottomPanel.add(stopLabel);
bottomPanel.add(stepLabel);
bottomPanel.add(goButton);
goButton.addActionListener(this);
bottomPanel.add(clearButton);
clearButton.addActionListener(this);
clearText = true;
//set layouts for the Frame and Panels
setLayout(new BorderLayout());
topPanel.setLayout(new GridLayout(4, 4, 10, 10));
bottomPanel.setLayout(new GridLayout(3, 3, 5, 5));
//construct the Display
for(int i = 1; i <= 15; i++)
topDisplay[i] = new TextArea(null, 3, 5, 3);
//set color to the panel
//row 1
for(int x = 1; x <= 4; x++)
//set color for
setBackground(Color.white);
//row 2
for(int x = 5; x <= 8; x++)
//set color for
setBackground(Color.white);
//row 3
for(int x = 9; x <= 12; x++)
//set color for
setBackground(Color.white);
//row 4
for(int x = 13; x <= 16; x++)
//set color for
setBackground(Color.white);
//add components to frame
add(topPanel, BorderLayout.NORTH);
add(bottomPanel, BorderLayout.CENTER);
//allow the x to close the application
addWindowListener(new WindowAdapter()
public void windowclosing(WindowEvent e)
System.exit(0);
} //end window adapter
public static void main(String args[])
Checkerboard f = new Checkerboard();
f.setTitle("Checkerboard Array");
f.setBounds(50, 100, 300, 400);
f.setLocationRelativeTo(null);
f.setVisible(true);
} //end main
public void actionPerformed(ActionEvent e)
//convert data in TextField to int
int start = Integer.parseInt(startField.getText());
int stop = Integer.parseInt(stopField.getText());
int step = Integer.parseInt(stepField.getText());
for(int i = 1; i <=16; i++)
setBackground(Color.blue);
for(int i = start; i <= stop; i++)
setBackground(Color.yellow);
//test clear
String arg = e.getActionCommand();
//clear button was clicked
if(arg.equals("Clear"))
clearText = true;
start = 0;
stop = 0;
step = 0;
first = true;
setBackground(Color.white);
startField.requestFocus();
} //end the if clear
}//end action listener
}//end classThis will incorporate arrays, for loops, and Frames all in one.
Create a panel containing an array of 16 TextArea components that change color to correspond with the start, stop, and step values entered by the user. Perform the following tasks to create the Checkerboard Array application shown below. When the user enters the start, stop, and step fields and then clicks the Go button, the results are also shown below.
1. Call your application Checkerboard.java
2. You will need the following variables� declare them as private:
a. 16 component TextArea array
b. a Panel to hold the array
c. 3 TextField components with length of 10
d. 3 int variables to receive the start, stop, and step values
e. 3 Labels to display the words Start, Stop, and Step
f. a Go button
g. a Clear button
h. a Panel to hold the 3 TextFields, 3 Labels, and the 2 Buttons
3. Create a constructor method to:
a. construct each of the components declared above and initializes the start, stop, and step variables to zero (when constructing the TextArea components, use the following parameters: null, 3, 5, 3)
b. set the Frame layout to BorderLayout
c. write a for loop to loop the array and set each of the 16 TextArea components in that array so they cannot be edited. In the same loop, set each of the TextArea components text to be 1 more than the index number. Also in this same loop, set the background of each of the TextArea components to white.
d. set the Panel for the TextArea components to GridLayout with 4 rows, 4 columns, and both gaps set to 10
e. set the Panel for the TextFields, Labels, and button to GridLayout with 3 rows, 3 columns, and both gaps set to 5
f. add the components to their respective Panels
g. make the buttons clickable
h. place the Panels in the Frame� put one in the NORTH and one in the CENTER
i. Enter the addWindowListener() method described in the chapter� this is the method that overrides the click of the X so it terminates the application
4. In your actionPerformed() method:
a. convert the data in your TextFields to int and store them in the variables declared above
b. write a loop that goes through the array setting every background color to blue
c. write another loop that�s based on the user inputs. Each time the loop is executed, change the background color to yellow (so� start your loop at the user�s specified starting condition. You�ll stop at the user�s specified stopping value. You�ll change the fields to yellow every time you increment your loop based on the step value. REMEMBER: Your displayed values are 1 off from your index numbers!!)
5. Write a main() method that creates an instance of the Checkerboard Frame.
a. set the bounds for the frame to 50, 100, 300, 400
b. set the title bar caption to Checkerboard Array
c. use the setVisible() method to display the application Frame during execution
6. After you get all of this complete, include error handling to make sure:
a. the values entered in the TextFields are valid integers
b. the start value is greater than or equal to 1 and less than or equal to 16
c. the stop value is greater than or equal to 1 and less than or equal to 16
d. the step value is greater than or equal to 1 and less than or equal to 16
e. the start condition is less than the stop condition
f. when an error occurs, give an error message in a dialog box that is specific to their error, remove the text from the invalid field, and put the cursor in that field so the user has a chance to re-enter� this can be accomplished by using multiple try/catch statements
g. only change the colors if the numbers are valid
7. Create a clear button as seen in the example below. This button should:
a. clear out all 3 TextFields
b. change the background color of all TextArea array elements to white
c. put the cursor in the start field
8. Document!!
I know you guys are probably busy with your own stuff but any help and I would certainly appreciate itgot the yellow boxes to come up but just one box.....so is there something wrong with my yellow set background because I am not seeing any more errors
//packages to import
import javax.swing.JOptionPane;
import java.awt.*;
import java.awt.event.*;
public class Checkerboard extends Frame implements ActionListener
private Panel topPanel;
private TextArea topDisplay[];
private Panel bottomPanel;
private TextField startField = new TextField(10);
private TextField stopField = new TextField(10);
private TextField stepField = new TextField(10);
private Label startLabel = new Label ("Start");
private Label stopLabel = new Label ("Stop");
private Label stepLabel = new Label ("Step");
private Button goButton;
private Button clearButton;
private boolean clearText;
private boolean first;
private int start;
private int stop;
private int step;
//constructor methods
public Checkerboard()
//construct components and initialize beginning values
topPanel = new Panel();
topDisplay = new TextArea[16];
goButton = new Button("Go");
clearButton = new Button("Clear");
first = true;
bottomPanel = new Panel();
int start = 0;
int stop = 0;
int step = 0;
bottomPanel.add(startField);
bottomPanel.add(stopField);
bottomPanel.add(stepField);
bottomPanel.add(startLabel);
bottomPanel.add(stopLabel);
bottomPanel.add(stepLabel);
bottomPanel.add(goButton);
goButton.addActionListener(this);
bottomPanel.add(clearButton);
clearButton.addActionListener(this);
clearText = true;
//set layouts for the Frame and Panels
setLayout(new BorderLayout());
topPanel.setLayout(new GridLayout(4, 4, 10, 10));
bottomPanel.setLayout(new GridLayout(3, 3, 5, 5));
//construct the Display
for(int i = 0; i <= 15; i++)
topDisplay[i] = new TextArea(null, 3, 5, 3);
topDisplay.setText(String.valueOf(i+1));
topDisplay[i].setEditable(false);
topPanel.add(topDisplay[i]);
//add components to frame
add(topPanel, BorderLayout.NORTH);
add(bottomPanel, BorderLayout.CENTER);
//allow the x to close the application
addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);
} //end window adapter
public static void main(String args[])
Checkerboard f = new Checkerboard();
f.setTitle("Checkerboard Array");
f.setBounds(50, 100, 300, 400);
f.setLocationRelativeTo(null);
f.setVisible(true);
} //end main
public void actionPerformed(ActionEvent e)
boolean done = false;
//test go
String arg = e.getActionCommand();
//go button was clicked
if(arg.equals("Go"))
//convert data in TextField to int
int start = Integer.parseInt(startField.getText());
int stop = Integer.parseInt(stopField.getText());
int step = Integer.parseInt(stepField.getText());
while(!done)
try
if((start <= 1) && (start > 16)) throw new NumberFormatException();
else done = true;
} //end try
catch (NumberFormatException f)
JOptionPane.showMessageDialog(null, "You must enter start between 1 and 16", "Error", JOptionPane.ERROR_MESSAGE);
startField.setText(" ");
startField.requestFocus();
} //end catch
try
if ((stop < 1) && (stop > 16)) throw new NumberFormatException();
else done = true;
} //end try
catch (NumberFormatException f)
JOptionPane.showMessageDialog(null, "You must enter stop between 1 and 16", "Error", JOptionPane.ERROR_MESSAGE);
stopField.setText(" ");
stopField.requestFocus();
} //end catch
try
if ((step < 1) && (step > 16)) throw new NumberFormatException();
else done = true;
} //end try
catch (NumberFormatException f)
JOptionPane.showMessageDialog(null, "You must enter step between 1 and 16", "Error", JOptionPane.ERROR_MESSAGE);
stepField.setText(" ");
stepField.requestFocus();
} //end catch
try
if (start > stop) throw new NumberFormatException();
else done = true;
} //end try
catch (NumberFormatException f)
JOptionPane.showMessageDialog(null, "Stop cannot be larger than start", "Error", JOptionPane.ERROR_MESSAGE);
startField.setText(" ");
stopField.setText(" ");
stepField.setText(" ");
startField.requestFocus();
} //end catch
} //end while
for(int i = 0; i <=15; i++)
topDisplay[i].setBackground(Color.blue);
for(int i = start; i <= stop; step++)
topDisplay[i].setBackground(Color.yellow);
} //end the if go
//clear button was clicked
if(arg.equals("Clear"))
clearText = true;
startField.setText("");
stopField.setText("");
stepField.setText("");
first = true;
setBackground(Color.white);
startField.requestFocus();
} //end the if clear
}//end action listener
}//end class -
Problem with performance in a code.
Hi People! I have problems with the performance of this program. The tables that I use have much data and the program take two hours to finish.
Please, some one tell me how can I make a better performance.
Thanks!
This is the program:
TABLES:
faglflext, "Saldos mensuales por cta.
contable y prf center.
zavg_bal_table,
skat. "Chart of accounts
********************INTERNAL TABLE DEFINITION***************************
DATA: BEGIN OF t_itab1 OCCURS 0.
DATA: rbukrs TYPE faglflext-rbukrs. "Company Code
DATA: racct TYPE faglflext-racct. "Account ID
DATA: prctr TYPE faglflext-prctr. "Profit Center
DATA: kslvt TYPE faglflext-kslvt. "Total of the period in group currency
DATA: ksl01 TYPE faglflext-ksl01. "Total of the period in group currency
DATA: ksl02 TYPE faglflext-ksl02. "Total of the period in group currency
DATA: ksl03 TYPE faglflext-ksl03. "Total of the period in group currency
DATA: ksl04 TYPE faglflext-ksl04. "Total of the period in group currency
DATA: ksl05 TYPE faglflext-ksl05. "Total of the period in group currency
DATA: ksl06 TYPE faglflext-ksl06. "Total of the period in group currency
DATA: ksl07 TYPE faglflext-ksl07. "Total of the period in group currency
DATA: ksl08 TYPE faglflext-ksl08. "Total of the period in group currency
DATA: ksl09 TYPE faglflext-ksl09. "Total of the period in group currency
DATA: ksl10 TYPE faglflext-ksl10. "Total of the period in group currency
DATA: ksl11 TYPE faglflext-ksl11. "Total of the period in group currency
DATA: ksl12 TYPE faglflext-ksl12. "Total of the period in group currency
DATA: ksl13 TYPE faglflext-ksl13. "Total of the period in group currency
DATA: ksl14 TYPE faglflext-ksl14. "Total of the period in group currency
DATA: ksl15 TYPE faglflext-ksl15. "Total of the period in group currency
DATA: ksl16 TYPE faglflext-ksl16. "Total of the period in group currency
DATA: rldnr TYPE faglflext-rldnr. "Ledger in GL Accounting
DATA: rtcur TYPE faglflext-rtcur. "Currency Key
DATA: txt20 TYPE skat-txt20. "Description Text
DATA: saknr TYPE skat-saknr. "G/L account number
DATA: ktopl TYPE skat-ktopl. "Chart of Accounts
DATA: rpmax TYPE faglflext-rpmax. "Period
DATA: total_sum LIKE faglflext-ksl01. "Amount of the first month
DATA: ryear LIKE faglflext-ryear. "Fiscal Year
DATA: year LIKE faglflext-ryear. "Past Year
DATA: day_a TYPE sy-datum.
DATA: per_day TYPE rr_umper.
DATA: average TYPE vtcur12.
DATA: agregate TYPE vtcur12.
DATA: accumulate TYPE vtcur12.
DATA: average_sap TYPE rr_umper.
DATA: END OF t_itab1.
DATA: BEGIN OF t_itab2 OCCURS 0.
DATA: rbukrs TYPE faglflext-rbukrs. "Company Code
DATA: racct TYPE faglflext-racct. "Account ID
DATA: prctr TYPE faglflext-prctr. "Profit Center
DATA: kslvt TYPE faglflext-kslvt. "Total of the period in group currency
DATA: ksl01 TYPE faglflext-ksl01. "Total of the period in group currency
DATA: ksl02 TYPE faglflext-ksl02. "Total of the period in group currency
DATA: ksl03 TYPE faglflext-ksl03. "Total of the period in group currency
DATA: ksl04 TYPE faglflext-ksl04. "Total of the period in group currency
DATA: ksl05 TYPE faglflext-ksl05. "Total of the period in group currency
DATA: ksl06 TYPE faglflext-ksl06. "Total of the period in group currency
DATA: ksl07 TYPE faglflext-ksl07. "Total of the period in group currency
DATA: ksl08 TYPE faglflext-ksl08. "Total of the period in group currency
DATA: ksl09 TYPE faglflext-ksl09. "Total of the period in group currency
DATA: ksl10 TYPE faglflext-ksl10. "Total of the period in group currency
DATA: ksl11 TYPE faglflext-ksl11. "Total of the period in group currency
DATA: ksl12 TYPE faglflext-ksl12. "Total of the period in group currency
DATA: ksl13 TYPE faglflext-ksl13. "Total of the period in group currency
DATA: ksl14 TYPE faglflext-ksl14. "Total of the period in group currency
DATA: ksl15 TYPE faglflext-ksl15. "Total of the period in group currency
DATA: ksl16 TYPE faglflext-ksl16. "Total of the period in group currency
DATA: rldnr TYPE faglflext-rldnr. "Ledger in GL Accounting
DATA: rtcur TYPE faglflext-rtcur. "Currency Key
DATA: txt20 TYPE skat-txt20. "Description Text
DATA: saknr TYPE skat-saknr. "G/L account number
DATA: ktopl TYPE skat-ktopl. "Chart of Accounts
DATA: rpmax TYPE faglflext-rpmax. "Period
DATA: total_sum LIKE faglflext-ksl01. "Amount of the first month
DATA: ryear LIKE faglflext-ryear. "Fiscal Year
DATA: year LIKE faglflext-ryear. "Past Year
DATA: END OF t_itab2.
DATA: BEGIN OF t_zavg OCCURS 0.
DATA: bukrs TYPE bukrs.
DATA: racct TYPE racct.
DATA: prctr TYPE prctr.
DATA: day_a TYPE sy-datum.
DATA: per_day TYPE rr_umper.
DATA: average TYPE vtcur12.
DATA: agregate TYPE vtcur12.
DATA: accumulate TYPE vtcur12.
DATA: average_sap TYPE rr_umper.
DATA: END OF t_zavg.
DATA: BEGIN OF t_zavg2 OCCURS 0.
DATA: day_a TYPE sy-datum.
DATA: racct TYPE racct.
DATA: prctr TYPE prctr.
DATA: per_day TYPE rr_umper.
DATA: average TYPE vtcur12.
DATA: agregate TYPE vtcur12.
DATA: accumulate TYPE vtcur12.
DATA: average_sap TYPE rr_umper.
DATA: END OF t_zavg2.
* Variable definition *
DATA: balance_month_01 LIKE faglflext-ksl01.
DATA: balance_month_02 LIKE faglflext-ksl01.
DATA: balance_month_03 LIKE faglflext-ksl01.
DATA: balance_month_04 LIKE faglflext-ksl01.
DATA: balance_month_05 LIKE faglflext-ksl01.
DATA: balance_month_06 LIKE faglflext-ksl01.
DATA: balance_month_07 LIKE faglflext-ksl01.
DATA: balance_month_08 LIKE faglflext-ksl01.
DATA: balance_month_09 LIKE faglflext-ksl01.
DATA: balance_month_10 LIKE faglflext-ksl01.
DATA: balance_month_11 LIKE faglflext-ksl01.
DATA: balance_month_12 LIKE faglflext-ksl01.
DATA: balance_month_13 LIKE faglflext-ksl01.
DATA: current_average_balance LIKE zavg_bal_table-average.
DATA: current_balance LIKE faglflext-ksl01.
DATA: current_activity_balance LIKE faglflext-ksl01.
DATA: current_aggregate_balance LIKE zavg_bal_table-agregate.
DATA: average_balance_ytd LIKE zfintbco0001-period_avg_12.
DATA: count TYPE i.
DATA: wa_itab LIKE LINE OF t_itab1.
DATA: wa_low LIKE LINE OF t_itab1.
DATA: wa_high LIKE LINE OF t_itab1.
DATA: wa_itab2 LIKE LINE OF t_itab2.
DATA: wa_zavg2 LIKE LINE OF t_zavg2.
DATA: wa_zavg LIKE LINE OF t_zavg.
DATA: t_acum TYPE i.
DATA: companycode TYPE faglflext-rbukrs.
DATA: descripcion TYPE skat-txt20.
DATA: oref TYPE REF TO cx_root,
emsg TYPE zedesc,
param1 TYPE zparm,
parm1 TYPE zparm.
DATA: avg1 TYPE faglflext-ksl01. "AVG = AVERAGE
DATA: avg2 TYPE faglflext-ksl01.
DATA: avg3 TYPE faglflext-ksl01.
DATA: avg4 TYPE faglflext-ksl01.
DATA: avg5 TYPE faglflext-ksl01.
DATA: avg6 TYPE faglflext-ksl01.
DATA: avg7 TYPE faglflext-ksl01.
DATA: avg8 TYPE faglflext-ksl01.
DATA: avg9 TYPE faglflext-ksl01.
DATA: avg10 TYPE faglflext-ksl01.
DATA: avg11 TYPE faglflext-ksl01.
DATA: avg12 TYPE faglflext-ksl01.
DATA: conteo TYPE i.
DATA: conteo2 TYPE i.
DATA: numerocta TYPE faglflext-racct.
DATA: profitcenter TYPE faglflext-prctr.
DATA: average_month_01 TYPE zavg_bal_table-average.
DATA: aggregate_month_01 TYPE zavg_bal_table-agregate.
DATA: average_month_02 TYPE zavg_bal_table-average.
DATA: aggregate_month_02 TYPE zavg_bal_table-agregate.
DATA: average_month_03 TYPE zavg_bal_table-average.
DATA: aggregate_month_03 TYPE zavg_bal_table-agregate.
DATA: average_month_04 TYPE zavg_bal_table-average.
DATA: aggregate_month_04 TYPE zavg_bal_table-agregate.
DATA: average_month_05 TYPE zavg_bal_table-average.
DATA: aggregate_month_05 TYPE zavg_bal_table-agregate.
DATA: average_month_06 TYPE zavg_bal_table-average.
DATA: aggregate_month_06 TYPE zavg_bal_table-agregate.
DATA: average_month_07 TYPE zavg_bal_table-average.
DATA: aggregate_month_07 TYPE zavg_bal_table-agregate.
DATA: average_month_08 TYPE zavg_bal_table-average.
DATA: aggregate_month_08 TYPE zavg_bal_table-agregate.
DATA: average_month_09 TYPE zavg_bal_table-average.
DATA: aggregate_month_09 TYPE zavg_bal_table-agregate.
DATA: average_month_10 TYPE zavg_bal_table-average.
DATA: aggregate_month_10 TYPE zavg_bal_table-agregate.
DATA: average_month_11 TYPE zavg_bal_table-average.
DATA: aggregate_month_11 TYPE zavg_bal_table-agregate.
DATA: average_month_12 TYPE zavg_bal_table-average.
DATA: aggregate_month_12 TYPE zavg_bal_table-agregate.
DATA: ano TYPE i.
DATA: ano_pasado TYPE i.
DATA: ano_corriente TYPE i.
DATA: mesdia TYPE adb_pfrom.
DATA: firstline TYPE i.
DATA: kslvt TYPE faglflext-kslvt.
DATA: ksl01 TYPE faglflext-ksl01.
DATA: ksl02 TYPE faglflext-ksl02.
DATA: ksl03 TYPE faglflext-ksl03.
DATA: ksl04 TYPE faglflext-ksl04.
DATA: ksl05 TYPE faglflext-ksl05.
DATA: ksl06 TYPE faglflext-ksl06.
DATA: ksl07 TYPE faglflext-ksl07.
DATA: ksl08 TYPE faglflext-ksl08.
DATA: ksl09 TYPE faglflext-ksl09.
DATA: ksl10 TYPE faglflext-ksl10.
DATA: ksl11 TYPE faglflext-ksl11.
DATA: ksl12 TYPE faglflext-ksl12.
DATA: ksl13 TYPE faglflext-ksl13.
DATA: ksl14 TYPE faglflext-ksl14.
DATA: ksl15 TYPE faglflext-ksl15.
DATA: ksl16 TYPE faglflext-ksl16.
DATA: itab_kslvt TYPE faglflext-kslvt.
DATA: itab_ksl01 TYPE faglflext-ksl01.
DATA: itab_ksl02 TYPE faglflext-ksl02.
DATA: itab_ksl03 TYPE faglflext-ksl03.
DATA: itab_ksl04 TYPE faglflext-ksl04.
DATA: itab_ksl05 TYPE faglflext-ksl05.
DATA: itab_ksl06 TYPE faglflext-ksl06.
DATA: itab_ksl07 TYPE faglflext-ksl07.
DATA: itab_ksl08 TYPE faglflext-ksl08.
DATA: itab_ksl09 TYPE faglflext-ksl09.
DATA: itab_ksl10 TYPE faglflext-ksl10.
DATA: itab_ksl11 TYPE faglflext-ksl11.
DATA: itab_ksl12 TYPE faglflext-ksl12.
DATA: itab_ksl13 TYPE faglflext-ksl13.
DATA: itab_ksl14 TYPE faglflext-ksl14.
DATA: itab_ksl15 TYPE faglflext-ksl15.
DATA: itab_ksl16 TYPE faglflext-ksl16.
DATA: itab_bal00 TYPE faglflext-kslvt.
DATA: itab_bal01 TYPE faglflext-ksl01.
DATA: itab_bal02 TYPE faglflext-ksl02.
DATA: itab_bal03 TYPE faglflext-ksl03.
DATA: itab_bal04 TYPE faglflext-ksl04.
DATA: itab_bal05 TYPE faglflext-ksl05.
DATA: itab_bal06 TYPE faglflext-ksl06.
DATA: itab_bal07 TYPE faglflext-ksl07.
DATA: itab_bal08 TYPE faglflext-ksl08.
DATA: itab_bal09 TYPE faglflext-ksl09.
DATA: itab_bal10 TYPE faglflext-ksl10.
DATA: itab_bal11 TYPE faglflext-ksl11.
DATA: itab_bal12 TYPE faglflext-ksl12.
DATA: itab_bal13 TYPE faglflext-ksl13.
DATA: itab_bal14 TYPE faglflext-ksl14.
DATA: itab_bal15 TYPE faglflext-ksl15.
DATA: itab_bal16 TYPE faglflext-ksl16.
DATA: numero_de_cta TYPE faglflext-racct.
DATA: company_code TYPE faglflext-rbukrs.
DATA: profit_center TYPE faglflext-prctr.
DATA: currency_code TYPE faglflext-rtcur.
DATA: average_month TYPE zavg_bal_table-average.
DATA: aggregate_month TYPE zavg_bal_table-agregate.
* VARIABLES FOR INTERFACES LOG
DATA: v_tipo TYPE zzfinbc85typede VALUE 1. "Tipo 1 = OUT
DATA: v_nom_int(9) TYPE c VALUE 'ZFINFII00'. "Nombre de la interfaz
DATA: v_modulo(2) TYPE c VALUE 'FI'. "Modulo
DATA: v_comp_code(4) TYPE c VALUE '0000'. "Compañia 0000
DATA: v_alegacy(4) TYPE c VALUE '0001'.
DATA: v_fecha TYPE d.
DATA: v_error2(3) TYPE c VALUE 'E'.
DATA: l_sys_exc TYPE REF TO cx_ai_system_fault.
DATA: last_day TYPE sy-datum.
DATA: numero_mes TYPE i.
DATA: ryear TYPE faglflext-ryear.
DATA: numero_cuenta TYPE faglflext-racct.
DATA: numero_profit TYPE faglflext-prctr.
DATA: day_a TYPE i.
DATA: text(20) TYPE c.
*Acknowledge
DATA: lo_async_messaging TYPE REF TO if_wsprotocol_async_messaging,
lo_msg_id_protocol TYPE REF TO if_wsprotocol_message_id,
l_msg_id TYPE sxmsguid,
l_ack_request TYPE prx_ack_request_details.
DATA: fecha TYPE sy-datum.
DATA: fecha_ejecutandose TYPE sy-datum.
DATA: fecha_corriente TYPE i.
DATA: jan_fin TYPE sy-datum.
DATA: feb_fin TYPE sy-datum.
DATA: febb_fin TYPE sy-datum.
DATA: mar_fin TYPE sy-datum.
DATA: apr_fin TYPE sy-datum.
DATA: may_fin TYPE sy-datum.
DATA: jun_fin TYPE sy-datum.
DATA: jul_fin TYPE sy-datum.
DATA: aug_fin TYPE sy-datum.
DATA: sep_fin TYPE sy-datum.
DATA: oct_fin TYPE sy-datum.
DATA: nov_fin TYPE sy-datum.
DATA: dec_fin TYPE sy-datum.
DATA: porciento1 TYPE faglflext-ksl01.
DATA: porciento2 TYPE faglflext-ksl01.
DATA: porciento3 TYPE faglflext-ksl01.
DATA: porciento4 TYPE faglflext-ksl01.
DATA: porciento5 TYPE faglflext-ksl01.
DATA: porciento6 TYPE faglflext-ksl01.
DATA: porciento7 TYPE faglflext-ksl01.
DATA: porciento8 TYPE faglflext-ksl01.
DATA: porciento9 TYPE faglflext-ksl01.
DATA: porciento10 TYPE faglflext-ksl01.
DATA: porciento11 TYPE faglflext-ksl01.
DATA: porciento12 TYPE faglflext-ksl01.
data: mes(2) type c value '00'.
data: mes_anterior type sy-datum.
data: ceros(2) type c.
*DEFINICION DE RANGOS.
RANGES profit FOR faglflext-prctr.
RANGES account FOR faglflext-racct.
RANGES end_month FOR zavg_bal_table-day_a.
*Sele asigna el fin de mes a cada variable para que sea utilizada luego en el programa.
jan_fin = '20060131'.
feb_fin = '20060228'.
febb_fin = '20060229'.
mar_fin = '20060331'.
apr_fin = '20060430'.
may_fin = '20060531'.
jun_fin = '20060630'.
jul_fin = '20060731'.
aug_fin = '20060831'.
sep_fin = '20060930'.
oct_fin = '20061031'.
nov_fin = '20061130'.
dec_fin = '20061231'.
*Inicializando las variables a valor '0'.
balance_month_01 = 0.
balance_month_02 = 0.
balance_month_03 = 0.
balance_month_04 = 0.
balance_month_05 = 0.
balance_month_06 = 0.
balance_month_07 = 0.
balance_month_08 = 0.
balance_month_09 = 0.
balance_month_10 = 0.
balance_month_11 = 0.
balance_month_12 = 0.
balance_month_13 = 0.
current_average_balance = 0.
current_balance = 0.
current_activity_balance = 0.
current_aggregate_balance = 0.
average_balance_ytd = 0.
count = 0.
t_acum = 0.
conteo = 1.
conteo2 = 1.
ceros = '00'.
*THIS IS A STRUCTURE NAMED E_SKAT. WITH THE TWO FIELDS NAMED SAKNR *
*AND TXT20. *
TYPES: BEGIN OF e_skat,
ktopl LIKE skat-ktopl,
saknr LIKE skat-saknr,
txt20 LIKE skat-txt20,
END OF e_skat.
* SORT THE STRUCTURE IN ORDER FOR BEST PERFORMANCE *
DATA it_skat TYPE SORTED TABLE OF e_skat
WITH UNIQUE KEY saknr WITH HEADER LINE.
DATA: wa_skat LIKE LINE OF it_skat.
* CONSTANT DEFINITIONS (HAVE THE SAME VALUE EVER) *
CONSTANTS:
etype TYPE zetype VALUE 'INTER', "Utilizada con la funcion de error
innum TYPE zintnum VALUE 'ZFINFII00', "Utilizada con la funcion de error
inname TYPE zinname VALUE 'Sendero and Cognos Interfase', "Utilizada con la funcion de error
c_cuenta(10) TYPE c VALUE '0000270011',
c_ol(2) TYPE c VALUE '0L',
c_chart(4) TYPE c VALUE 'CAPI', "Chart Of Accounts
c_ceros(17) TYPE n VALUE '00000000000000.00', "ceros
acct_cog(10) TYPE n VALUE '0000270011', "Numero de cta. que se busca en COGNOS.
capi(4) TYPE c VALUE 'CAPI'.
* PARAMETROS de entrada para el usuario. *
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
PARAMETERS:
p_date TYPE sy-datum DEFAULT sy-datum. "Fecha de corrida
IF p_date IS INITIAL.
p_date = sy-datum.
ENDIF.
* PARAMETEROS DE ENTRADA POR MEDIO DE RANGOS PARA EL USUARIO *
SELECT-OPTIONS:
p_bukrs FOR faglflext-rbukrs.
SELECTION-SCREEN END OF BLOCK bl1.
*IF THE USER SELECT THIS CHECK BOX WITH A CHECK MARK THE PROGRAM *
*SUBMIT THIS INTERFACE TO. *
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.
PARAMETERS:
p_cognos TYPE c AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK bl2.
* This statement calls the subroutine specified, SENDERO or COGNOS *
IF p_cognos IS INITIAL.
PERFORM sendero.
ELSE.
PERFORM cognos.
ENDIF.
EXIT.
* SENEDERO INTERFACE *
FORM sendero.
*ESTE SELECT EXTRAE LA DATA DE LA TABLA FAGFLEXT Y SKAT
DATA: msgdetails TYPE zgl_sendero_file_dt_tab.
DATA: wa_msgdetails LIKE LINE OF msgdetails.
SELECT a~ryear a~rpmax a~rtcur a~racct a~rbukrs a~prctr
a~kslvt a~ksl01 a~ksl02 a~ksl03 a~ksl04 a~ksl05
a~ksl06 a~ksl07 a~ksl08 a~ksl09 a~ksl10 a~ksl11
a~ksl12 a~ksl13 a~ksl14 a~ksl15 a~ksl16 b~saknr
b~txt20 b~ktopl
FROM faglflext AS a INNER JOIN skat AS b ON a~racct = b~saknr AND a~rclnt = b~mandt
CLIENT SPECIFIED INTO CORRESPONDING FIELDS OF TABLE t_itab1
WHERE a~rclnt = sy-mandt
AND a~rbukrs IN p_bukrs
AND a~rldnr = '0L'
AND a~ryear = p_date+0(4)
AND b~spras EQ sy-langu
AND b~ktopl EQ 'CAPI'.
*SI NO ENCUENTRA DATA EN LA TABLA FAGLFLEXT ENVIA EL MENSAJE DE ERROR
*A LA TABLA DE ERROR.
IF sy-subrc <> 0.
MOVE 'No data found in FLAGLFLEXT or ZAVG_BAL_TABLE for this process.'(e01) TO emsg.
* PERFORM call_error_function USING emsg.
* PERFORM call_log_function_send.
MESSAGE: emsg TYPE 'E'.
ENDIF.
*EN ESTE SELECT SACO LA DESCRIPCION DE LA CUENTA
SORT t_itab1 BY racct ASCENDING.
DELETE t_itab1 WHERE racct = ''.
SORT t_itab1 BY prctr ASCENDING.
CLEAR t_itab1.
READ TABLE t_itab1 INTO wa_low INDEX 1 .
DESCRIBE TABLE t_itab1 LINES firstline.
READ TABLE t_itab1 INTO wa_high INDEX firstline.
IF wa_high-prctr = 'DUMMY'. "SI EL ULTIMO RECORD CONTIENE ALGUN 'DUMMY' ESCOJER EL RECORD DE ARRIBA.
firstline = firstline - 1. "CONTIENE EL NUMERO DEL INDICE.
READ TABLE t_itab1 INTO wa_high INDEX firstline.
ENDIF.
profit-sign = 'I'.
profit-option = 'BT'.
profit-low = wa_low-prctr.
profit-high = wa_high-prctr.
APPEND profit.
*COMPUTOS PARA CALCULAR EL ULTIMO DIA DEL MES.
fecha = p_date.
numero_mes = p_date+4(2). "PASO NUMERO DEL MES A VARIABLE.
p_date+4(2) = p_date+4(2) - numero_mes. "LE RESTO EL MISMO MES A LA FECHA PARA COMENZAR EL CONTEO DESDE EL MES 1.
DO numero_mes TIMES. "SE VA A EJECUTAR LAS MISMAS VECES DEL NUMERO DEL MES.
p_date+4(2) = p_date+4(2) + 1. "SE INCREMENTA EL NUMERO DEL MES.
CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH' "Obtiene el ultimo numero del mes.
EXPORTING
day_in = p_date
IMPORTING
last_day_of_month = last_day
EXCEPTIONS
day_in_not_valid = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF fecha = p_date.
fecha = fecha - 1. "le resta a fecha -1 para que busque en la tabla zavg_bal_table el record del dia anterior.
end_month-sign = 'I'.
end_month-option = 'EQ'.
end_month-low = fecha.
APPEND end_month.
ELSE.
end_month-sign = 'I'.
end_month-option = 'EQ'.
end_month-low = last_day.
APPEND end_month.
ENDIF.
ENDDO.
SORT end_month BY low ASCENDING.
SELECT bukrs racct prctr day_a per_day average agregate accumulate average_sap
FROM zavg_bal_table CLIENT SPECIFIED APPENDING TABLE t_zavg
WHERE mandt = sy-mandt
AND bukrs IN p_bukrs
AND day_a <= sy-datum
AND prctr IN profit.
SORT t_itab1 BY rbukrs racct prctr.
SORT t_zavg BY bukrs racct prctr day_a.
*IMPRESION Y ENVIO DE LOS DATOS REQUERIDOS
*Estos If verifican el mes que se esta ejecutando por el usuario para cambiarselo a la variable que identifica el fin de mes.
IF p_date+4(2) = jan_fin+4(2).
jan_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = feb_fin+4(2).
feb_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = mar_fin+4(2).
mar_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = apr_fin+4(2).
apr_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = may_fin+4(2).
may_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = jun_fin+4(2).
jun_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = jul_fin+4(2).
jul_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = aug_fin+4(2).
aug_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = sep_fin+4(2).
sep_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = oct_fin+4(2).
oct_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = nov_fin+4(2).
nov_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = dec_fin+4(2).
dec_fin+6(2) = p_date+6(2).
ENDIF.
*Comienza primer loop en el programa a t_itab1 que es la tabla interna que contiene los datos de faglflext.
LOOP AT t_itab1 INTO wa_itab WHERE racct NE ''.
AT NEW prctr. "Limpia las variables que se muestran en el clear cada ves que comienza un nuevo profit center.
CLEAR: itab_kslvt, itab_ksl01, itab_ksl02, itab_ksl03, itab_ksl04, itab_ksl05, itab_ksl06, itab_ksl07, itab_ksl08,
itab_ksl09, itab_ksl10, itab_ksl11, itab_ksl12, itab_ksl13, itab_ksl14, itab_ksl15, itab_ksl16,
itab_bal00, itab_bal01, itab_bal02, itab_bal03, itab_bal04, itab_bal05, itab_bal06, itab_bal07,
itab_bal08, itab_bal09, itab_bal10, itab_bal11, itab_bal12, itab_bal13, itab_bal14, itab_bal15,
itab_bal16.
ENDAT.
*Se le pasa a la variable itab_ksl## el valor del mes que contenga flext.
itab_kslvt = itab_kslvt + wa_itab-kslvt. itab_ksl01 = itab_ksl01 + wa_itab-ksl01. itab_ksl02 = itab_ksl02 + wa_itab-ksl02.
itab_ksl03 = itab_ksl03 + wa_itab-ksl03. itab_ksl04 = itab_ksl04 + wa_itab-ksl04.
itab_ksl05 = itab_ksl05 + wa_itab-ksl05. itab_ksl06 = itab_ksl06 + wa_itab-ksl06.
itab_ksl07 = itab_ksl07 + wa_itab-ksl07. itab_ksl08 = itab_ksl08 + wa_itab-ksl08.
itab_ksl09 = itab_ksl09 + wa_itab-ksl09. itab_ksl10 = itab_ksl10 + wa_itab-ksl10.
itab_ksl11 = itab_ksl11 + wa_itab-ksl11. itab_ksl12 = itab_ksl12 + wa_itab-ksl12.
itab_ksl13 = itab_ksl13 + wa_itab-ksl13. itab_ksl14 = itab_ksl14 + wa_itab-ksl14.
itab_ksl15 = itab_ksl15 + wa_itab-ksl15. itab_ksl16 = itab_ksl16 + wa_itab-ksl16.
*En estas variables va acumulando el valor por mes. Osea, va sumando todo lo que tenga de ese mes por profit center. Al venir un profit
*nuevo esta se limpia.
itab_bal00 = itab_bal00 + wa_itab-kslvt. itab_bal01 = itab_bal01 + wa_itab-ksl01. itab_bal02 = itab_bal02 + wa_itab-ksl02.
itab_bal03 = itab_bal03 + wa_itab-ksl03. itab_bal04 = itab_bal04 + wa_itab-ksl04.
itab_bal05 = itab_bal05 + wa_itab-ksl05. itab_bal06 = itab_bal06 + wa_itab-ksl06.
itab_bal07 = itab_bal07 + wa_itab-ksl07. itab_bal08 = itab_bal08 + wa_itab-ksl08.
itab_bal09 = itab_bal09 + wa_itab-ksl09. itab_bal10 = itab_bal10 + wa_itab-ksl10.
itab_bal11 = itab_bal11 + wa_itab-ksl11. itab_bal12 = itab_bal12 + wa_itab-ksl12.
itab_bal13 = itab_bal13 + wa_itab-ksl13. itab_bal14 = itab_bal14 + wa_itab-ksl14.
itab_bal15 = itab_bal15 + wa_itab-ksl15. itab_bal16 = itab_bal16 + wa_itab-ksl16.
ryear = wa_itab-ryear.
CLEAR t_zavg.
sy-subrc = 0.
numero_de_cta = wa_itab-racct.
company_code = wa_itab-rbukrs.
profit_center = wa_itab-prctr.
currency_code = wa_itab-rtcur.
descripcion = wa_itab-txt20.
*Segundo loop a realizarce. Este utiliza la tabla interna: t_zavg la cual contiene los datos extraidos de zavg_bal_table.
LOOP AT t_zavg INTO wa_zavg WHERE bukrs = wa_itab-rbukrs AND racct = wa_itab-racct AND prctr = wa_itab-prctr.
AT NEW prctr. "Al cambiar el profit center limpia las variables que se encuentran en el clear.
CLEAR: average_month_01, average_month_02, average_month_03, average_month_04, average_month_05,
average_month_06, average_month_07, average_month_08, average_month_09, average_month_10, average_month_11,
average_month_12, average_month.
ENDAT.
*Dependiendo del mes que contiene el record de la tabla t_zavg este va acumulando el average_month.
IF wa_zavg-day_a+4(2) = '01'.
average_month_01 = average_month_01 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '02'.
average_month_02 = average_month_02 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '03'.
average_month_03 = average_month_03 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '04'.
average_month_04 = average_month_04 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '05'.
average_month_05 = average_month_05 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '06'.
average_month_06 = average_month_06 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '07'.
average_month_07 = average_month_07 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '08'.
average_month_08 = average_month_08 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '09'.
average_month_09 = average_month_09 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '10'.
average_month_10 = average_month_10 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '11'.
average_month_11 = average_month_11 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '12'.
average_month_12 = average_month_12 + wa_zavg-accumulate.
ENDIF.
*Este if verifica que cuando el record que se esta verificando sea con fecha de fin de mes calcule el resto del codigo que se encuentra debajo.
IF wa_zavg-day_a = jan_fin OR wa_zavg-day_a = feb_fin OR wa_zavg-day_a = mar_fin OR wa_zavg-day_a = apr_fin OR wa_zavg-day_a = may_fin OR wa_zavg-day_a = jun_fin OR
wa_zavg-day_a = jul_fin OR wa_zavg-day_a = aug_fin OR wa_zavg-day_a = sep_fin OR wa_zavg-day_a = oct_fin OR
wa_zavg-day_a = nov_fin OR wa_zavg-day_a = dec_fin.
aggregate_month = wa_zavg-agregate.
day_a = wa_zavg-day_a.
*Calcula el aggregate_month dependiendo de la fecha del record que se esta procesando.
IF wa_zavg-day_a+4(2) = '01'.
aggregate_month_01 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '02'.
aggregate_month_02 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '03'.
aggregate_month_03 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '04'.
aggregate_month_04 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '05'.
aggregate_month_05 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '06'.
aggregate_month_06 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '07'.
aggregate_month_07 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '08'.
aggregate_month_08 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '09'.
aggregate_month_09 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '10'.
aggregate_month_10 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '11'.
aggregate_month_11 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '12'.
aggregate_month_12 = wa_zavg-agregate.
ENDIF.
ENDIF.
*Este if verifica que cuando el record que se esta verificando sea con fecha de fin de mes calcule el resto del codigo que se encuentra debajo.
IF wa_zavg-day_a+4(4) = jan_fin+4(4) OR wa_zavg-day_a+4(4) = feb_fin+4(4) OR wa_zavg-day_a+4(4) = febb_fin+4(4) OR wa_zavg-day_a+4(4) = mar_fin+4(4) OR
wa_zavg-day_a+4(4) = apr_fin+4(4) OR wa_zavg-day_a+4(4) = may_fin+4(4) OR wa_zavg-day_a+4(4) = jun_fin+4(4) OR wa_zavg-day_a+4(4) = jul_fin+4(4) OR
wa_zavg-day_a+4(4) = aug_fin+4(4) OR wa_zavg-day_a+4(4) = sep_fin+4(4) OR wa_zavg-day_a+4(4) = oct_fin+4(4) OR wa_zavg-day_a+4(4) = nov_fin+4(4) OR
wa_zavg-day_a+4(4) = dec_fin+4(4).
*Calcula la division entre la cantidad acumulada por mes y la fecha del fin de mes.
IF average_month_01 IS NOT INITIAL.
porciento1 = average_month_01 / jan_fin+6(2).
average_month = porciento1.
ENDIF.
IF average_month_02 IS NOT INITIAL.
porciento2 = average_month_02 / feb_fin+6(2).
average_month = porciento2.
ENDIF.
IF average_month_03 IS NOT INITIAL.
porciento3 = average_month_03 / mar_fin+6(2).
average_month = porciento3.
ENDIF.
IF average_month_04 IS NOT INITIAL.
porciento4 = average_month_04 / apr_fin+6(2).
average_month = porciento4.
ENDIF.
IF average_month_05 IS NOT INITIAL.
porciento5 = average_month_05 / may_fin+6(2).
average_month = porciento5.
ENDIF.
IF average_month_06 IS NOT INITIAL.
porciento6 = average_month_06 / jun_fin+6(2).
average_month = porciento6.
ENDIF.
IF average_month_07 IS NOT INITIAL.
porciento7 = average_month_07 / jul_fin+6(2).
average_month = porciento7.
ENDIF.
IF average_month_08 IS NOT INITIAL.
porciento8 = average_month_08 / aug_fin+6(2).
average_month = porciento8.
ENDIF.
IF average_month_09 IS NOT INITIAL.
porciento9 = average_month_09 / sep_fin+6(2).
average_month = porciento9.
ENDIF.
IF average_month_10 IS NOT INITIAL.
porciento10 = average_month_10 / oct_fin+6(2).
average_month = porciento10.
ENDIF.
IF average_month_11 IS NOT INITIAL.
porciento11 = average_month_11 / nov_fin+6(2).
average_month = porciento11.
ENDIF.
IF average_month_12 IS NOT INITIAL.
porciento12 = average_month_12 / dec_fin+6(2).
average_month = porciento12.
ENDIF.
*Cuando la fecha que esta entrando el usuario es la misma a la del record que se esta procesando en ese momento ejecuta el siguiente IF.
IF p_date+4(4) = wa_zavg-day_a+4(4).
current_average_balance = average_month.
current_aggregate_balance = aggregate_month.
average_balance_ytd = average_month.
ENDIF.
ENDIF.
ENDLOOP.
AT END OF prctr.
IF sy-subrc = 0.
*ESTAS VARIABLES SE ESTAN PASANDO A UNA VARIABLE NORMAL YA QUE SI SE DEJAN DENTRO DEL WORK AREA (WA) LE PONE ASTERISCOS.
*LOS IF QUE SE DEMUESTRAN ABAJO SON PARECIDOS A LOS UTILIZADOS EN LA *
*PARTE POSTERIOR LO UNICO QUE LA FECHA UTILIZADA NO ES EXTRAIDA DE LA *
*TABLA, ES LA QUE EL USUARIO INSERTA DENTRO DEL PARAMETRO. *
IF p_date+4(2) >= '01'.
COMPUTE: balance_month_01 = itab_bal00 + itab_bal01.
ENDIF.
IF p_date+4(2) >= '02'.
COMPUTE: balance_month_02 = itab_bal00 + itab_bal01 + itab_bal02.
ENDIF.
IF p_date+4(2) >= '03'.
COMPUTE: balance_month_03 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03.
ENDIF.
IF p_date+4(2) >= '04'.
COMPUTE: balance_month_04 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04.
ENDIF.
IF p_date+4(2) >= '05'.
COMPUTE: balance_month_05 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05.
ENDIF.
IF p_date+4(2) >= '06'.
COMPUTE: balance_month_06 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06.
ENDIF.
IF p_date+4(2) >= '07'.
COMPUTE: balance_month_07 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07.
ENDIF.
IF p_date+4(2) >= '08'.
COMPUTE: balance_month_08 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08.
ENDIF.
IF p_date+4(2) >= '09'.
COMPUTE: balance_month_09 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09.
ENDIF.
IF p_date+4(2) >= '10'.
COMPUTE: balance_month_10 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10.
ENDIF.
IF p_date+4(2) >= '11'.
COMPUTE: balance_month_11 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11.
ENDIF.
IF p_date+4(2) >= '12'.
COMPUTE: balance_month_12 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11 + itab_bal12.
ENDIF.
IF p_date+4(2) >= '13'.
COMPUTE: balance_month_13 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11 + itab_bal12 + itab_bal13.
ENDIF.
COMPUTE: current_balance = + itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11 + itab_bal12 + itab_bal13 + itab_bal14 + itab_bal15 + itab_bal16.
*Computo para el activity balance.
IF p_date+4(2) = '01'.
current_activity_balance = itab_ksl01.
ENDIF.
IF p_date+4(2) = '02'.
current_activity_balance = itab_ksl02.
ENDIF.
IF p_date+4(2) = '03'.
current_activity_balance = itab_ksl03.
ENDIF.
IF p_date+4(2) = '04'.
current_activity_balance = itab_ksl04.
ENDIF.
IF p_date+4(2) = '05'.
current_activity_balance = itab_ksl05.
ENDIF.
IF p_date+4(2) = '06'.
current_activity_balance = itab_ksl06.
ENDIF.
IF p_date+4(2) = '07'.
current_activity_balance = itab_ksl07.
ENDIF.
IF p_date+4(2) = '08'.
current_activity_balance = itab_ksl08.
ENDIF.
IF p_date+4(2) = '09'.
current_activity_balance = itab_ksl09.
ENDIF.
IF p_date+4(2) = '10'.
current_activity_balance = itab_ksl10.
ENDIF.
IF p_date+4(2) = '11'.
current_activity_balance = itab_ksl11.
ENDIF.
IF p_date+4(2) = '12'.
current_activity_balance = itab_ksl12.
ENDIF.
*LE RESTA 1 AL AÑO CORRIENTE PARA VERIFICAR LUEGO SI EXISTE INFORMACION*
*DE AÑOS ANTERIORES. *
ano = ryear - 1.
* Get the values of the past year. *
ano = p_date+0(4) - 1.
IF ryear = ano.
wa_msgdetails-activity_previous_year = itab_ksl12.
* balance_previous_year = wa_msgdetails-balance_previous_year. *
wa_msgdetails-average_previous_year = average_month_12.
wa_msgdetails-aggreg_previous_year = aggregate_month_12.
ELSE.
*If the table don't have data the variables get '0000000000000'. *
wa_msgdetails-activity_previous_year = '00000000000000.00'.
wa_msgdetails-average_previous_year = '00000000000000.00'.
wa_msgdetails-aggreg_previous_year = '00000000000000.00'.
AT LAST.
wa_msgdetails-balance_previous_year = '00000000000000.00'.
wa_msgdetails-balance_previous_year = itab_kslvt +
itab_ksl01 +
itab_ksl02 +
itab_ksl03 +
itab_ksl04 +
itab_ksl05 +
itab_ksl06 +
itab_ksl07 +
itab_ksl08 +
itab_ksl09 +
itab_ksl10 +
itab_ksl11 +
itab_ksl12.
ENDAT.
ENDIF.
wa_msgdetails-account = numero_de_cta.
wa_msgdetails-company = company_code.
wa_msgdetails-cost_center = profit_center.
wa_msgdetails-currency_code = currency_code.
wa_msgdetails-account_description = descripcion.
wa_msgdetails-activity_month_01 = itab_ksl01.
wa_msgdetails-average_month_01 = porciento1.
wa_msgdetails-aggreg_month_01 = aggregate_month_01.
wa_msgdetails-activity_month_02 = itab_ksl02.
wa_msgdetails-average_month_02 = porciento2.
wa_msgdetails-aggreg_month_02 = aggregate_month_02.
wa_msgdetails-activity_month_03 = itab_ksl03.
wa_msgdetails-average_month_03 = porciento3.
wa_msgdetails-aggreg_month_03 = aggregate_month_03.
wa_msgdetails-activity_month_04 = itab_ksl04.
wa_msgdetails-average_month_04 = porciento4.
wa_msgdetails-aggreg_month_04 = aggregate_month_04.
wa_msgdetails-activity_month_05 = itab_ksl05.
wa_msgdetails-average_month_05 = porciento5.
wa_msgdetails-aggreg_month_05 = aggregate_month_05.
wa_msgdetails-activity_month_06 = itab_ksl06.
wa_msgdetails-average_month_06 = porciento6.
wa_msgdetails-aggreg_month_06 = aggregate_month_06.
wa_msgdetails-activity_month_07 = itab_ksl07.
wa_msgdetails-average_month_07 = porciento7.
wa_msgdetails-aggreg_month_07 = aggregate_month_07.
wa_msgdetails-activity_month_08 = itab_ksl08.
wa_msgdetails-average_month_08 = porciento8.
wa_msgdetails-aggreg_month_08 = aggregate_month_08.
wa_msgdetails-activity_month_09 = itab_ksl09.
wa_msgdetails-average_month_09 = porciento9.
wa_msgdetails-aggreg_month_09 = aggregate_month_09.
wa_msgdetails-activity_month_10 = itab_ksl10.
wa_msgdetails-average_month_10 = porciento10.
wa_msgdetails-aggreg_month_10 = aggregate_month_10.
wa_msgdetails-activity_month_11 = itab_ksl11.
wa_msgdetails-average_month_11 = porciento11.
wa_msgdetails-aggreg_month_11 = aggregate_month_11.
wa_msgdetails-activity_month_12 = itab_ksl12.
wa_msgdetails-average_month_12 = porciento12.
wa_msgdetails-aggreg_month_12 = aggregate_month_12.
wa_msgdetails-activity_month_13 = itab_ksl13.
wa_msgdetails-average_month_13 = '00000000000000.00'.
wa_msgdetails-aggreg_month_13 = '00000000000000.00'.
wa_msgdetails-balance_month_01 = balance_month_01.
wa_msgdetails-balance_month_02 = balance_month_02.
wa_msgdetails-balance_month_03 = balance_month_03.
wa_msgdetails-balance_month_04 = balance_month_04.
wa_msgdetails-balance_month_05 = balance_month_05.
wa_msgdetails-balance_month_06 = balance_month_06.
wa_msgdetails-balance_month_07 = balance_month_07.
wa_msgdetails-balance_month_08 = balance_month_08.
wa_msgdetails-balance_month_09 = balance_month_09.
wa_msgdetails-balance_month_10 = balance_month_10.
wa_msgdetails-balance_month_11 = balance_month_11.
wa_msgdetails-balance_month_12 = balance_month_12.
wa_msgdetails-balance_month_13 = balance_month_13.
wa_msgdetails-current_balance = current_balance.
wa_msgdetails-current_activity_balance = current_activity_balance.
CLEAR: porciento1, porciento2, porciento3, porciento4, porciento5, porciento6, porciento7, porciento8, porciento9, porciento10, porciento11,
porciento12, average_month.
*se multiplican las siguientes variables que contienen cantidades por -1 cuando el primer numero de la cta. es igual a
* 5, 6, 7, ó 8.
IF numero_de_cta+4(1) = '5' OR numero_de_cta+4(1) = '6' OR numero_de_cta+4(1) = '7' OR numero_de_cta+4(1) = '8'.
IF wa_msgdetails-current_balance IS NOT INITIAL.
wa_msgdetails-current_balance = wa_msgdetails-current_balance * -1.
ENDIF.
IF wa_msgdetails-activity_previous_year IS NOT INITIAL.
wa_msgdetails-activity_previous_year = wa_msgdetails-activity_previous_year * -1.
ENDIF.
IF wa_msgdetails-average_previous_year IS NOT INITIAL.
wa_msgdetails-average_previous_year = wa_msgdetails-average_previous_year * -1.
ENDIF.
IF wa_msgdetails-aggreg_previous_year IS NOT INITIAL.
wa_msgdetails-aggreg_previous_year = wa_msgdetails-aggreg_previous_year * -1.
ENDIF.
IF wa_msgdetails-balance_previous_year IS NOT INITIAL.
wa_msgdetails-balance_previous_year = wa_msgdetails-balance_previous_year * -1.
ENDIF.
IF wa_msgdetails-current_activity_balance IS NOT INITIAL.
wa_msgdetails-current_activity_balance = wa_msgdetails-current_activity_balance * -1.
ENDIF.
IF wa_msgdetails-activity_month_01 IS NOT INITIAL.
wa_msgdetails-activity_month_01 = wa_msgdetails-activity_month_01 * -1.
ENDIF.
IF wa_msgdetails-balance_month_01 IS NOT INITIAL.
wa_msgdetails-balance_month_01 = wa_msgdetails-balance_month_01 * -1.
ENDIF.
IF wa_msgdetails-average_month_01 IS NOT INITIAL.
wa_msgdetails-average_month_01 = wa_msgdetails-average_month_01 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_01 IS NOT INITIAL.
wa_msgdetails-aggreg_month_01 = wa_msgdetails-aggreg_month_01 * -1.
ENDIF.
IF wa_msgdetails-activity_month_02 IS NOT INITIAL.
wa_msgdetails-activity_month_02 = wa_msgdetails-activity_month_02 * -1.
ENDIF.
IF wa_msgdetails-balance_month_02 IS NOT INITIAL.
wa_msgdetails-balance_month_02 = wa_msgdetails-balance_month_02 * -1.
ENDIF.
IF wa_msgdetails-average_month_02 IS NOT INITIAL.
wa_msgdetails-average_month_02 = wa_msgdetails-average_month_02 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_02 IS NOT INITIAL.
wa_msgdetails-aggreg_month_02 = wa_msgdetails-aggreg_month_02 * -1.
ENDIF.
IF wa_msgdetails-activity_month_03 IS NOT INITIAL.
wa_msgdetails-activity_month_03 = wa_msgdetails-activity_month_03 * -1.
ENDIF.
IF wa_msgdetails-balance_month_03 IS NOT INITIAL.
wa_msgdetails-balance_month_03 = wa_msgdetails-balance_month_03 * -1.
ENDIF.
IF wa_msgdetails-average_month_03 IS NOT INITIAL.
wa_msgdetails-average_month_03 = wa_msgdetails-average_month_03 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_03 IS NOT INITIAL.
wa_msgdetails-aggreg_month_03 = wa_msgdetails-aggreg_month_03 * -1.
ENDIF.
IF wa_msgdetails-activity_month_04 IS NOT INITIAL.
wa_msgdetails-activity_month_04 = wa_msgdetails-activity_month_04 * -1.
ENDIF.
IF wa_msgdetails-balance_month_04 IS NOT INITIAL.
wa_msgdetails-balance_month_04 = wa_msgdetails-balance_month_04 * -1.
ENDIF.
IF wa_msgdetails-average_month_04 IS NOT INITIAL.
wa_msgdetails-average_month_04 = wa_msgdetails-average_month_04 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_04 IS NOT INITIAL.
wa_msgdetails-aggreg_month_04 = wa_msgdetails-aggreg_month_04 * -1.
ENDIF.
IF wa_msgdetails-activity_month_05 IS NOT INITIAL.
wa_msgdetails-activity_month_05 = wa_msgdetails-activity_month_05 * -1.
ENDIF.
IF wa_msgdetails-balance_month_05 IS NOT INITIAL.
wa_msgdetails-balance_month_05 = wa_msgdetails-balance_month_05 * -1.
ENDIF.
IF wa_msgdetails-average_month_05 IS NOT INITIAL.
wa_msgdetails-average_month_05 = wa_msgdetails-average_month_05 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_05 IS NOT INITIAL.
wa_msgdetails-aggreg_month_05 = wa_msgdetails-aggreg_month_05 * -1.
ENDIF.
IF wa_msgdetails-activity_month_06 IS NOT INITIAL.
wa_msgdetails-activity_month_06 = wa_msgdetails-activity_month_06 * -1.
ENDIF.
IF wa_msgdetails-balance_month_06 IS NOT INITIAL.
wa_msgdetails-balance_month_06 = wa_msgdetails-balance_month_06 * -1.
ENDIF.
IF wa_msgdetails-average_month_06 IS NOT INITIAL.
wa_msgdetails-average_month_06 = wa_msgdetails-average_month_06 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_06 IS NOT INITIAL.
wa_msgdetails-aggreg_month_06 = wa_msgdetails-aggreg_month_06 * -1.
ENDIF.
IF wa_msgdetails-activity_month_07 IS NOT INITIAL.
wa_msgdetails-activity_month_07 = wa_msgdetails-activity_month_07 * -1.
ENDIF.
IF wa_msgdetails-balance_month_07 IS NOT INITIAL.
wa_msgdetails-balance_month_07 = wa_msgdetails-balance_month_07 * -1.
ENDIF.
IF wa_msgdetails-average_month_07 IS NOT INITIAL.
wa_msgdetails-average_month_07 = wa_msgdetails-average_month_07 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_07 IS NOT INITIAL.
wa_msgdetails-aggreg_month_07 = wa_msgdetails-aggreg_month_07 * -1.
ENDIF.
IF wa_msgdetails-activity_month_08 IS NOT INITIAL.
wa_msgdetails-activity_month_08 = wa_msgdetails-activity_month_08 * -1.
ENDIF.
IF wa_msgdetails-balance_month_08 IS NOT INITIAL.
wa_msgdetails-balance_month_08 = wa_msgdetails-balance_month_08 * -1.
ENDIF.
IF wa_msgdetails-average_month_08 IS NOT INITIAL.
wa_msgdetails-average_month_08 = wa_msgdetails-average_month_08 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_08 IS NOT INITIAL.
wa_msgdetails-aggreg_month_08 = wa_msgdetails-aggreg_month_08 * -1.
ENDIF.
IF wa_msgdetails-activity_month_09 IS NOT INITIAL.
wa_msgdetails-activity_month_09 = wa_msgdetails-activity_month_09 * -1.
ENDIF.
IF wa_msgdetails-balance_month_09 IS NOT INITIAL.
wa_msgdetails-balance_month_09 = wa_msgdetails-balance_month_09 * -1.
ENDIF.
IF wa_msgdetails-average_month_09 IS NOT INITIAL.
wa_msgdetails-average_month_09 = wa_msgdetails-average_month_09 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_09 IS NOT INITIAL.
wa_msgdetails-aggreg_month_09 = wa_msgdetails-aggreg_month_09 * -1.
ENDIF.
IF wa_msgdetails-activity_month_10 IS NOT INITIAL.
wa_msgdetails-activity_month_10 = wa_msgdetails-activity_month_10 * -1.
ENDIF.
IF wa_msgdetails-balance_month_10 IS NOT INITIAL.
wa_msgdetails-balance_month_10 = wa_msgdetails-balance_month_10 * -1.
ENDIF.
IF wa_msgdetails-average_month_10 IS NOT INITIAL.
wa_msgdetails-average_month_10 = wa_msgdetails-average_month_10 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_10 IS NOT INITIAL.
wa_msgdetails-aggreg_month_10 = wa_msgdetails-aggreg_month_10 * -1.
ENDIF.
IF wa_msgdetails-activity_month_11 IS NOT INITIAL.
wa_msgdetails-activity_month_11 = wa_msgdetails-activity_month_11 * -1.
ENDIF.
IF wa_msgdetails-balance_month_11 IS NOT INITIAL.
wa_msgdetails-balance_month_11 = wa_msgdetails-balance_month_11 * -1.
ENDIF.
IF wa_msgdetails-average_month_11 IS NOT INITIAL.
wa_msgdetails-average_month_11 = wa_msgdetails-average_month_11 *Hi,
Are the month-ends (jan_fin etc) stored in the system? There are many variable declarations and if statements that could probably be eliminated if that is the case. More efficient use of storing those variables in internal tables so that the data is only used when needed.
Warren -
Huge problems with Programs crashing on quit!!
Is anyone else having an issue with programs like Logic Pro 8, Firefox and other widely used programs that crash when you do a command-q to quit?
Mine does this all the time. I have re-installed Snow Leopard 3 times now. I have re-installed all my programs I use fresh as well, yet almost every program I close locks up the machine or just sits there and does nothing at all.
I am beginning to think I have a hardware issue on my new iMac.UncleMarcus wrote:
Is anyone else having an issue with programs like Logic Pro 8, Firefox and other widely used programs that crash when you do a command-q to quit?
no.
Mine does this all the time. I have re-installed Snow Leopard 3 times now.
did you do an erase and install or did you install snow leopard on top of your current install? if the latter make a new user account and log into it. do you have the same problem there? if you did do an erase and install then it may be hardware related as you suspect.
I have re-installed all my programs I use fresh as well, yet almost every program I close locks up the machine or just sits there and does nothing at all.
I am beginning to think I have a hardware issue on my new iMac. -
Hi,
Im executing RSEOUT00 to process all outbound idocs with status 30. The problem is if I only have one idoc to be processed, the status remains 30 while if I have for example 5 outbound idocs, all idocs EXCEPT the last are processed. Processed Idocs would have status 03.
How come this report does not process the last IDOC? Is this a problem with selection parameters?
Thanks in advance.
Kenny
Message was edited by:
Kenny MartinezHi kenny,
What selection parameters you have given on screen?
You can give idoc number or time of change or msg type or execute in background setting some variants...
There is no chance to leave the last idoc unprocessed.
Try to execute once again.
There might b a chance, when you execute the program,last idoc might not be created.
Regards,
Ponraj.s. -
Problem with downloading photos errer code 1
problems with error code 1 when downloadind photos
Not enough information to help you. That error code isn't from Firefox which uses 3 digit codes. What website is that? And. are you downloading '''''from''''' a website, or uploading '''''to''''' a website?
-
SQL Developer 3 EA2 - Problem with formating plsql source code
I'm using sql developer 3 ea2. I have played with source code formating.
I have 2 issues with formating in source code editor.
I have a plsql string like the following extending over several lines.
s VARCHAR2(2000) := 'SELECT
col1, col2, col3
FROM table
WHERE col4 = :var';The result after apply "format" to my sourcecode ist:
s VARCHAR2(2000) := 'SELECT
col1, col2, col3
FROM table
WHERE col4 = :var';The second is that sql developer ist camelizing the previous line if I type a whitespace in plsql sourcecode.
How to switch that off??
The last issue is realy annoying!
ChristianI am having exactly the same problem. Every time you use Format Ctrl/F7 it adds new line feeds. Code starts off as:
command := '
select account_status, default_tablespace, temporary_tablespace,
to_char(created,"YYYY-MON-DD HH24:MI:SS"), profile
from Dba_Users@@
where username=:1' ;
First Format Ctrl/F7 get an extra blank line:
command := '
select account_status, default_tablespace, temporary_tablespace,
to_char(created,"YYYY-MON-DD HH24:MI:SS"), profile
from Dba_Users@@
where username=:1' ;
Then second Format Ctrl/F7, get THREE extra lines!!! It goes exponential!!
command := '
select account_status, default_tablespace, temporary_tablespace,
to_char(created,"YYYY-MON-DD HH24:MI:SS"), profile
from Dba_Users@@
where username=:1' ;
So far I've only really encountered the problem with dynamic SQL, which ignores the extra line feeds.
i am pretty sure this is a long standing SqlDeveloper Format problem, going back to V2. -
Problem with Web Service Model code generation
Hello,
I'm importing two different web services into the same web dynpro component, which both contains properties "allGroup2" of type "All2".
This causes some problems with the code generation, first of all the Model-classes can't be generated because they don't know which of the two All2-classes to use. If I fix that problem (which can be easily done by adding the correct import statement) I still can't use the models in my web dynpro component, since it too doesn't know which of the All2-classes to use.
Even though I can fix this by adding imports and fixing the code, it of course gets regenerated next time I rebuild the project, and my changes are lost.
Does anyone know how to solve this?Apparently this is a known bug which is fixed in SP15.
Regards mattias -
Fixed a problem with OSX-Logic and a MOTU 828MkII
I was having problems with my 828MkII using it with a new G5 and OS10.3.9. There were massive drop-outs.
It was a new computer and everything was installed correctly and cleanly - there was no other hardware installed other than the MOTU, and no other software other than Logic 7 - everything was done properly and tested over and over, but the problem persisted.
I still had my old G4 with an older OS9 version of Logic, and when I went back to try the MOTU with this set up, it worked flawlessly. This fact made me suspect that the core audio driver was the problem, so I tried all the tricks I've seen in forums - reset the MOTU - uninstalled and re-installed. Upgraded my firmware. Even tried OS10.4 with old drivers new drivers, and still nothing worked.
Then out of desperation I tried a new firewire cable and everything worked fine.
I went back and tried the set up on my OS9 machine a few times and the MOTU worked flawlessly under the Asio2 drivers. What I learned is that OSX and core audio must use firewire differently because the cable did not work with that set up.
I couldn't believe it. It's like finding out that a guitar cable only works with a Les Paul or something wierd like that.
I'm sure someone out there must know the technical difference and why this cable works fine under OS9 (Asio2) but not OSX (core audio).
I'm posting this because if I had read such a post - I would have tried a new cable as the first thing - but I had myself convinced that it could not be the cable. I still don't believe it. ! Luckily it was the cheapest fix.
Scott.Same thing happened here when I check all items to install at once.
After the installation failure , L7,L8,Waveburner .. everything unexpectedly quit then I decided to replace the entire OS to cloned back up.
I tried the installation again and xxxx happened again. This time, I installed only applications (overwritten) again and it fixed the problem.
Then I installed only JamPack on FW and went smoothly.
I called Apple Tech and now I am waiting for the new installer DVDs of Audio contents only by regular mail.
Hey, do we have similar serial number?? Apple script got damaged or something? I have no idea.
Maybe you are looking for
-
Time Capsule can't seem to recognize my HP DeskJet 5550?
My HP DeskJet 5550 is supposedly on the list of supported printers for wireless printing when connected to my Time Capsule's USB port, but for some reason it refuses to recognize the printer. I have tried restarting both machines, going through both
-
Denying system.exit in java code
My objective is to nullifying the system.exit programmed. By goggling i learn t that this can be done by adding permission in policy file. But as far my google search i dont understand how to deny a permission. Most of them says about granting a perm
-
Will play count and playhead position sync back to iTunes?
I have a bunch of smart playlists that contain all the unplayed episodes of my favorite podcasts. If I drag these onto the Shuffle, will the play count and playhead position from my Shuffle sync back to iTunes? It seems like the answer is no -- this
-
Document Distribution Automation
SAP-DMS Expert in Document Management System there is Document Distribution process i know whole process of Document Distribution , but it is manual process i want to Automated it , How can i ??? point rewarded
-
Go0gle toolbar is listed in VIEW and space opens but no toolbar appears
It disappeared spontaneously and, even though it is listed under VIEW and space opens it will not appear.