Specify program logic at runtime
Hi,
I have this requirement where the program logic is specified at runtime. My class is fairly complete except that few variables are to be created and set at runtime. Also I need to evaluate an expression made up from these created variables.
Any suggestions ?
In case anyone is thinking whats the need for this - I am writing a translator that is going to translate a program written in some language say 'L' to Java. One way is I can output Java code and compile and run it. But this leaves me with the situation that the users of my application have Java compiler (I can't assume that). Other way is do runtime programming - create required variables, expressions on the fly and evaluate them at runtime.
Thanks,
Taran
tasingh wrote:
I was looking for some framework or at least a design pattern hmmm,.. Strategy ?
Similar Messages
-
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.
nullHere'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 -
Program/Logic behind the Copy functionality in SE38 Transaction
Hi,
In SE38 by using the copy option, Program along with sub-objects can be copied to another object.
Please let me know the Program/Logic behind that functionality.
Also let me know is there any option in SAP to copy program from one system to another system.
Thanks,
Madhuri.Hi Madhuri
This is tha Program logic behind copying object thru se38
where p_operation would have the value 'COPY'' in it.
Ā DATA: l_request TYPE REF TO cl_wb_request,
Ā Ā Ā Ā Ā Ā Ā l_wb_todo_request TYPE REF TO cl_wb_request,
Ā Ā Ā Ā Ā Ā Ā l_object_name TYPE seu_objkey,
Ā Ā Ā Ā Ā Ā Ā l_object_type TYPE seu_objtyp,
Ā Ā Ā Ā Ā Ā Ā l_program_state TYPE REF TO cl_wb_program_state.
Ā IF trdir-subc = 'I'.
Ā Ā Ā l_object_type = swbm_c_type_prg_include.
Ā Ā Ā CALL METHOD cl_wb_object_type=>get_concatenated_key_from_id
Ā Ā Ā Ā Ā EXPORTING
Ā Ā Ā Ā Ā Ā Ā p_key_component1 = space
Ā Ā Ā Ā Ā Ā Ā p_key_component2 = rs38m-programm
Ā Ā Ā Ā Ā Ā Ā p_external_idĀ Ā Ā = l_object_type
Ā Ā Ā Ā Ā RECEIVING
Ā Ā Ā Ā Ā Ā Ā p_keyĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā = l_object_name.
Ā ELSE.
Ā Ā Ā l_object_type = swbm_c_type_prg_source.
Ā Ā Ā l_object_name = rs38m-programm.
Ā ENDIF.
Ā CREATE OBJECT l_program_state.
Ā CREATE OBJECT l_request
Ā Ā Ā Ā Ā EXPORTING p_object_type =Ā l_object_type
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā p_object_name = l_object_name
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā p_operationĀ Ā = p_operation
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā p_object_state = l_program_state .
Ā CALL METHOD
Ā Ā Ā wb_pgeditor_initial_screen->mngr->request_tool_access
Ā Ā Ā EXPORTING
Ā Ā Ā Ā Ā p_wb_requestĀ Ā Ā Ā Ā = l_request
Ā Ā Ā IMPORTING
Ā Ā Ā Ā Ā p_wb_todo_request = l_wb_todo_request
Ā Ā Ā EXCEPTIONS
Ā Ā Ā Ā Ā action_cancelledĀ = 1
Ā Ā Ā Ā Ā no_tool_foundĀ Ā Ā Ā = 2.
Ā IF sy-subrc NE 0.
Ā Ā Ā MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
Ā ELSE.
Ā Ā Ā EXIT.
Ā ENDIF. -
Programming Logic required for pulling the records for past month /week
Hi All
I need help in the SQL programming logic.
Oracle Database Version: 10.2.0.3.0
Requirement
In a data warehouse environment, I need to programme for weekly and monthly automated batch jobs to insert the data from Data_tbl to Reporting_tbl for generating reports. Tables descriptions are given below.
Table1 - Data_tbl (Source table āthis table gets updated everyday).
Record_dtĀ Ā Ā Ā Ā first_nameĀ Ā Ā Ā Ā last_name
Table2 - Reporting_tbl_(Target table)
Cycle_dtĀ Ā Ā Ā Ā first_nameĀ Ā Ā Ā Ā last_name
1. Monthly Report
In the SQL Query, I have where clause conditionā
Where Record_dt >=ā01-nov-08ā and record_dt<=ā30-nov-08ā
Using the above condition in development, I am pulling the data from source table for the past month data. This will be repeated every month and it should be automated.
i.e., if I run this report any time in dec 2008, it should pick records of dates from Nov 01st to Nov 30th 2008. if I run this report any time in Jan 2009, it should pick records of dates from Dec 01st to Dec 31st 2008.
Date Values should be assigned for past month. Value of Cycle_dt in target table should be end date of past month like 30-nov-2008, 31-dec-2008.
2. Weekly Report
In the SQL Query, I have where clause conditionā
Where Record_dt >=ā01-dec-08ā and record_dt<=ā07-dec-08ā
Here week start day is Monday and end day is Sunday.
If I run the report between Dec 08th to Dec 14th , it should pull records of dates from Dec 01st to Dec 07th 2008.
On Dec 15th, it should pick from Dec 08th to Dec 14th.
Value of Cycle_dt in target table should be end date of past week like 07-Dec-2008, 14-Dec-2008.
Please help me with the logics for both Monthly and Weekly reports.
ThanksHi,
For the monthly report, instead of
Where Record_dt >=ā01-nov-08ā and record_dt<=ā30-nov-08āsay:
WhereĀ Ā Record_dt >= TRUNC (ADD_MONTHS (SYSDATE, -1), 'MM')
andĀ Ā Ā Ā record_dt <Ā TRUNC (SYSDATE, 'MM')SYSDATE is the current DATE.
TRUNC (SYSDATE, 'MM') is the beginning of the current month. (Notice the condition above is less than this date, not equal to it.)
ADD_MONTHS (STSDATE, -1) is a date exactly one month ago, therefore it is in the previous month.
For the weekly report, instead of:
Where Record_dt >=ā01-dec-08ā and record_dt<=ā07-dec-08āsay
WhereĀ Ā Record_dt >= TRUNC (SYSDATE - 7, 'IW')
andĀ Ā Ā Ā record_dt <Ā TRUNC (SYSDATE, 'IW')TRUNC (dt, 'IW') is the beginning of the ISO week (Monday-Sunday) that contains dt. Again, notice the end condition is strictly less than the beginning of the current week. -
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. -
Start j2ee : The system cannot execute the specified program
when im giving "start j2ee" command it says "The system cannot execute the specified program"
can anybody help 4ma studies please?This seems to be related to Security restrictions on running certain types of programs (OS settings).
I am getting the same message when trying to start WebLogic 7 (using java.exe). I am waiting on the System Admins to let me know if there are any restrictions set by the OS or the Security Policies. -
Integration of PLC(programming logic unit) in SAP
i'm facing problem with this, our client is using PLC (programming logic unit) for there manufacturing ,so with out third part tool how can we integrate in SAP plz any one can help
kishore.
i am just throwing ideas now, its impossible to debug over forum.Ā
go ahead and just check all switches between qa and prod in OOAC, confirm they are all the same,
check OOSB - check that the user profile is in both environments, with same dates, and eval paths (display objects).
DFCON = 1 means Deny 99999999, but Evaluate Organizational Unit (if available).Ā Check if there are any differences in IT0001 of the org unit ids, in production perphas Org unit ID is not filled on the record where position is = 99999999.Ā
in general your team should review this link:Ā http://help.sap.com/saphelp_47x200/helpdata/en/56/db5bc71a64c94f9f2e3cb63e14c867/content.htm
review orgpd switch as well:Ā
http://help.sap.com/saphelp_47x200/helpdata/en/c7/4aba3b3bf00152e10000000a114084/content.htm
review how org key works (different than org ID previously mentioned):
http://help.sap.com/saphelp_47x200/helpdata/en/7f/1a7d3c8015d10ee10000000a11405a/frameset.htm
run this in both qa and production.Ā check transaction oosb after as well.Ā
1) Call program RHBAUS02 for uploading Table T77UU and enter users.
2) Call program RHBAUUS00 for generating an index for structural authorization profile -
I want help in one programming logic.For that I make small example ,so that can explain clearly.
public class Mainclass //(situated in package view)
public s0,s1;
public void runFunction()
...some coding and proceedings
s0="Hi";s1"Hello";
......some coding
public MainRunner
public static void main(String a[])
Mainclass m=new Mainclass();
m.runFunction();
public MainUser (situated in package Master)
public static void main(String a[])
Mainclass m=new Mainclass();
System.out.println("S0:"+s0+" S1:"+s1); //should print S0:Hi S1:Hello, but printing S0:null S1:null
In this ,I first run the MainRunner and then MainUser after compiling the classes and expect that print command of MainUser would give me -S0:Hi S1:Hello as result ,but it is yielding the null values for s0 & s1.
What should I do in this to get hi for s0 and hello for s1.hi friend, plz follow the code. I think this code may be suitable for u r requirements...
class MainUser
Ā Ā Ā Ā Ā public String s0,s1;
Ā Ā Ā Ā Ā MainUser()//Here i am using Constructor
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā s0="Hi";s1="Hello";
public class C extends MainUser
Ā Ā Ā Ā Ā public static void main(String a[])
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā MainUser m=new MainUser();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("S0:"+m.s0+" S1:"+m.s1);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā (OR)
class MainUser
Ā Ā Ā Ā Ā static String s0,s1;//Here i am declaring variables as Static
Ā Ā Ā Ā Ā public void runFunction()
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā s0="Hi";s1="Hello";
class B extends MainUser
Ā Ā Ā Ā Ā public B()//Contructor
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā MainUser m=new MainUser();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā m.runFunction();
public class C extends B
Ā Ā Ā Ā Ā public static void main(String a[])
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā B b=new B();//when i am creating new Object b then it will call B constructor
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("S0:"+b.s0+" S1:"+b.s1);
byeeeee -
WIS 10901 Could't find a specified program
Hello,
The version of BOE is 3.1 and he DBMS is oracle 11g.
I created a WEBI document in InfoViewApp. When I clicked the 'Run Query' button, it showed me that 'Could't find a specified program(WIS 10901)'.
How could I solve this problem?I believe that the issue is the space in the path "Program
Files". You probably need to use a path with no space (like
c:/java/jdk), or use the dos name (probably PROGRA~1). -
Update the data into the ZTABLE fields thru program logic ..?
hi all,
i have ZTABLE1,ZTABLE2,ZTABLE3, and this tables like ALV grids using object methods.
in the same table fields now i wanted to update the data into the ZTABLE fields thru program logic .
could anyone please help me ....
please provide if anyone of have any program logic that would be helpfull to me.
thanks in advance...
srinivas....Hi Srinivas,
The following statements are used to upload the data into custom tables.
1. Modify
2. Update
3. Insert
if you are using OO ALV, you should enable the 'SAVE' button in the main toolbar. if the user press the save button, then you should upload the data to the custom table.
please find the example code, in this example 'PERFORM F_SAVE_DATA'(here i gave the message only, you write your own logic here) is used to save the data in custom table.
Report Program: ZB_ALVOOPS_TEST
Line:-----
REPORT ZB_ALVOOPS_TEST MESSAGE-ID ZCR_MESSAGES.
Top Include - Global Data Declaration *
INCLUDE ZB_ALVOOPS_TEST_TOP.
SEL Include - Selection Screen *
INCLUDE ZB_ALVOOPS_TEST_SEL.
AT SELECTION SCREEN *
Initialization Event *
INITIALIZATION.
Initialize Screen Number.
PERFORM F_INITIALIZE.
Initialize Field Catalog for ALV Grid.
PERFORM F_INITIALIZE_GRID.
END-OF-SELECTION.
Call Display Screen *
CALL SCREEN 9000.
Event Handler - Class Definition and Implementation *
INCLUDE ZB_ALVOOPS_TEST_CL01.
PBO Event - Module Implementation *
INCLUDE ZB_ALVOOPS_TEST_PBO.
PAI Event - Module Implementation *
INCLUDE ZB_ALVOOPS_TEST_PAI.
Subroutine Include *
INCLUDE ZB_ALVOOPS_TEST_F01.
Include: ZB_ALVOOPS_TEST_TOP
Line:-------
Type Declaration For Internal Tables *
Collection Data
TYPES: BEGIN OF TY_MARA ,
MATNR TYPE MATNR , " Material
VPSTA TYPE VPSTA , " Maintenance status of complete material
MTART TYPE MTART , " Material Type
MBRSH TYPE MBRSH , " Industry Sector
MATKL TYPE MATKL , " Material Group
BISMT TYPE BISMT , " Old material number
MEINS TYPE MEINS , " Base Unit of Measure
BSTME TYPE BSTME , " Order unit
BRGEW TYPE BRGEW , " Gross weight
MAKTX TYPE MAKTX , " Material Description
ROWCOLOR TYPE CHAR4 , " Row Color
END OF TY_MARA .
Flag *
DATA: FG_REFRESH TYPE XFLD , " Used to Refresh ALV
FG_SAVE TYPE XFLD . " Data Saved Or Not.
Internal Table Declaration *
DATA: IT_MARA TYPE STANDARD TABLE OF TY_MARA , " Internal table for Material
WA_MARA TYPE TY_MARA . " Workarea for Material
Variable Declaration For General Constants *
CONSTANTS: C_SCREEN_SELECT TYPE SYDYNNR VALUE '9001' , " Selection Screen Number
C_SCREEN_SELECT_NIL TYPE SYDYNNR VALUE '9002' , " Empty Screen Number
C_STATUS9000 TYPE CHAR10 VALUE 'STATUS9000' , " PF-Status
C_TITLEBAR TYPE CHAR4 VALUE '9000' , " Title Bar
C_ISSUE_CONTAINER TYPE SCRFNAME VALUE 'WORKCONTAINER', " Container Name (Screen Painter)
C_BUTTON_TYPE TYPE CHAR1 VALUE '3' , " Button Type
C_EXECUTE TYPE CHAR4 VALUE 'SELE' , " Functions 'SELE' -> Execute
C_BACK TYPE CHAR4 VALUE 'BACK' , " Functions 'BACK' -> Back to main screen
C_ENTER TYPE CHAR5 VALUE 'ENTER' , " Functions 'ENTER' -> No Action
C_SEL01 TYPE CHAR5 VALUE 'SEL01' , " Functions 'SEL01' -> Toggle Function
C_SAVE TYPE CHAR4 VALUE 'SAVE' , " Functions 'SAVE' -> Save Function
C_REFRESH TYPE CHAR7 VALUE 'REFRESH' , " Functions 'REFRESH' -> Clear and Fres All objects
C_ADD_MI TYPE CHAR6 VALUE 'ADD_MI' , " Functions 'ADD_MI' -> Add New Media Issue
C_TRUE TYPE CHAR1 VALUE 'X' , " Set X value
C_REQUIRED TYPE CHAR1 VALUE '1' , " Un-Confirmed Qty field obligatory or not.
C_INPUT TYPE CHAR1 VALUE '0' , " Reason field should not be input.
C_ALV_SAVE TYPE CHAR1 VALUE 'A' , " ALV
C_ERROR TYPE CHAR1 VALUE 'E' , " Error Type
C_SIGN TYPE CHAR1 VALUE 'I' , " Sign
C_OPTION TYPE CHAR2 VALUE 'EQ' , " Option.
C_COMMIT_WAIT TYPE CHAR1 VALUE '5' , " Waiting to update in DB
C_TABNAME TYPE CHAR1 VALUE '1' , " Parameter (ALV)
C_CANCEL TYPE CHAR1 VALUE 'N' , " Cancel
C_YES TYPE CHAR1 VALUE 'J' . " Yes.
Variable Declaration For Container and ALV Grid *
DATA: OBJ_CUST_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER , " Container Class
OBJ_CUST_GRID TYPE REF TO CL_GUI_ALV_GRID . " ALV Grid Class
Field Catalog Declaration For Container and ALV Grid *
DATA: IT_FIELDCAT TYPE LVC_T_FCAT , " Field Catalog
IT_EXCLUDE TYPE UI_FUNCTIONS , " Standard Function Exclude from ALV
WA_FIELDCAT TYPE LVC_S_FCAT , " For Field Catalog
WA_LAYOUT TYPE LVC_S_LAYO . " ALV Layout
Global Variable Declaration *
DATA: OK_CODE TYPE SY-UCOMM , " OK CODE ( Screen Attribute Don't Change the var.name)
G_SAVE_CODE TYPE SY-UCOMM , " OK CODE
G_ANSWER TYPE CHAR1 , " OK or Cancel.
G_SELECTION_DYNNR TYPE SYDYNNR , " Screen Number
G_ERROR_TEXT TYPE CHAR128 , " Error Text
G_SELECTION_TOGGLE_TEXT TYPE CHAR50 , " Toggle Text, Value: Hide Selection, Show Selection
G_MATNR TYPE MATNR , " Material
G_SMATNR TYPE MATNR , " Material
G_SMTART TYPE MTART . " Material Type
Include: ZB_ALVOOPS_TEST_SEL
Line:-------
Selection Screen
SELECTION-SCREEN BEGIN OF SCREEN 9001 AS SUBSCREEN .
SELECTION-SCREEN BEGIN OF BLOCK SELECTION WITH FRAME TITLE TEXT-001 .
SELECT-OPTIONS: S_MATNR FOR G_SMATNR , " Material
S_MTART FOR G_SMTART . " Material Type
SELECTION-SCREEN END OF BLOCK SELECTION .
SELECTION-SCREEN END OF SCREEN 9001 .
Empty Selection
SELECTION-SCREEN BEGIN OF SCREEN 9002 AS SUBSCREEN .
SELECTION-SCREEN BEGIN OF BLOCK SELECTION_NIL WITH FRAME TITLE TEXT-002 .
Nil
SELECTION-SCREEN END OF BLOCK SELECTION_NIL .
SELECTION-SCREEN END OF SCREEN 9002 .
Include: ZB_ALVOOPS_TEST_CL01
Line:-------
CLASS lcl_event_handler DEFINITION *
Event Handler Class Definition *
CLASS LCL_EVENT_HANDLER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLER_TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE ,
HANDLER_USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM .
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION *
Event Class Implementation. *
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
Toolbar -----Create 'Add Issue' button
METHOD HANDLER_TOOLBAR.
DATA: L_WA_TOOLBAR TYPE STB_BUTTON. " Toolbar
CLEAR: L_WA_TOOLBAR.
Button Type
L_WA_TOOLBAR-BUTN_TYPE = C_BUTTON_TYPE . " 3.
APPEND L_WA_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
Add Issue Button.
CLEAR: L_WA_TOOLBAR.
L_WA_TOOLBAR-FUNCTION = 'ADD_MI' . " 'ADD_MI' .
L_WA_TOOLBAR-ICON = 'ICON_CREATE'.
L_WA_TOOLBAR-QUICKINFO = 'CREATE' . " 'Add Issue'.
L_WA_TOOLBAR-TEXT = 'CREATE' . " 'Add Issue'.
L_WA_TOOLBAR-DISABLED = ''.
APPEND L_WA_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR: L_WA_TOOLBAR.
ENDMETHOD. "handler_toolbar
User Actions Events-- Handle 'Add Issue' Button Click.
METHOD HANDLER_USER_COMMAND.
CASE E_UCOMM.
Add Issue Button.
WHEN C_ADD_MI.
IF NOT G_MATNR IS INITIAL.
FG_REFRESH = C_TRUE.
PERFORM F_ADD_MEDIAISSUE.
ENDIF.
ENDCASE.
Refresh Control
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
Handle Exceptions
IF SY-SUBRC <> 0.
CASE SY-SUBRC.
WHEN 1.
G_ERROR_TEXT = TEXT-026. " 'Control System Error'.
WHEN 2.
G_ERROR_TEXT = TEXT-027. " 'Control CL_GUI_CFW Has Raised Error'.
ENDCASE.
MESSAGE G_ERROR_TEXT TYPE 'E'.
ENDIF.
Refresh Alv Grid.
PERFORM F_REFRESH_GRID.
ENDMETHOD. "handler_user_command
ENDCLASS. "lcl_event_handler IMPLEMENTATION
Object Ref. Event Class.
DATA: OBJ_EVENT_HANDLER TYPE REF TO LCL_EVENT_HANDLER.
Include: ZB_ALVOOPS_TEST_PBO
Line:----
Module STATUS_9000 OUTPUT *
Set PF-Status *
MODULE STATUS_9000 OUTPUT.
PF Status
SET PF-STATUS C_STATUS9000 .
SET TITLEBAR C_TITLEBAR .
ENDMODULE. " STATUS_9000 OUTPUT
Module Create_Alvgrid OUTPUT *
Create Or Refresh ALV Grid *
MODULE CREATE_ALVGRID OUTPUT.
PERFORM F_PROCESS_ALV .
PERFORM F_REFRESH_GRID.
ENDMODULE. " create_alvgrid OUTPUT
Include: ZB_ALVOOPS_TEST_PAI
Line:----
Module exit_command INPUT *
Exit Command ( Cancel and Exit ) *
MODULE EXIT_COMMAND INPUT.
LEAVE PROGRAM.
ENDMODULE. " exit_command INPUT
Module user_command_9000 INPUT *
User Command - Process toolbar Events *
MODULE USER_COMMAND_9000 INPUT.
Take an Action based on user Input
G_SAVE_CODE = OK_CODE.
CLEAR OK_CODE.
CASE G_SAVE_CODE.
Back
WHEN C_BACK .
Raise the Confirmation Message When User not saved the data.
IF FG_SAVE = C_YES.
PERFORM F_EXITCHECK CHANGING G_ANSWER .
IF G_ANSWER = C_YES.
PERFORM F_SAVE_DATA.
ELSE.
CLEAR G_SAVE_CODE.
ENDIF.
CLEAR: FG_SAVE.
ENDIF.
LEAVE PROGRAM.
Enter
WHEN C_ENTER.
Execute ( F8 )
WHEN C_EXECUTE .
IF IT_MARA IS INITIAL.
PERFORM F_SELECTMATERIAL.
ENDIF.
Toggle Button
WHEN C_SEL01.
PERFORM F_TOGGLE_SELECTION_SCREEN. " USING ok_code.
SAVE ( CTRL+S )
WHEN C_SAVE.
IF NOT G_MATNR IS INITIAL.
PERFORM F_SAVE_DATA.
CLEAR: G_MATNR.
ENDIF.
New Entry ( CTRL+F1 )
WHEN C_REFRESH.
PERFORM F_REFRESH_DATA.
ENDCASE.
ENDMODULE. " user_command_9000 INPUT
Include: ZB_ALVOOPS_TEST_F01
Line:----
Form f_toggle_selection_screen *
Toggle Function - Hide Selection / Show Selection *
FORM F_TOGGLE_SELECTION_SCREEN.
Toggle Function
IF G_SELECTION_DYNNR = C_SCREEN_SELECT.
G_SELECTION_DYNNR = C_SCREEN_SELECT_NIL.
G_SELECTION_TOGGLE_TEXT = TEXT-902.
ELSE.
G_SELECTION_DYNNR = C_SCREEN_SELECT.
G_SELECTION_TOGGLE_TEXT = TEXT-901.
ENDIF.
ENDFORM. " f_toggle_selection_screen
Form f_initialize
Initialize Screen Number and Text
FORM F_INITIALIZE .
Initialize Screen Number
G_SELECTION_DYNNR = C_SCREEN_SELECT.
G_SELECTION_TOGGLE_TEXT = TEXT-901.
ENDFORM. "f_initialize
Form f_selectmaterial *
FORM F_SELECTMATERIAL .
Select the data from Mara Table
SELECT A~MATNR
A~VPSTA
A~MTART
A~MBRSH
A~MATKL
A~BISMT
A~MEINS
A~BSTME
A~BRGEW
B~MAKTX
INTO TABLE IT_MARA
FROM MARA AS A INNER JOIN MAKT AS B ON AMATNR = BMATNR
WHERE A~MATNR IN S_MATNR
AND A~MTART IN S_MTART
AND B~SPRAS = 'EN'.
IF SY-SUBRC = 0.
FG_REFRESH = C_TRUE.
FG_SAVE = C_YES .
G_MATNR = C_TRUE.
LOOP AT IT_MARA INTO WA_MARA WHERE BRGEW >= 200.
WA_MARA-ROWCOLOR = 'C310'.
MODIFY IT_MARA FROM WA_MARA.
ENDLOOP.
ELSE.
MESSAGE 'No data Found' TYPE 'E'.
ENDIF.
ENDFORM. " f_selectmaterial
Form f_initialize_grid *
Initialize Field Catalog. *
FORM F_INITIALIZE_GRID .
field catalog
PERFORM F_ATTRFCAT USING :
'MATNR' '1' '0' TEXT-005 '15' '0' 'X' ' ' ' ',
'VPSTA' '1' '1' TEXT-006 '15' '0' 'X' ' ' ' ',
'MTART' '1' '2' TEXT-007 '15' '0' ' ' ' ' ' ',
'MBRSH' '1' '3' TEXT-008 '15' '0' ' ' ' ' ' ',
'MATKL' '1' '4' TEXT-009 '15' '0' ' ' 'X' ' ',
'BISMT' '1' '5' TEXT-010 '15' '0' ' ' ' ' ' ',
'MEINS' '1' '6' TEXT-011 '15' '0' ' ' ' ' ' ',
'BSTME' '1' '7' TEXT-012 '15' '0' ' ' ' ' ' ',
'MAKTX' '1' '8' TEXT-013 '15' '0' ' ' ' ' 'C711',
'BRGEW' '1' '9' TEXT-014 '15' '0' ' ' ' ' ' '.
Set Editable Fields in ALV.
PERFORM F_SETEDIT_FIELDS CHANGING IT_FIELDCAT.
ENDFORM. "f_initialize_grid
Form f_setedit_fields *
Set Editable Fields in ALV *
C_IT_FIELDCAT <-- Field Catalog *
FORM F_SETEDIT_FIELDS CHANGING C_IT_FIELDCAT TYPE LVC_T_FCAT.
Local Variable Declaration.
DATA: LS_FIELDCAT LIKE LINE OF C_IT_FIELDCAT. " Field Catalog
Create Editable Fields.
LOOP AT C_IT_FIELDCAT INTO LS_FIELDCAT.
CASE LS_FIELDCAT-FIELDNAME.
WHEN 'BRGEW'.
LS_FIELDCAT-EDIT = C_TRUE.
WHEN 'MAKTX'.
LS_FIELDCAT-EDIT = C_TRUE.
ENDCASE.
MODIFY C_IT_FIELDCAT FROM LS_FIELDCAT.
ENDLOOP.
ENDFORM. " f_setedit_fields
Form f_attrfcat *
Update Field Catalog Internal Table *
U_FIELDNAME --> Field Name *
U_ROW_POS --> Row Position *
U_COL_POS --> Column Position *
U_SELTEXT_L --> Display Column Heading *
U_OUTPUTLEN --> Heading Output Length *
U_DECIMALS_OUT --> Number of decimal places in output *
U_KEY --> Key in ALV Display *
U_FIX --> Existence of fixed values *
FORM F_ATTRFCAT USING
U_FIELDNAME TYPE SLIS_FIELDNAME
U_ROW_POS TYPE SYCUROW
U_COL_POS TYPE SYCUCOL
U_SELTEXT_L TYPE SCRTEXT_L
U_OUTPUTLEN TYPE OUTPUTLEN
U_DECIMALS_OUT TYPE CHAR1
U_KEY TYPE CHAR1
U_FIX TYPE VALEXI
U_COL_COLOR TYPE LVC_EMPHSZ.
Update field catalog.
WA_FIELDCAT-FIELDNAME = U_FIELDNAME.
WA_FIELDCAT-ROW_POS = U_ROW_POS.
WA_FIELDCAT-COL_POS = U_COL_POS.
WA_FIELDCAT-COLTEXT = U_SELTEXT_L.
WA_FIELDCAT-SELTEXT = U_SELTEXT_L.
WA_FIELDCAT-OUTPUTLEN = U_OUTPUTLEN.
WA_FIELDCAT-DECIMALS_O = U_DECIMALS_OUT.
WA_FIELDCAT-KEY = U_KEY.
WA_FIELDCAT-VALEXI = U_FIX.
WA_FIELDCAT-EMPHASIZE = U_COL_COLOR.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "ATTR_FCAT
Form f_refresh_data *
Clear All the objects used in the program ( Data Related ) *
FORM F_REFRESH_DATA .
Clear All the Objects Used in Our Program.
CLEAR: S_MATNR ,
S_MTART ,
IT_MARA ,
OK_CODE ,
FG_REFRESH ,
FG_SAVE ,
G_SAVE_CODE ,
G_MATNR .
FREE: S_MATNR ,
S_MTART ,
IT_MARA ,
OK_CODE ,
FG_REFRESH ,
FG_SAVE ,
G_SAVE_CODE ,
G_MATNR .
Refresh Alv.
FG_REFRESH = C_TRUE.
ENDFORM. " f_refresh_data
Form f_process_alv *
1. Create Custom Container *
2. Create ALV Grid *
3. Exclude Standard Functions *
4. Display the ALV *
5. Register the Events. *
FORM F_PROCESS_ALV .
Display ALV
Custom Container
IF OBJ_CUST_CONTAINER IS INITIAL.
CREATE OBJECT OBJ_CUST_CONTAINER
EXPORTING
CONTAINER_NAME = C_ISSUE_CONTAINER.
ALV Grid
IF OBJ_CUST_GRID IS INITIAL.
CREATE OBJECT OBJ_CUST_GRID
EXPORTING
I_PARENT = OBJ_CUST_CONTAINER.
ENDIF.
Exclude Standard Functions
PERFORM F_EXCLUDETOOLBAR USING OBJ_CUST_GRID
CHANGING IT_EXCLUDE.
Layout.
WA_LAYOUT-CWIDTH_OPT = C_TRUE.
WA_LAYOUT-INFO_FNAME = 'ROWCOLOR'.
ALV Grid Display
CALL METHOD OBJ_CUST_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_TOOLBAR_EXCLUDING = IT_EXCLUDE
I_SAVE = C_ALV_SAVE
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT[]
IT_OUTTAB = IT_MARA.
ENDIF.
Register Editable ALV Events
CALL METHOD OBJ_CUST_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
EXCEPTIONS
ERROR = 1
OTHERS = 2.
*Create Object for Custom Event Handler Class if the ref. object is
*initial.
IF OBJ_EVENT_HANDLER IS INITIAL.
CREATE OBJECT OBJ_EVENT_HANDLER.
ENDIF.
Register Events
SET HANDLER: OBJ_EVENT_HANDLER->HANDLER_TOOLBAR FOR
OBJ_CUST_GRID,
OBJ_EVENT_HANDLER->HANDLER_USER_COMMAND FOR
OBJ_CUST_GRID.
Set Toolbar
CALL METHOD OBJ_CUST_GRID->SET_TOOLBAR_INTERACTIVE.
ENDFORM. " f_process_alv
Form f_excludetoolbar *
Exclude Standard Functions from ALV *
U_OBJ_CUST_GRID --> Instant for CL_GUI_ALV_GRID *
C_IT_EXCLUDE <-- Internal table for Exclude *
FORM F_EXCLUDETOOLBAR USING U_OBJ_CUST_GRID TYPE REF TO CL_GUI_ALV_GRID
CHANGING C_IT_EXCLUDE TYPE UI_FUNCTIONS.
Exclude Standard Functions
CLEAR: C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_CHECK TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_REFRESH TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_COPY TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_COPY_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_CUT TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_DELETE_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_APPEND_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_INSERT_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_MOVE_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_PASTE TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_PASTE_NEW_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_UNDO TO C_IT_EXCLUDE.
ENDFORM. " f_excludetoolbar
Form f_create_returnrequest *
Create Return Request based on the Work container ( ALV Grid Data) *
FORM F_CREATE_RETURNREQUEST.
Message to save
ENDFORM. " f_create_returnrequest
Form f_add_mediaissue *
Create New Media Issue if the user click 'ADD ISSUE' Button. *
1. Get the Input From User *
2. Get Total Delivery and Return Quantity *
3. Append to Final internal table *
FORM F_ADD_MEDIAISSUE .
Local Variable Declaration.
MESSAGE 'Add Button Clicked' TYPE 'I'.
ENDFORM. " f_add_mediaissue
Form f_refresh_grid *
Refresh ALV Grid *
FORM F_REFRESH_GRID .
Refresh ALV Grid.
IF FG_REFRESH IS NOT INITIAL.
CALL METHOD OBJ_CUST_GRID->REFRESH_TABLE_DISPLAY.
CLEAR: FG_REFRESH.
ENDIF.
ENDFORM. " f_refresh_grid
Form f_getcollectissue *
FORM F_GETCOLLECTISSUE .
Collection Plan Data
ENDFORM. " f_getcollectissue
Form f_perpare_final *
FORM F_PERPARE_FINAL .
Perpare Final Internal table
ENDFORM. " f_perpare_final
Form f_validate_data *
FORM F_VALIDATE_DATA.
Message if any data validation.
ENDFORM. " f_validate_data
Form f_modify_final *
Update Actual Delivery Qty and Return Qty in Final Internal table *
Form f_save_data *
Save the Data When User Click 'Save' Button *
FORM F_SAVE_DATA .
Message
MESSAGE 'Save Button Clicked' TYPE 'I'.
ENDFORM. "f_save_data
Form f_exitcheck *
When User Exit from the Transaction then Raise Confirmation message*
C_ANSWER <-- OK or Cancel. *
FORM F_EXITCHECK CHANGING C_ANSWER TYPE CHAR1.
Security Check.
C_ANSWER = C_CANCEL.
CALL FUNCTION 'POPUP_TO_CONFIRM_DATA_LOSS'
EXPORTING
TITEL = TEXT-039
IMPORTING
ANSWER = C_ANSWER.
ENDFORM. "f_exitcheck
Screen Numer : 9000
Line:------
PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.
CALL SUBSCREEN: SELECTIONSCREEN INCLUDING SY-CPROG G_SELECTION_DYNNR.
MODULE CREATE_ALVGRID.
PROCESS AFTER INPUT.
MODULE EXIT_COMMAND AT EXIT-COMMAND.
CALL SUBSCREEN: SELECTIONSCREEN.
MODULE USER_COMMAND_9000.
pls reward if it is useful -
Windows program problem using Runtime.
I have a program that works with the mouse click,
but does not work from a DOS command prompt.
It seems in Java the command exec works like DOS.
Anyway to overcome this?
Thanks.
boolean bWait = true;
try {
String cmd = System.getProperty("user.dir")+getString("Program");
Runtime r = Runtime.getRuntime();
Process pr = r.exec(cmd);
BufferedInputStream bis =new BufferedInputStream(pr.getInputStream());
int c=0;
/** Outlet for IO for the process **/
while ((c = bis.read()) != -1) {
System.out.print((char)c); // do your processing
/** Now wait for the process to get finished **/
if(bWait == true) {
pr.waitFor();
pr.destroy();
} catch(Exception f) {
System.out.println("Could not execute process."+f+"\n");Other than this.
C:\>cmd.exe /?
Starts a new instance of the Windows 2000 command interpreter
CMD [A | /U] [Q] [D] [E:ON | /E:OFF] [F:ON | /F:OFF] [V:ON | /V:OFF]
[[S] [C | /K] string]
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
/S Modifies the treatment of string after /C or /K (see below)
/Q Turns echo off
/D Disable execution of AutoRun commands from registry (see below)
/A Causes the output of internal commands to a pipe or file to be ANSI
/U Causes the output of internal commands to a pipe or file to be
Unicode
/T:fg Sets the foreground/background colors (see COLOR /? for more info)
/E:ON Enable command extensions (see below)
/E:OFF Disable command extensions (see below)
/F:ON Enable file and directory name completion characters (see below)
/F:OFF Disable file and directory name completion characters (see below)
/V:ON Enable delayed environment variable expansion using c as the
delimiter. For example, /V:ON would allow !var! to expand the
variable var at execution time. The var syntax expands variables
at input time, which is quite a different thing when inside of a FOR
loop. -
ABAP Report Program Logical Database PNP
I have a ABAP program using the logical database PNP. The report is config to run on MSS using EP. I have added code to capture the Org Unit when it is pass to the program from MSS.Ā My issue is how do i capture the org unit value that is passed to the program.Ā Ā I have added code to capture field pnporgehĀ in the START OF SELECTION event.Ā Ā This works great if you are running the program from R3, but none of my edit checking against field pnporgeh works.
Hi John,
I am also having same trouble where in i have added a new custom(Z) report in the MSS ->My Staff -> Reporting under report category -> Time Management (MSS). I am not able to find how the value of org unit which is selected on portal screen is passed to report in R/3 which is using PNP logical db.
I tested in debugging but selection screen parameter PNPORGEH contains nothing.
Many Thanks in advance for the help.
Edited by: Ankit Kashyap on Nov 17, 2010 12:40 PM -
Programming logic, passing data from a page to another
Hi,
I just began with developing with APEX 4.1.1, and I think I don't get how I should use it efficiently, I am more used to C-like programming.
I have a table which contains the state of some electricity meters taken at some non-regularly spaced dates. I want to make a chart of the electricity consumption, e.g for each month. This (I think) implies that the application must do that (I used this logic for the same application made with php and sqlite and it worked):
- User chooses a meter
- Application tells him the available range of dates and the mean interval between measurements
- User chooses the range of dates and the interval
- Application verifies that the range of dates is valid (not outside the real data)
- Interpolate the state of the meters at the requested regular interval
- Calculate the consumption for each interval (simply a difference)
- Draw the chart
For now, I created some procedures which should pass a custom data type containing all the meta-data about the chart and a PL/SQL table containing the actual data to be charted, but I'm stuck at the point of interacting with the user (meaning writing the output of the procedures on a page and passing them to the next procedure and also charting that pl/sql table).
Maybe should I create a temporary table ? But of what I read, this is a "real" table stored on the disk, and I just need this data once (and it is a small dataset, at most 20 points or so) for drawing a chart. This table should also be specific to the chart currently being created, it could happen that the same user or different users make multiple charts at the same time (like in two firefox tabs).
I hope my post is not too confused..
Ben940065 wrote:
Hi,
I just began with developing with APEX 4.1.1, and I think I don't get how I should use it efficiently, I am more used to C-like programming.Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "940065".
APEX is intended for the development of database centric applications. It's a physical implementation of Tom Kyte's philosophy of database application development—possibly replacing Java with JavaScript ;-) .
To use it efficiently you need to stop thinking procedurally in C-like terms and think in terms of the set operations that SQL uses effectively.
I have a table which contains the state of some electricity meters taken at some non-regularly spaced dates. I want to make a chart of the electricity consumption, e.g for each month. This (I think) implies that the application must do that (I used this logic for the same application made with php and sqlite and it worked):
- User chooses a meter
- Application tells him the available range of dates and the mean interval between measurements
- User chooses the range of dates and the interval
- Application verifies that the range of dates is valid (not outside the real data)
- Interpolate the state of the meters at the requested regular interval
- Calculate the consumption for each interval (simply a difference)
- Draw the chart
For now, I created some procedures which should pass a custom data type containing all the meta-data about the chart and a PL/SQL table containing the actual data to be charted,
but I'm stuck at the point of interacting with the user (meaning writing the output of the procedures on a page and passing them to the next procedure and also charting that pl/sql table).It seems that you don't really get APEX yet: have you read the introductory documentation and taken the <i>Oracle® Database 2 Day + Application Express Developer's Guide</i> tutorial in order to understand basic APEX techniques and terminology?
You should be aiming to collect and validate the required parameters in APEX session state values and use the built-in charting capability with SQL data sources that use these parameter values in query predicates.
If you really can't generate the chart series from queries run on the original table, generate the chart data using an APEX collection rather than a "PL/SQL table" (preferred terminology is "collection type", but it's even better to specifically say "associative array", "nested table" or "varying array") or temporary database table.
Maybe should I create a temporary table ? But of what I read, this is a "real" table stored on the disk, and I just need this data once (and it is a small dataset, at most 20 points or so) for drawing a chart. This table should also be specific to the chart currently being created, it could happen that the same user or different users make multiple charts at the same time (like in two firefox tabs).Temporary tables are rarely required in any Oracle application, but standard Oracle Global Temporary Tables are database-session specific and so have no concurrency issues. However there are issues when using them in APEX, so APEX collections are the preferred method for temporary, session-based storage. -
RFC destination Could not be SPecified for Logical System
Hello there
i am traying to costomize Transaction Luancher for some of the report which is been devloped in ECC (wich is ARD 100)
whenĀ on Transaction launcher Wizard--> techincal
i amĀ having aĀ logical system as ARD100(my r.3 system where report is devloped and which is connected to CRM )
while chosing the OBJ.TYpe :Ā Ā and Method:
it says shows three erroe :
1) RFC destination could not be specifiedĀ for the logical system ARD100
2) Object type and Method is not available
i have checked RFCĀ , inĀ SM59 entriesu2026u2026 There is an RFC named ARD100 and the connection test works. I also did an authorization test and it also works. I also checked to make sure the logical system name ARD100 exists
could you please help me to resolved the same
Regards
RajivHi Rajeev,
In a system landscape it's important and necessary to use the logical system names consistently throughout all systems!
Therefore please make sure, that you always use the same name for a logical system in all systems (CRM and R/3 systems).
The following steps are required before a RFC call is made from the CRM system to the R/3 system :
Ā Ā Ā oĀ Use transaction SM59 to create an RFC destinations for the remote
Ā Ā Ā Ā Ā Ā system.
Ā Ā Ā oĀ Use transaction BD54 to create the logical system.
Ā Ā Ā oĀ Use transaction BD97 to link the RFC destination created in SM59
Ā Ā Ā Ā Ā Ā with the logical system created in BD54.
I hope this helps.
Best Regards
Gavin -
Hr programming - logical database - macro
Hi everyone !
I use pnp logical database.
Now how the program familiar the macro RP-PROVIDE-FROM-FIRST
from table trmac ? ?
i know that macro can be familiar from the program between lines:
define .......
end-of-definition.
someone can explain to me ?Hi
See this sample program for using the LDB PNP and the MAcros
report zporgr0030
line-size 193
line-count 60(1)
no standard page heading
message-id zndc.
Database Tables
tables: pernr, " Logical PNP
t001p, " Personnel Subarea
t005t, " Country Descriptions
t500p, " Personnel Area
t501, " Employee Group
t503k, " Employee Subgroup
csks, " Cost Centers
cskt, " Cost Center Texts
t513c, " Job (Previous) Texts
t513s, " Job Titles
t517t, " Edn Est.Text
t518b, " Discipline Text
t519t, " Certificate Text
t528t, " Positions Texts
t538t, " Unit Text
pa0003. " Payroll Status
infotypes:
0000, " Actions
0001, " Organizational Assignment
0002, " Personal Data
0007, " Planned working time
0008, " Payroll Data
0022, " Education Data
0023, " Previous Employer data
0025, " Performance Appraisal Data
0041, " Date Spcifications
2001. " Absences
Declaration of Internal Tables
Internal Table for Personal Data
data: begin of pers_tab occurs 0,
pernr like pa0001-pernr, " Personal Number
ename like pa0001-ename, " Employee Name
trfgr like pa0008-trfgr, " Grade
natio like pa0002-natio, " Nationality
hdate like pa0041-dat01, " Hire Date
gbdat like pa0002-gbdat, " Birth Date
plans like pa0001-plans, " Position
werks like pa0001-werks, " Pers.Area
kostl like pa0001-kostl, " Cost Center
ctext(40), " Cost Center Text
ptext(25), " Position Text
ntext(15), " Nation Text
name1(23), " Location
end of pers_tab.
Internal Table for Payroll Data
data: begin of pay_tab occurs 0,
pernr like pa0008-pernr, " Personal Number
waers like pbwla-waers, " Grade
basic like pa0008-bet01, " Basic Pay
hra_allow like pa0008-bet01, " Housing Allowance
sup_allow like pa0008-bet01, " Supp. Allowance
soc_allow like pa0008-bet01, " Social Allowance
chl_allow like pa0008-bet01, " Child Allowance
fix_allow like pa0008-bet01, " Fixed Overtime
ra_allow like pa0008-bet01, " RA Allowance
per_allow like pa0008-bet01, " Perform. Allowance
pen_allow like pa0008-bet01, " Pension Allowance
oth_allow like pa0008-bet01, " Other Allowances
tot_allow like pa0008-bet01, " Total Allowances
end of pay_tab.
Internal Table for Educational Data
data: begin of edn_tab occurs 0,
pernr like pa0022-pernr, " Personal Number
ausbi like pa0022-ausbi, " Discipline Name
slart like pa0022-slart, " Edn Establishment
insti like pa0022-insti, " Institute
sland like pa0022-sland, " Country
slabs like pa0022-slabs, " Certificate
anzkl like pa0022-anzkl, " Duration
anzeh like pa0022-anzeh, " Unit for Duration
atext like t518b-atext, " Discipline Text
stext like t517t-stext, " Edn Est.Text
landx like t005t-landx, " Country Text
ctext like t519t-stext, " Certificate Text
etext like t538t-etext, " Unit Text
end of edn_tab.
Internal Table for Previous Employment Data
data: begin of pemp_tab occurs 0,
pernr like pa0023-pernr, " Personal Number
arbgb like pa0023-arbgb, " Previous Employer
begda like pa0023-begda, " Start Date
endda like pa0023-endda, " End Date
taete like pa0023-taete, " Last Position
land1 like pa0023-land1, " Country
stltx like t513s-stltx, " Position Text
landx like t005t-landx, " Country Text
end of pemp_tab.
Internal Table for Job History Data
data: begin of job_tab occurs 0,
pernr like pa0001-pernr, " Personal Number
begda like pa0001-begda, " Promotion Date
plans like pa0001-plans, " Position
stell like pa0001-stell, " Job Key
stltx like t513s-stltx, " Job Text
ptext like t528t-plstx, " Position Text
end of job_tab.
Internal Table for Performance Appraisal Data
data: begin of app_tab occurs 0,
pernr like pa0001-pernr, " Personal Number
year(4) type c, " Current Year
appr(35) type c, " C Y Appraisal
year1(4) type c, " Last Year
appr1(35) type c, " Last Year Appraisal
year2(4) type c,
appr2(35) type c,
year3(4) type c,
appr3(35) type c,
year4(4) type c,
appr4(35) type c,
end of app_tab.
Internal Table for Performance Appraisal Data
data: begin of app1_tab occurs 0,
year(4) type c, " Year
appr(35) type c, " Appraisal
end of app1_tab.
Internal Table to get the Payroll Amounts
data wage_tab like pbwla occurs 0 with header line.
Internal table for retreiving Employee Appraisals
data app_in_tab like hrsobid occurs 0 with header line .
data app_out_tab like hrpe_profa occurs 0 with header line .
Declaration of Variables
data : v_year(4) type c,
v_ayear(4) type c,
v_cyear(4) type c,
v_year1(4) type c,
v_year2(4) type c,
v_year3(4) type c,
v_year4(4) type c,
v_year5(4) type c,
v_year6(4) type c,
v_mon(2) type c,
v_date2 like sy-datum,
v_date3 like sy-datum,
v_date like sy-datum,
v_date1 like sy-datum.
Declaration of Constants
constants : c_x type c value 'X', " Sign
c_pernr(8) type n value '00000000', " Pernr
c_p like hrp1007-otype value 'P', " Object Type
c_01 like hrp1001-plvar value '01', " Version
c_val1(2) type c value '31', " Date Type
c_val2(2) type c value '12', " Date Type
c_val like p0041-dar01 value '01', " Date Type
c_1 like pernr-persg value '1', " Emp Group
c_type like hrp1001-otype value 'S', " Object Type
c_date1 like sy-datum value '18000101', " Date
c_date2 like sy-datum value '99991231', " Date
c_lga01 like pa0008-lga01 value '0101', " Wage Type
c_lga02 like pa0008-lga01 value '0102', " Wage Type
c_lga03 like pa0008-lga01 value '0103', " Wage Type
c_lga04 like pa0008-lga01 value '0105', " Wage Type
c_lga05 like pa0008-lga01 value '0109', " Wage Type
c_lga06 like pa0008-lga01 value '0110', " Wage Type
c_lga07 like pa0008-lga01 value '0114', " Wage Type
c_lga08 like pa0008-lga01 value '0116', " Wage Type
c_lga09 like pa0008-lga01 value '0267', " Wage Type
c_kokrs like cskt-kokrs value '1000'. " Controlling Area
Selection Screen
selection-screen begin of block b1 with frame title text-003.
selection-screen begin of line.
selection-screen comment 1(33) text-060.
parameters: r_all radiobutton group rb1.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) text-020.
parameters: r_per radiobutton group rb1.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) text-021.
parameters: r_pay radiobutton group rb1.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) text-022.
parameters: r_edn radiobutton group rb1.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) text-023.
parameters: r_pemp radiobutton group rb1.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) text-024.
parameters: r_job radiobutton group rb1.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) text-025.
parameters: r_app radiobutton group rb1.
selection-screen end of line.
selection-screen end of block b1.
At selection-screen
at selection-screen.
Validate the Selection Screen fields
perform validate_screen.
Start-of-Selection
start-of-selection.
Selection of Period
perform get_period.
Get PERNR from LDB
get pernr.
if pernr-persg eq c_1 or pernr-pernr ne c_pernr.
if r_all eq c_x.
Get the Personal data from PA0001,PA0002, PA0008, PA0041
perform get_pers_data.
Get the Payroll data from PA0008
perform get_pay_data.
Get the Education data from PA0022
perform get_edn_data.
Get the Previous Employment data from PA0023
perform get_pemp_data.
Get the Job History data
perform get_job_data.
Get the Performance Appraisal data
perform get_app_data.
elseif r_per eq c_x.
Get the Personal data from PA0001,PA0002, PA0008, PA0041
perform get_pers_data.
elseif r_pay eq c_x.
Get the Payroll data from PA0008
perform get_pay_data.
elseif r_edn eq c_x.
Get the Education data from PA0022
perform get_edn_data.
elseif r_pemp eq c_x.
Get the Previous Employment data from PA0023
perform get_pemp_data.
elseif r_job eq c_x.
Get the Job History data
perform get_job_data.
elseif r_app eq c_x.
Get the Performance Appraisal data
perform get_app_data.
endif.
endif.
Top-of-page
top-of-page.
Write the Report and Column Headings
perform top_of_page.
End-of-Page
end-of-page.
perform end_of_page.
End-of-Selection
end-of-selection.
Display the Output Report.
perform display_report.
Form-Routines
*& Form validate_screen
Validation of selection Screen fields
form validate_screen.
Validation of Personnel Number
clear pa0003.
if not pnppernr[] is initial.
select pernr
from pa0003 up to 1 rows
into pa0003-pernr
where pernr in pnppernr.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personnel Number Entered'(001).
endif.
endif.
Validation of Cost Center
clear csks.
if not pnpkostl[] is initial.
select single kostl
into csks-kostl
from csks
where kostl in pnpkostl.
if sy-subrc <> 0.
message e999 with 'Invalid Cost Center'(002).
endif.
endif.
Validation of Personnel Area
clear t500p.
if not pnpwerks[] is initial.
select persa
from t500p up to 1 rows
into t500p-persa
where persa in pnpwerks.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personnel Area Entered'(004).
endif.
endif.
Validation of Personnel Sub Area
clear t001p.
if not pnpbtrtl[] is initial.
select btrtl
from t001p up to 1 rows
into t001p-btrtl
where btrtl in pnpbtrtl.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personnel Sub Area Entered'(005).
endif.
endif.
Validation of Employee Group
clear t501.
if not pnppersg[] is initial.
select persg
from t501 up to 1 rows
into t501-persg
where persg in pnppersg.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Employee Group Entered'(006).
endif.
endif.
Validation of Employee Sub Group
clear t503k.
if not pnppersk[] is initial.
select persk
from t503k up to 1 rows
into t503k-persk
where persk in pnppersk.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Employee Sub Group Entered'(007).
endif.
endif.
endform. "validate_screen
*& Form get_period
Get the Correct Period based on Selection screen selection
form get_period.
clear: v_year,v_mon, v_date, v_date1.
v_year = sy-datum+0(4).
v_mon = sy-datum+4(2).
if pnptimr1 = c_x. " Current Date
pnpbegda = sy-datum.
pnpendda = sy-datum.
elseif pnptimr2 = c_x. " Current Month
concatenate v_year v_mon c_val into v_date.
concatenate v_year v_mon c_val1 into v_date1.
pnpbegda = v_date.
pnpendda = v_date1.
elseif pnptimr3 = c_x. " Current Year
concatenate v_year c_val c_val into v_date.
concatenate v_year c_val2 c_val1 into v_date1.
pnpbegda = v_date.
pnpendda = v_date1.
elseif pnptimr4 = c_x. " Upto Today
pnpbegda = c_date1.
pnpendda = sy-datum.
elseif pnptimr5 = c_x. " From Today
pnpbegda = sy-datum.
pnpendda = c_date2.
else.
if ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = c_date1.
pnpendda = c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
pnpbegda = c_date1.
pnpendda = pnpendda.
elseif not ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = pnpbegda.
pnpendda = pnpendda.
endif.
endif.
endform. "get_period
*& Form get_pers_data
Get the Personal Data from PA0001,PA0002,PA0008, PA0041
form get_pers_data.
Get data from Respective Infotypes
rp_provide_from_last p0001 space pnpbegda pnpendda.
rp_provide_from_last p0002 space pnpbegda pnpendda.
rp_provide_from_last p0008 space pnpbegda pnpendda.
rp_provide_from_last p0041 space pnpbegda pnpendda.
pers_tab-pernr = p0001-pernr.
pers_tab-ename = p0001-ename.
pers_tab-werks = p0001-werks.
pers_tab-plans = p0001-plans.
pers_tab-kostl = p0001-kostl.
pers_tab-gbdat = p0002-gbdat.
pers_tab-trfgr = p0008-trfgr.
Get the Engaged Date
read table p0041 with key dar01 = c_val.
if sy-subrc = 0.
pers_tab-hdate = p0041-dat01.
endif.
Get the Cost Center Text
clear cskt-ltext.
select single ltext into cskt-ltext from cskt
where spras = sy-langu and
kokrs = c_kokrs and
kostl = p0001-kostl.
if sy-subrc = 0.
pers_tab-ctext = cskt-ltext.
endif.
Get the Position Text
clear t528t-plstx.
select single plstx into t528t-plstx from t528t
where plans = p0001-plans and
otype = c_type and
sprsl = sy-langu.
if sy-subrc = 0.
pers_tab-ptext = t528t-plstx.
endif.
Get the Nationality
clear t005t-natio.
select single natio into t005t-natio from t005t
where spras = sy-langu and
land1 = p0002-natio.
if sy-subrc = 0.
pers_tab-ntext = t005t-natio.
endif.
Get the Location (Personal Area) Text
clear t500p-name1.
select single name1 into t500p-name1 from t500p
where persa = p0001-werks.
if sy-subrc = 0.
pers_tab-name1 = t500p-name1.
endif.
append pers_tab.
clear pers_tab.
sort pers_tab by pernr.
endform. "get_pers_data
*& Form get_pay_data
Get the Payroll Data from Infotype 0008
form get_pay_data.
Get the Payroll data from Respective Infotypes
rp_provide_from_last p0008 space pnpbegda pnpendda.
pay_tab-pernr = pernr-pernr.
call function 'RP_FILL_WAGE_TYPE_TABLE_EXT'
exporting
appli = 'E'
begda = p0008-begda
endda = p0008-endda
infty = '0008'
objps = ' '
tclas = 'A'
pernr = pernr-pernr
seqnr = ' '
subty = '0 '
dlspl = 'X'
msgflg = ''
nordct = ''
tables
pp0001 = p0001
pp0007 = p0007
pp0008 = p0008
ppbwla = wage_tab
PP0230 =
PP0014 =
PP0015 =
PP0052 =
EXCEPTIONS
ERROR_AT_INDIRECT_EVALUATION = 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.
loop at wage_tab.
pay_tab-waers = wage_tab-waers.
case wage_tab-lgart.
when c_lga01.
pay_tab-basic = wage_tab-betrg.
when c_lga02.
pay_tab-sup_allow = wage_tab-betrg.
when c_lga03.
pay_tab-hra_allow = wage_tab-betrg.
when c_lga04.
pay_tab-chl_allow = wage_tab-betrg.
when c_lga05.
pay_tab-soc_allow = wage_tab-betrg.
when c_lga06.
pay_tab-fix_allow = wage_tab-betrg.
when c_lga07.
pay_tab-ra_allow = wage_tab-betrg.
when c_lga08.
pay_tab-per_allow = wage_tab-betrg.
when c_lga09.
pay_tab-pen_allow = wage_tab-betrg.
when others.
pay_tab-oth_allow = pay_tab-oth_allow + wage_tab-betrg.
endcase.
pay_tab-tot_allow = pay_tab-basic + pay_tab-sup_allow +
pay_tab-hra_allow + pay_tab-chl_allow +
pay_tab-soc_allow + pay_tab-fix_allow +
pay_tab-ra_allow + pay_tab-per_allow +
pay_tab-oth_allow - pay_tab-pen_allow.
endloop.
append pay_tab.
clear pay_tab.
endform. "get_pay_data
*& Form get_edn_data
Get the Education Data from Infotype 0022
form get_edn_data.
Get the Education data from Respective Infotypes
loop at p0022 where pernr = pernr-pernr.
edn_tab-pernr = pernr-pernr.
edn_tab-ausbi = p0022-ausbi.
edn_tab-slart = p0022-slart.
edn_tab-insti = p0022-insti.
edn_tab-sland = p0022-sland.
edn_tab-slabs = p0022-slabs.
edn_tab-anzkl = p0022-anzkl.
edn_tab-anzeh = p0022-anzeh.
Get the Discipline Text
clear t518b-atext.
select single atext into t518b-atext from t518b
where langu = sy-langu and
ausbi = p0022-ausbi.
if sy-subrc = 0.
edn_tab-atext = t518b-atext.
endif.
Get the Edn Establishment Text
clear t517t-stext.
select single stext into t517t-stext from t517t
where slart = p0022-slart and
sprsl = sy-langu.
if sy-subrc = 0.
edn_tab-stext = t517t-stext.
endif.
Get the Certificate Text
clear t519t-stext.
select single stext into t519t-stext from t519t
where slabs = p0022-slabs and
sprsl = sy-langu.
if sy-subrc = 0.
edn_tab-ctext = t519t-stext.
endif.
Get the Unit Text
clear t538t-etext.
select single etext into t538t-etext from t538t
where zeinh = p0022-anzeh and
sprsl = sy-langu.
if sy-subrc = 0.
edn_tab-etext = t538t-etext.
endif.
Get the Country Description
clear t005t-landx.
select single landx into t005t-landx from t005t
where spras = sy-langu and
land1 = p0022-sland.
if sy-subrc = 0.
edn_tab-landx = t005t-landx.
endif.
append edn_tab.
clear edn_tab.
endloop.
endform. "edn_data
*& Form get_pemp_data
Get the Previous Employment Data from Infotype 0023
form get_pemp_data.
Get the Previous Employment data from Respective Infotypes
loop at p0023 where pernr = pernr-pernr.
pemp_tab-pernr = pernr-pernr.
pemp_tab-arbgb = p0023-arbgb.
pemp_tab-begda = p0023-begda.
pemp_tab-endda = p0023-endda.
pemp_tab-taete = p0023-taete.
pemp_tab-land1 = p0023-land1.
Get the Last Job Text
clear t513c-ltext.
select single ltext into t513c-ltext from t513c
where taete = pemp_tab-taete and
spras = sy-langu.
if sy-subrc = 0.
pemp_tab-stltx = t513c-ltext.
endif.
Get the Country Description
clear t005t-landx.
select single landx into t005t-landx from t005t
where spras = sy-langu and
land1 = pemp_tab-land1.
if sy-subrc = 0.
pemp_tab-landx = t005t-landx.
endif.
append pemp_tab.
clear pemp_tab.
endloop.
sort pemp_tab by pernr.
endform. "pemp_data
*& Form get_job_data
Get the Job History Data from Infotype
form get_job_data.
Get the Job History data from Respective Infotypes
loop at p0001 where pernr = pernr-pernr.
job_tab-pernr = pernr-pernr.
job_tab-begda = p0001-begda.
job_tab-plans = p0001-plans.
job_tab-stell = p0001-stell.
Get the Last Job Text
clear t513s-stltx.
select single stltx into t513s-stltx from t513s
where stell = job_tab-stell and
sprsl = sy-langu.
if sy-subrc = 0.
job_tab-stltx = t513s-stltx.
endif.
Get the Position Text
clear t528t-plstx.
select single plstx into t528t-plstx from t528t
where plans = job_tab-plans and
otype = c_type and
sprsl = sy-langu.
if sy-subrc = 0.
job_tab-ptext = t528t-plstx.
endif.
append job_tab.
clear job_tab.
endloop.
sort job_tab by pernr.
endform. "get_job_data
*& Form get_app_data
Get the Performance Appraisal Data from Infotype
form get_app_data.
clear: v_cyear, v_year1, v_year2, v_year3, v_year4,
v_year5, v_year6, v_ayear, v_date2, v_date3.
v_cyear = sy-datum+0(4) - 1.
v_year1 = v_cyear - 1.
v_year2 = v_cyear - 2.
v_year3 = v_cyear - 3.
v_year4 = v_cyear - 4.
v_year5 = v_cyear - 5.
v_year6 = v_cyear - 6.
concatenate v_cyear c_date2+4(4) into v_date2.
concatenate v_year6 c_date1+4(4) into v_date3.
clear: app_in_tab, app_out_tab.
refresh: app_in_tab, app_out_tab.
app_in_tab-plvar = c_01.
app_in_tab-otype = c_p.
app_in_tab-sobid = pernr-pernr.
append app_in_tab.
Get Appraisals data from Respective Infotypes
call function 'RHPA_APPRAISEES_APP_READ'
exporting
begda = v_date3
endda = v_date2
WITH_STEXT = 'X'
WITH_ADD_INFO = 'X'
tables
appraisees = app_in_tab
appraisals = app_out_tab
exceptions
no_authority = 1
undefined = 2
others = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
sort app_out_tab by sobid vbegd vendd appraisal_adate descending .
delete adjacent duplicates from app_out_tab
comparing sobid vbegd vendd.
loop at app_out_tab where appraisal_histo = 'X' .
condense app_out_tab-appraisal_result.
app1_tab-year = app_out_tab-vendd+0(4).
app1_tab-appr = app_out_tab-appraisal_result_text.
append app1_tab.
clear app1_tab.
endloop.
sort app1_tab by year descending.
loop at app1_tab.
app_tab-pernr = pernr-pernr.
move-corresponding app1_tab to app_tab.
append app_tab.
clear: app1_tab, app_tab.
endloop.
refresh app1_tab.
sort app_tab by pernr.
delete app_tab where year = ' ' and appr = ' ' .
endform. "get_app_data
*& Form top_of_page
Write the Report and Column Headings
form top_of_page.
skip.
format color col_heading on.
if r_all eq c_x.
write: /1(193) 'NATIONAL DRILLING COMPANY'(009) centered,
/1(193) 'Employee Details Report'(066) centered.
elseif r_per eq c_x.
write: /1(193) 'NATIONAL DRILLING COMPANY'(009) centered,
/1(193) 'Employee Details - Personal Data'(010)
centered.
elseif r_pay eq c_x.
write: /1(172) 'NATIONAL DRILLING COMPANY'(009) centered,
/1(172) 'Employee Details - Payroll Data'(027)
centered.
elseif r_edn eq c_x.
write: /1(172) 'NATIONAL DRILLING COMPANY'(009) centered,
/1(172) 'Employee Details - Education Data'(028)
centered.
elseif r_pemp eq c_x.
write: /1(97) 'NATIONAL DRILLING COMPANY'(009) centered,
/1(97) 'Employee Details - Previous Employment Data'(029)
centered.
elseif r_job eq c_x.
write: /1(75) 'NATIONAL DRILLING COMPANY'(009) centered,
/1(75) 'Employee Details - Job History Data'(030)
centered.
elseif r_app eq c_x.
write: /1(192) 'NATIONAL DRILLING COMPANY'(009) centered,
/1(192) 'Employee Details - Performance Appraisal Data'(031)
centered.
endif.
format color off.
if pnptimr1 = c_x. " Current Date
write: /2 'Period From :'(008), sy-datum,
'To:'(019), sy-datum.
elseif pnptimr2 = c_x. " Current Month
write: /2 'Period From :'(008), v_date, 'To:'(019), v_date1.
elseif pnptimr3 = c_x. " Current Year
write: /2 'Period From :'(008), v_date, 'To:'(019), v_date1.
elseif pnptimr4 = c_x. " Upto Today
write: /2 'Period From :'(008), c_date1, 'To:'(019), sy-datum.
elseif pnptimr5 = c_x. " From Today
write: /2 'Period From :'(008), sy-datum, 'To:'(019), c_date2.
else.
if ( pnpbegda is initial and pnpendda is initial ).
write: /2 'Period From :'(008), c_date1, 'To:'(019), c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
write: /2 'Period From :'(008), c_date1, 'To:'(019), pnpendda.
elseif not ( pnpbegda is initial and pnpendda is initial ).
write: /2 'Period From :'(008), pnpbegda,
'To:'(019), pnpendda.
endif.
endif.
if not ( r_pemp eq c_x or r_job eq c_x ).
write: 140 'Report Run Date:'(073), sy-datum.
if not pnpkostl[] is initial.
if pnpkostl-high is initial.
write: /2 'Cost Center :'(074), pnpkostl-low,
125 'Time :'(075), sy-uzeit.
else.
write: /2 'Cost Center From:'(076), pnpkostl-low+7(3),
'To:'(019), pnpkostl-high,
140 'Time :'(075), sy-uzeit.
endif.
else.
write: /140 'Time :'(075), sy-uzeit.
endif.
if not pnppernr[] is initial.
if pnppernr-high is initial.
write: /2 'Personal Number :'(077), pnppernr-low,
140 'User :'(078), sy-uname.
else.
write: /2 'Personal No.From:'(079), pnppernr-low,
'To:'(019), pnppernr-high,
140 'User :'(078), sy-uname.
endif.
else.
write: /140 'User :'(078), sy-uname.
endif.
write: /140 'Page No :'(080), sy-pagno.
else.
write: 48 'Report Run Date:'(073), sy-datum.
if not pnpkostl[] is initial.
if pnpkostl-high is initial.
write: /2 'Cost Center :'(074), pnpkostl-low,
48 'Time :'(075), sy-uzeit.
else.
write: /2 'Cost Center From:'(076), pnpkostl-low+7(3),
'To:'(019), pnpkostl-high,
48 'Time :'(075), sy-uzeit.
endif.
else.
write: /48 'Time :'(075), sy-uzeit.
endif.
if not pnppernr[] is initial.
if pnppernr-high is initial.
write: /2 'Personal Number :'(077), pnppernr-low,
48 'User :'(078), sy-uname.
else.
write: /2 'Personal No.From:'(079), pnppernr-low,
'To:'(019), pnppernr-high,
48 'User :'(078), sy-uname.
endif.
else.
write: /48 'User :'(078), sy-uname.
endif.
write: /48 'Page No :'(080), sy-pagno.
endif.
skip.
if r_per eq c_x.
write /1(193) sy-uline.
format color col_heading on.
write:/1 sy-vline, 2(10) 'Employee #'(011),
12 sy-vline, 13(40) 'Name'(012) centered,
53 sy-vline, 54(8) 'Grade'(013) centered,
62 sy-vline, 63(15) 'Nationality'(017) centered,
78 sy-vline, 79(10) 'Eng.Date'(014) centered,
89 sy-vline, 90(10) 'Birth Date'(016) centered,
100 sy-vline,101(25) 'Location'(026) centered,
126 sy-vline,127(25) 'Position'(015) centered,
152 sy-vline,153(40) 'Division'(018) centered,
193 sy-vline.
format color off.
write /1(193) sy-uline.
elseif r_pay eq c_x.
write /1(188) sy-uline.
format color col_heading on.
write:/1 sy-vline, 2(10) 'Employee #'(011),
12 sy-vline, 13(15) 'Basic'(033) centered,
28 sy-vline, 29(15) 'Housing Allow.'(034) centered,
44 sy-vline, 45(15) 'Sup.Allow.'(035) centered,
60 sy-vline, 61(15) 'Social Allow.'(036) centered,
76 sy-vline, 77(15) 'Child Allow.'(037) centered,
92 sy-vline, 93(15) 'Fixed Overtime'(038) centered,
108 sy-vline,109(15) 'R.A.Allow.'(041) centered,
124 sy-vline,125(15) 'Perform.Allow.'(039) centered,
140 sy-vline,141(15) 'Pension.Allow.'(059) centered,
156 sy-vline,157(15) 'Others'(040) centered,
172 sy-vline,173(15) 'Total'(042) centered,
188 sy-vline.
format color off.
write /1(188) sy-uline.
elseif r_edn eq c_x.
write /1(172) sy-uline.
format color col_heading on.
write:/1 sy-vline, 2(10) 'Employee #'(011),
12 sy-vline, 13(25) 'Discipline'(043) centered,
38 sy-vline, 39(20) 'Edu.Establishment'(044) centered,
59 sy-vline, 60(45) 'Institute'(045) centered,
105 sy-vline,106(15) 'Country'(046) centered,
121 sy-vline,122(30) 'Certificate'(047) centered,
152 sy-vline,153(19) 'Duration of Course'(048) centered,
172 sy-vline.
format color off.
write /1(172) sy-uline.
elseif r_pemp eq c_x.
write /1(97) sy-uline.
format color col_heading on.
write:/1 sy-vline, 12 sy-vline,
33 sy-vline, 34(21) 'Employment Period'(055) centered,
55 sy-vline, 81 sy-vline,
97 sy-vline.
write:/1 sy-vline, 2(10) 'Employee #'(011),
12 sy-vline, 13(20) 'Employer'(049) centered,
33 sy-vline, 34(10) 'From'(050) centered,
44 sy-vline, 45(10) 'To'(051) centered,
55 sy-vline, 56(25) 'Last Position'(052) centered,
81 sy-vline, 82(15) 'Country'(053) centered,
97 sy-vline.
format color off.
write /1(97) sy-uline.
elseif r_job eq c_x.
write /1(75) sy-uline.
format color col_heading on.
write:/1 sy-vline,
12 sy-vline,13(10) 'Date of'(054) centered,
23 sy-vline,49 sy-vline,
75 sy-vline.
write:/1 sy-vline,2(10) 'Employee #'(011),
12 sy-vline,13(10) 'Upgrading/'(058) centered,
23 sy-vline,24(25) 'Position'(015) centered,
49 sy-vline,50(25) 'Job'(056) centered,
75 sy-vline.
write:/1 sy-vline, 12 sy-vline,
13(10) 'Promotion'(057) centered,
23 sy-vline, 49 sy-vline,
75 sy-vline.
format color off.
write /1(75) sy-uline.
elseif r_app eq c_x.
format color col_heading on.
write: /1 sy-vline,2(56) sy-uline, 58 sy-vline,
/1 sy-vline, 2(56) text-025 centered color 3, 58 sy-vline.
write /1(58) sy-uline.
format color col_heading on.
write:/1 sy-vline, 2(10) 'Employee #'(011),
12 sy-vline, 13(4) 'Year'(067),
17 sy-vline, 18(40) 'Appraisal Text'(068) centered,
58 sy-vline.
format color off.
write /1(58) sy-uline.
endif.
endform. "top_of_page
*& Form end_of_page
Write the Page footers
form end_of_page.
if r_per eq c_x.
write : /(193) sy-uline.
elseif r_pay eq c_x.
write : /(188) sy-uline.
elseif r_edn eq c_x.
write : /(172) sy-uline.
elseif r_pemp eq c_x.
write /1(97) sy-uline.
elseif r_job eq c_x.
write /1(75) sy-uline.
elseif r_app eq c_x.
write /1(217) sy-uline.
endif.
endform. "end_of_page
*& Form Display_report
Write the Report Output
form display_report.
if r_all eq c_x.
if pers_tab[] is initial.
message i999 with
'No Personal Data found'(061).
else.
write: /1 sy-vline,2(51) sy-uline, 53 sy-vline,
/1 sy-vline, 2(50) text-020 centered color 3, 53 sy-vline.
write /1(193) sy-uline.
format color col_heading on.
write:/1 sy-vline, 2(10) 'Employee #'(011),
12 sy-vline, 13(40) 'Name'(012) centered,
53 sy-vline, 54(8) 'Grade'(013) centered,
62 sy-vline, 63(15) 'Nationality'(017) centered,
78 sy-vline, 79(10) 'Eng.Date'(014) centered,
89 sy-vline, 90(10) 'Birth Date'(016) centered,
100 sy-vline,101(25) 'Location'(026) centered,
126 sy-vline,127(25) 'Position'(015) centered,
152 sy-vline,153(40) 'Division'(018) centered,
193 sy-vline.
format color off.
write /1(193) sy-uline.
sort pers_tab by pernr.
loop at pers_tab.
format color col_normal.
write:/1 sy-vline, 2(10) pers_tab-pernr,
12 sy-vline, 13(40) pers_tab-ename,
53 sy-vline, 56(6) pers_tab-trfgr,
62 sy-vline, 63(15) pers_tab-ntext,
78 sy-vline, 79(10) pers_tab-hdate,
89 sy-vline, 90(10) pers_tab-gbdat,
100 sy-vline,101(25) pers_tab-name1,
126 sy-vline,127(25) pers_tab-ptext,
152 sy-vline,153(40) pers_tab-ctext,
193 sy-vline.
endloop.
write /1(193) sy-uline.
endif.
skip 3.
if pay_tab[] is initial.
message i999 with
'No Standard Pay Data found'(062).
else.
write: /1 sy-vline,2(42) sy-uline, 44 sy-vline,
/1 sy-vline, 2(42) text-021 centered color 3, 44 sy-vline.
format color col_heading on.
write /1(188) sy-uline.
write:/1 sy-vline, 2(10) 'Employee #'(011),
12 sy-vline, 13(15) 'Basic'(033) centered,
28 sy-vline, 29(15) 'Housing Allow.'(034) centered,
44 sy-vline, 45(15) 'Sup.Allow.'(035) centered,
60 sy-vline, 61(15) 'Social Allow.'(036) centered,
76 sy-vline, 77(15) 'Child Allow.'(037) centered,
92 sy-vline, 93(15) 'Fixed Overtime'(038) centered,
108 sy-vline,109(15) 'R.A.Allow.'(041) centered,
124 sy-vline,125(15) 'Perform.Allow.'(039) centered,
140 sy-vline,141(15) 'Pension.Allow.'(059) centered,
156 sy-vline,157(15) 'Others'(040) centered,
172 sy-vline,173(15) 'Total'(042) centered,
188 sy-vline.
format color off.
write /1(188) sy-uline.
sort pay_tab by pernr.
loop at pay_tab.
format color col_normal.
write:/1 sy-vline, 2(10) pay_tab-pernr,
12 sy-vline,
13(15) pay_tab-basic currency pay_tab-waers no-zero,
28 sy-vline,
29(15) pay_tab-hra_allow currency pay_tab-waers no-zero,
44 sy-vline,
45(15) pay_tab-sup_allow currency pay_tab-waers no-zero,
60 sy-vline,
61(15) pay_tab-soc_allow currency pay_tab-waers no-zero,
76 sy-vline,
77(15) pay_tab-chl_allow currency pay_tab-waers no-zero,
92 sy-vline,
93(15) pay_tab-fix_allow currency pay_tab-waers no-zero,
108 sy-vline,
109(15) pay_tab-ra_allow currency pay_tab-waers no-zero,
124 sy-vline,
125(15) pay_tab-per_allow currency pay_tab-waers no-zero,
140 sy-vline.
pay_tab-pen_allow = pay_tab-pen_allow * -1.
write: 141(15) pay_tab-pen_allow currency pay_tab-waers no-zero,
156 sy-vline,
157(15) pay_tab-oth_allow currency pay_tab-waers no-zero,
172 sy-vline,
173(15) pay_tab-tot_allow currency pay_tab-waers no-zero,
188 sy-vline.
endloop.
write /1(188) sy-uline.
endif.
skip 3.
if edn_tab[] is in
Maybe you are looking for
-
I'm having an error with the gregoriancalendar class. I have a class that gets an initial date froma database, and iterate until today. The problem is that its showing that today is day 262 and we are in day 232 of the year. Whats the problem???? Any
-
TS3988 How can I sync photos from my Iphone5 to my Ipad Mini??? Thanks!
How can I sync phots from my Iphone5 to my Ipad Mini?? Thank you!
-
Hello, We have recently deployed Lync 2013 as a migration from 2010, something our users have noticed what looks like a change in the response group behavior. When an incoming call comes in you see the usual toast with the caller ID in it as you did
-
Any reason FCP 7 Academic would not open on a MacBook after apparently installing as usual from DVDs, legal and all, with appropriate serial numbers, etc.?
-
Hi all, I am not getting any output for the following code. While debugging it doesn't show any values in first select statement itself (it_header table), but in database it has values. Please help me out. REPORTĀ ZSD_DAILY_INVOICE_REGISTER1 NO STAND