Please explain loop in this code
in this below code,what more is to be added as i am getting the values from the fields of table eban in the output but not from ekko,ekpo,eket.
where to put the loop or what else is reqd?
please suggest as i m new to this and not understanding.
LOOP AT IT_EBAN.
WA_FINAL-PURREQ = IT_EBAN-BANFN.
WA_FINAL-RITEM = IT_EBAN-BNFPO.
WA_FINAL-CRTDBY = IT_EBAN-ERNAM.
WA_FINAL-REQDT = IT_EBAN-BADAT.
WA_FINAL-REQSR = IT_EBAN-AFNAM.
WA_FINAL-SHTXT = IT_EBAN-TXZ01.
WA_FINAL-QTYREQ = IT_EBAN-MENGE.
WA_FINAL-UNITS = IT_EBAN-MEINS.
WA_FINAL-VALPR = IT_EBAN-PREIS.
WA_FINAL-CURR = IT_EBAN-WAERS.
WA_FINAL-PER = IT_EBAN-PEINH.
WA_FINAL-TPRICE = IT_EBAN-RLWRT.
WA_FINAL-TPRICE$ = IT_EBAN-RLWRT.
WA_FINAL-DELRQ = IT_EBAN-LFDAT.
WA_FINAL-REQREL = IT_EBAN-FRGDT.
WA_FINAL-PO = IT_EBAN-EBELN.
WA_FINAL-ITEM = IT_EBAN-EBELP.
WA_FINAL-PODATE = IT_EBAN-BEDAT.
WA_FINAL-QTYORD = IT_EBAN-BSMNG.
CLEAR IT_EKPO.
read table it_ekpo into wa_ekpo with key meins = wa_final-UNITS1
binary search.
WA_FINAL-UNITS1 = IT_EKPO-MEINS.
WA_FINAL-VALPR1 = IT_EKPO-NETPR.
WA_FINAL-PER1 = IT_EKPO-PEINH.
WA_FINAL-TPRICE1 = IT_EKPO-NETWR.
CLEAR IT_EKKO.
READ TABLE IT_EKKO WITH KEY waers = WA_FINAL-CURRPO
BINARY SEARCH.
WA_FINAL-CURRPO = IT_EKKO-WAERS.
CLEAR IT_EKET.
READ TABLE IT_EKET WITH KEY EINDT = WA_FINAL-DELPO
BINARY SEARCH.
WA_FINAL-DELPO = IT_EKET-EINDT.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
endloop.
CLEAR IT_EKPO.
read table it_ekpo into wa_ekpo with key meins = wa_final-UNITS1
binary search.
WA_FINAL-UNITS1 = IT_EKPO-MEINS.
WA_FINAL-VALPR1 = IT_EKPO-NETPR.
WA_FINAL-PER1 = IT_EKPO-PEINH.
WA_FINAL-TPRICE1 = IT_EKPO-NETWR.
In this code it_ekpo never gets populated. wa_ekpo gets filled if the read is succcessfull but wa_ekpo is not used..
CLEAR IT_EKKO.
READ TABLE IT_EKKO WITH KEY waers = WA_FINAL-CURRPO
BINARY SEARCH..
In this read WA_FINAL-CURRPO never has a value so the read will always fail
WA_FINAL-CURRPO = IT_EKKO-WAERS.
CLEAR IT_EKET.
READ TABLE IT_EKET WITH KEY EINDT = WA_FINAL-DELPO
BINARY SEARCH..
In this read WA_FINAL-DELPO never has a value so the read will always fail
Regards
Greg Kern
Similar Messages
-
Please explain what does this code does exactly
Can any one explain me what does the below code does.
This is the code written in one of the BADI (ME_PO_PRICING_CUST) .This badi will be triggered when a sales order delivery address is changed and while saving it this will be triggered. Over all what i come to know is they re trigerring a new version in this code. Can anyone explain me what exactly they are doing in this.Thanks...
METHOD IF_EX_ME_PO_PRICING_CUST~PROCESS_KOMK.
FIELD-SYMBOLS: <EKKO> TYPE ANY,
<PROCSTAT> TYPE MEPROCSTATE,
<FRGKE> TYPE FRGKE,
<YNAST> TYPE TABLE,
<WA_YNAST> TYPE NAST.
IM_EKKO-PROCSTAT = 02.
*break-point.
ASSIGN ('(SAPLMEPO)EKKO') TO <EKKO>.
ASSIGN ('(SAPLMEPO)YNAST[]') TO <YNAST>.
IF <EKKO> IS ASSIGNED.
ASSIGN COMPONENT 'PROCSTAT' OF STRUCTURE <EKKO> TO <PROCSTAT>.
ASSIGN COMPONENT 'FRGKE' OF STRUCTURE <EKKO> TO <FRGKE>.
IF <FRGKE> = 'R'.
<PROCSTAT> = '02'.
ENDIF.
ENDIF.
IF <YNAST> IS ASSIGNED.
IF <FRGKE> = 'R'.
LOOP AT <YNAST> ASSIGNING <WA_YNAST>.
<WA_YNAST>-AKTIV = 'X'.
ENDLOOP.
ENDIF.
ENDIF.
ENDMETHOD.r_htkl must be a range table. check the declaration part of it.
p_htkl is a parameter on selection screen i hope.
so, there are four fields on a range table.(range table are similar to your select options)
1. SIGN ( I or E - Inclusive or Exculsive)
2. OPTION(options like EQ = euqal, BT = Between, CP = contains pattern etc)
3. LOW (value)
4. HIGH (value)
so..
IF NOT p_htkl IS INITIAL. " checks if some thing is being passed to the parameter
r_htkl-sign='I'. " give the sign a value I i.e it make inclusive sign
r_htkl-option='EQ'. " EQ to option means you value will be checked for a equal to condition
r_htkl-low=p_htkl. " the low field in now assigned the same value of the parameter p_hktl
APPEND r_htkl. " the range table is appended.
endif.
so this range table can be used in select statements as :
select * from abcd into gt where xyz in r_hktl. ==> this will check for a EQ condition with value in r_hktl-low in database or
in if statements like : if abc in r_hktl. ==> this will check the EQ condition of abc with the r_hktl-low.
Had it been
r_htkl-sign='E'.
then the condition is same but with a NOT.. that means NOT EQ or NOT BT etc.
as exclusive of the option.
etc.
hope this is clear.
AND PLEASE CLOSE THE OTHER THREAD (duplicate) -
Please Explain the sequencer ( J2EE Code )
Hi,
The following code is a part of Dao, I could understand the flow of the Dao classes but I really could not make out why this sequencer program is used.
Please explain and send any URL which will help.
Comments Plz.
package lrnsource.src.com.lrn.dao.common;
import java.sql.Connection;
import java.sql.SQLException;
* The Sequencer class represents the oracle
* implementation of Sequencer.
public interface Sequencer {
* Gets the next number in sequence for the given entity.
* @param entity the given entity.
* @param con the connection object.
* @return Returns the next number in sequence.
* @exception throws SQLException when some problem with DB.
public long getNextSequenceNumber(String entityName, Connection con) throws SQLException;
* Gets the current number in sequence for the given entity.
* @param entity the given entity.
* @param con the connection object.
* @return Returns the current number in sequence.
* @exception throws SQLException when some problem with DB.
public long getCurrentSequenceNumber(String entityName, Connection con) throws SQLException;
package lrnsource.src.com.lrn.dao.common;
import com.lrn.common.CommonConstants;
* This class provides instance of sequencer
public class SequencerFactory {
* Public method which gets the runtime implementation class
* for implementing the sequence generation related functions
* @Param seqType the sequencer type.
* @return Sequencer interface, the type of implementation class.
public static Sequencer getSequencer(int seqType){
Sequencer sequencer = null;
switch (seqType) {
case CommonConstants.ORACLE_SEQUENCER:
sequencer = new GemsOracleSequencer();
return sequencer;
package lrnsource.src.com.lrn.common;
* This class contains the constants used across lrn.
* <p>
public class CommonConstants {
public static final int ORACLE_PERSISTENCE = 1;
public static final int ORACLE_SEQUENCER = 1;
public static final String DATASOURCE_JNDI = "java:/comp/env/jdbc/GemsDB";
public static final String ERROR_MESSAGES = "";
public static final String CERTIFICATION_SERVICE = "java:/comp/env/ejb/certification";
public static final String QUESTION_SERVICE = "java:/comp/env/ejb/question";
public static final String REGISTRY_SERVICE = "java:/comp/env/ejb/registry";
public static final String ADMIN_USER = "ADMIN";
}dear friend,
please look here:
http://help.sap.com/saphelp_47x200/helpdata/EN/c1/416a55de2a11d3b4ff006094b9b9dd/frameset.htm
regards, -
Please help me correct this code
Hi, I have to develop a Java applications that converts a positive number from base 10 to another base. It has to prompt the user to enter the number to be converted an the base to be converted into. After conversion is completed, the program should ask for another conversion. The program would run in a loop until the user would decide to end it. In case of an error entry as a base less than 2, the program should warn the user about the type of error and ask the user to re-enter the values. At the nd of the program, provide a statistic with how many conversions the user has done.
Please look at code below, and see where i went wrong, i can't seem to figure out the formula for conversions.
import java.io.*;
public class Class1
public static void main (String[] args)throws IOException
int num=0;
int base=0;
int result;
int rem;
int arr[]=new int[20];
int count=0;
boolean prompt= true;
for(int i=0; i<arr.length; i++)
while(prompt)
//int i=0 ;
String s;
int x;
BufferedReader aa =
new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a positive number for the conversion:");
s = aa.readLine();
num = Integer.parseInt(s);
System.out.println("Enter the base number that you want to convert your number:");
s=aa.readLine();
base = Integer.parseInt(s);
if(base >= 2)
if(num > 0)
{ rem= num%base;
num=num/base;
arr=rem;
System.out.println("The converted number is: " + arr[i]);
System.out.print("Would you like to go on (yes/no)?");
s=aa.readLine();
prompt= s.equalsIgnoreCase("no");
count++;
//i++;
else
System.out.println("The number must be greater that 0, please enter an other number!!");
else
System.out.println("The base number is not the appropriate,must be greater of two!!");
//promt the user if he/she wants to continiue or not
System.out.println("You have used the conversion thingy " count " times, You Freak!");
System.in.read();Since I have already started this I will try to make the conversion work. ( usually I do not like to to other people's homework ).
import java.io.*;
public class Class1
static char[] theDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
public static void main (String[] args)throws IOException
int num=0;
int base=0;
int result;
int rem;
String arr[]=new String[20];
int count=0;
boolean prompt= true;
for(int i=0; i<arr.length && prompt; i++) {
while(prompt) {
String s;
int x;
BufferedReader aa =
new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a positive number for the conversion:");
s = aa.readLine();
num = Integer.parseInt(s);
System.out.println("Enter the base number that you want to convert your number:");
s=aa.readLine();
base = Integer.parseInt(s);
if( base >= 2 && base < 17 ) {
if (num > 0) {
s = "";
while ( num > 0 ) {
rem= num%base;
s = theDigits[rem] + s;
num=num/base;
arr[count] = new String(s);
count++;
//promt the user if he/she wants to continiue or not
System.out.println("The converted number is: " + s + " base " + base );
System.out.print("Would you like to go on (yes/no)?");
s=aa.readLine();
prompt= s.equalsIgnoreCase("yes");
else
System.out.println("The number must be greater that 0, please enter an other number!!");
else
System.out.println("The base number is not the appropriate,must be greater of two and lower of 17!!");
System.out.println("You have used the conversion thingy " +count +" times, You Freak!");
System.in.read();
}kurt -
PLEASE HELP ME WITH THIS CODE I NEED A NAV BAR ASAP!!!!
The code is below I just want a simple navigation bar that when I click on biography it takes me to the biography page and so on...I even tried the "href" nothing works I try it in live view and it doesnt work I try it out of live view and it still doesnt work Im using DW CS5 This page was made using a DW template but I changed it around to fit my liking
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WebIntersect &Bull;Find ElizabethVictoria</title>
<style type="text/css">
<!--
body {
background: #000;
margin: 0;
padding: 0;
color: #FCCFDD;
background-color: #000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 100%;
line-height: 1.4;
/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
padding: 0;
margin: 0;
h1, h2, h3, h4, h5, h6, p {
margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
padding-right: 15px;
padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
color: #FCCFDD;
font-weight: bold;
text-align: center;
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
color: #000;
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
color:#808080;
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
a:visited {
color: #FCCFDD;
text-decoration: underline;
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
text-decoration: none;
color: #FCCFDD;
/* ~~ this container surrounds all other divs giving them their percentage-based width ~~ */
.container {
width: 80%;
max-width: 1260px;/* a max-width may be desirable to keep this layout from getting too wide on a large monitor. This keeps line length more readable. IE6 does not respect this declaration. */
min-width: 780px;/* a min-width may be desirable to keep this layout from getting too narrow. This keeps line length more readable in the side columns. IE6 does not respect this declaration. */
background: #000;
margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout. It is not needed if you set the .container's width to 100%. */
/* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */
.header {
background: #000;
color: #FCCFDD;
.sidebar1 {
float: left;
width: 20%;
padding-bottom: 10px;
background-color: #000;
background-image: url(images/Untitled-6.gif);
background-repeat: no-repeat;
.content {
padding: 10px 0;
width: 60%;
float: left;
.sidebar2 {
float: left;
width: 20%;
padding: 10px 0;
background-color: #000;
background-image: url(images/Untitled-6.gif);
/* ~~ This grouped selector gives the lists in the .content area space ~~ */
.content ul, .content ol {
padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
/* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */
ul.nav {
list-style: none; /* this removes the list marker */
border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */
margin-bottom: 15px; /* this creates the space between the navigation on the content below */
ul.nav li {
border-bottom: 1px solid #666; /* this creates the button separation */
ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
padding: 5px 5px 5px 15px;
display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */
text-decoration: none;
background: #8090AB;
color: #000;
ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
background: #6F7D94;
color: #FFF;Where is your html code? or better yet a link to your site in question.
-
HELP PLEASE - WHATS WRONG WITH THIS CODE
Hi. I get this message coming up when I try to compile the code,
run:
java.lang.NullPointerException
at sumcalculator.SumNumbers.<init>(SumNumbers.java:34)
at sumcalculator.SumNumbers.main(SumNumbers.java:93)
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)
I am not sure whats wrong with the code. Any assistance would be nice. The code is below.
package sumcalculator;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SumNumbers extends JFrame implements FocusListener {
JTextField value1;
JTextField value2;
JLabel equals;
JTextField sum;
JButton add;
JButton minus;
JButton divide;
JButton multiply;
JLabel operation;
public SumNumbers() {
SumNumbersLayout customLayout = new SumNumbersLayout();
getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
getContentPane().setLayout(customLayout);
value1.addFocusListener(this);
value2.addFocusListener(this);
sum.setEditable(true);
value1 = new JTextField("");
getContentPane().add(value1);
value2 = new JTextField("");
getContentPane().add(value2);
equals = new JLabel("label_1");
getContentPane().add(equals);
sum = new JTextField("");
getContentPane().add(sum);
add = new JButton("+");
getContentPane().add(add);
minus = new JButton("-");
getContentPane().add(minus);
divide = new JButton("/");
getContentPane().add(divide);
multiply = new JButton("*");
getContentPane().add(multiply);
operation = new JLabel();
getContentPane().add(operation);
setSize(getPreferredSize());
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
public void focusGained(FocusEvent event){
try {
float total = Float.parseFloat(value1.getText()) +
Float.parseFloat(value2.getText());
sum.setText("" + total);
} catch (NumberFormatException nfe) {
value1.setText("0");
value2.setText("0");
sum.setText("0");
public void focusLost(FocusEvent event){
focusGained(event);
public static void main(String args[]) {
SumNumbers window = new SumNumbers();
window.setTitle("SumNumbers");
window.pack();
window.show();
class SumNumbersLayout implements LayoutManager {
public SumNumbersLayout() {
public void addLayoutComponent(String name, Component comp) {
public void removeLayoutComponent(Component comp) {
public Dimension preferredLayoutSize(Container parent) {
Dimension dim = new Dimension(0, 0);
Insets insets = parent.getInsets();
dim.width = 711 + insets.left + insets.right;
dim.height = 240 + insets.top + insets.bottom;
return dim;
public Dimension minimumLayoutSize(Container parent) {
Dimension dim = new Dimension(0, 0);
return dim;
public void layoutContainer(Container parent) {
Insets insets = parent.getInsets();
Component c;
c = parent.getComponent(0);
if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+48,128,40);}
c = parent.getComponent(1);
if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+48,128,40);}
c = parent.getComponent(2);
if (c.isVisible()) {c.setBounds(insets.left+408,insets.top+48,56,40);}
c = parent.getComponent(3);
if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+48,152,40);}
c = parent.getComponent(4);
if (c.isVisible()) {c.setBounds(insets.left+128,insets.top+136,72,40);}
c = parent.getComponent(5);
if (c.isVisible()) {c.setBounds(insets.left+248,insets.top+136,72,40);}
c = parent.getComponent(6);
if (c.isVisible()) {c.setBounds(insets.left+368,insets.top+136,72,40);}
c = parent.getComponent(7);
if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+136,72,40);}
c = parent.getComponent(8);
if (c.isVisible()) {c.setBounds(insets.left+176,insets.top+48,56,40);}
}Thank you. How do i amend this? I have defined value1though.Yes, you did - but after the call to addFocusListener(...). It needs to be before it.
BTW, you did the same thing with "value2.addFocusListener(this)" and "sum.setEditable(true)" on the next two lines. You're attempting to call a method on an object that doesn't exist yet (i.e., you haven't called new yet). -
hi to all experts ,
my requirement is print a barcode..The first part is an alv with two editable fields when user checks the checkbox and changes the second coloumn that no of prints are to be printed ....everything is fine but the problem is if suppose first 3 checkboxes are checked and qty to print is 3 for each .So the total no of prints should be 9 which im able to see in the print preview ......but the problem is when after seeing the print preview when we are back to the alv screen and uncheck one checkbox so now the pages should be 6 but it is still 9 what could be the problem here is my code since i cannot post full im sending in parts.......any help will greatly apprieciated ..........................thanks
TYPE-POOLS: slis.
*TYPES DECLARATIONS
TYPES:BEGIN OF ty_output,
cbox(1) TYPE c,"selection checkbox
menge1 TYPE char16,"QUANTITY TO PRINT
mblnr TYPE mkpf-mblnr,"MATERIAL DOCUMENT NUMBER
bwart TYPE mseg-bwart,"MOVEMENT TYPE
btext TYPE t156t-btext,"MOVEMENT TYPE DESCRIPTION
matnr TYPE mseg-matnr,"MATERIAL NUMBER
maktx TYPE makt-maktx,"MATERIAL DESCRIPTION
menge2 TYPE mseg-menge,"QUANTITY
meins TYPE mseg-meins,"BASE UNIT OF MEASUREMENT
werks TYPE mseg-werks,"PLANT
lgort TYPE mseg-lgort,"STORAGE LOCATION
ebeln TYPE mseg-ebeln,"PO DOCUMENT NUMBER
lifnr TYPE mseg-lifnr,"VENDOR
bldat TYPE mkpf-bldat,"DOCUMENT DATE
budat TYPE mkpf-budat,"POSTING DATE
usnam TYPE mkpf-usnam,"USER ID
xblnr TYPE mkpf-xblnr,"MATERIAL SLIP
END OF ty_output.
TYPES : BEGIN OF ty_data,
menge TYPE mseg-menge,"QUANTITY
mblnr TYPE mkpf-mblnr,"MATERIAL DOCUMENT NUMBER
bwart TYPE mseg-bwart,"MOVEMENT TYPE
matnr TYPE mseg-matnr,"MATERIAL NUMBER
meins TYPE mseg-meins,"BASE UNIT OF MEASUREMENT
werks TYPE mseg-werks,"PLANT
lgort TYPE mseg-lgort,"STORAGE LOCATION
ebeln TYPE mseg-ebeln,"PO DOCUMENT NUMBER
lifnr TYPE mseg-lifnr,"VENDOR
bldat TYPE mkpf-bldat,"DOCUMENT DATE
budat TYPE mkpf-budat,"POSTING DATE
usnam TYPE mkpf-usnam,"USER ID
xblnr TYPE mkpf-xblnr,"MATERIAL SLIP
END OF ty_data.
TYPES: BEGIN OF ty_btext,
btext TYPE t156t-btext,
bwart TYPE t156-bwart,
END OF ty_btext.
TYPES : BEGIN OF ty_maktx,
maktx TYPE makt-maktx,
matnr TYPE makt-matnr,
END OF ty_maktx.
TYPES: BEGIN OF ty_mard,
matnr TYPE mard-matnr,
lgpbe TYPE mard-lgpbe,
END OF ty_mard.
*INTERNAL TABLES
DATA: it_output TYPE STANDARD TABLE OF ty_output,
it_data TYPE STANDARD TABLE OF ty_data,
it_btext TYPE STANDARD TABLE OF ty_btext,
it_maktx TYPE STANDARD TABLE OF ty_maktx,
it_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv,
it_events TYPE STANDARD TABLE OF slis_alv_event,
it_header TYPE slis_t_listheader,
it_smart TYPE STANDARD TABLE OF zmm_im_001_struc,
it_mard TYPE STANDARD TABLE OF ty_mard.
*WORK AREAS
DATA: wa_output TYPE ty_output,
wa_data TYPE ty_data,
wa_btext TYPE ty_btext,
wa_maktx TYPE ty_maktx,
wa_fieldcat TYPE slis_fieldcat_alv,
wa_events TYPE slis_alv_event,
wa_header TYPE slis_listheader,
wa_smart LIKE LINE OF it_smart,
wa_layout TYPE slis_layout_alv,
wa_mard TYPE ty_mard.
*FLAGS AND CONSTANTS
DATA: fl_sel TYPE flag.
DATA: fl_del TYPE flag,
gv_count TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
so_mblnr FOR mkpf-mblnr,
so_bwart FOR mseg-bwart,"MOVEMENT TYPE
so_bldat FOR mkpf-bldat,"DOCUMENT DATE
so_budat FOR mkpf-budat,"POSTING DATE
so_matnr FOR mseg-matnr,"MATERIAL ID
so_meins FOR mseg-meins,"BASE UNIT OF MEASUREMENT
so_werks FOR mseg-werks,"PLANT
so_lgort FOR mseg-lgort,"STORAGE LOCATION
so_lifnr FOR mseg-lifnr,"VENDOR
so_xblnr FOR mkpf-xblnr,"MATERIAL SLIP
so_ebeln FOR mseg-ebeln,"PURCHASE DOC
so_usnam FOR mkpf-usnam.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2
WITH FRAME TITLE text-002.
PARAMETERS : 1x3 RADIOBUTTON GROUP
grp1 DEFAULT 'X',
2x4 RADIOBUTTON GROUP
grp1.
SELECTION-SCREEN END OF BLOCK b2.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT 1(82) text-007.
*SELECTION-SCREEN COMMENT 89(4) text-008. " First part of your comment
*SELECTION-SCREEN END OF LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_mblnr-low.
*GETTING F4 HELP FOR THE
>FIELD MBLNR( MATERIAL DOCUMENT NUMBER)
PERFORM get_f4val .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_mblnr-high.
GETTING F4 HELP FOR THE
FIELD MBLNR( MATERIAL DOCUMENT NUMBER)
PERFORM get_f4val .
AT SELECTION-SCREEN.
PERFORM valid_bwart.
PERFORM valid_selscreen.
if no records are found displaying an error message
IF sy-dbcnt EQ 0.
MESSAGE e003(zmimr012).
ENDIF.
START-OF-SELECTION.
PERFORM get_data.
PERFORM populate_data.
PERFORM get_fcat.
PERFORM get_events.
PERFORM populate_events.
PERFORM get_layout.
PERFORM display_alv.
Refresh : it_output,
it_data,
it_smart.
*& Form GET_DATA
FORM get_data .
SELECT b~menge
a~mblnr
b~bwart
b~matnr
b~meins
b~werks
b~lgort
b~ebeln
b~lifnr
a~bldat
a~budat
a~usnam
a~xblnr
INTO CORRESPONDING
FIELDS OF TABLE it_data
FROM mkpf AS a
INNER JOIN mseg AS b ON
amblnr = bmblnr
AND amjahr = bmjahr
WHERE a~mblnr IN so_mblnr
AND b~bwart IN so_bwart
AND b~bwart IN ('101', '105')
AND a~bldat IN so_bldat
AND a~budat IN so_budat
AND b~matnr IN so_matnr
AND b~matnr NE space
AND b~werks IN so_werks
AND b~lgort IN so_lgort
AND b~ebeln IN so_ebeln
AND b~lifnr IN so_lifnr
AND a~xblnr IN so_xblnr
AND a~usnam IN so_usnam.
SELECT btext
bwart
FROM t156t
INTO TABLE it_btext
FOR ALL ENTRIES IN it_data
WHERE spras EQ 'EN'
AND bwart = it_data-bwart
AND sobkz = ''
AND kzbew = 'B'
AND kzzug = ''
AND kzvbr = ''.
SELECT maktx
matnr
FROM makt INTO
TABLE it_maktx
FOR ALL ENTRIES IN it_data
WHERE matnr EQ it_data-matnr
AND spras EQ 'E'.
SELECT matnr
lgpbe
FROM mard INTO
TABLE it_mard
FOR ALL ENTRIES IN it_data
WHERE matnr EQ it_data-matnr
AND werks EQ it_data-werks
AND lgort EQ it_data-lgort.
ENDIF.
ENDFORM. " GET_DATA
*& Form GET_F4VAL
FORM get_f4val .
TYPES : BEGIN OF ly_mblnr,
mblnr TYPE mkpf-mblnr,
END OF ly_mblnr.
DATA: lc_mblnr TYPE dfies-fieldname
VALUE 'MBLNR',
lc_s_mblnr TYPE help_info-dynprofld
VALUE 'SO_MBLNR-LOW',
lc_dynnr
TYPE sy-dynnr VALUE '1000',
lc_repid TYPE sy-repid.
DATA: lt_mblnr TYPE STANDARD
TABLE OF ly_mblnr,
lv_mblnr TYPE ly_mblnr,
lt_return TYPE STANDARD TABLE OF
ddshretval WITH HEADER LINE.
CLEAR:lt_mblnr[],lv_mblnr,lt_return[],lt_return.
SELECT mblnr FROM mkpf
INTO TABLE lt_mblnr.
SORT lt_mblnr.
DELETE ADJACENT DUPLICATES FROM lt_mblnr.
lc_repid = sy-repid.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = lc_mblnr
value_org = 'S'
dynpprog = lc_repid
dynpnr = lc_dynnr
dynprofield = lc_s_mblnr
TABLES
value_tab = lt_mblnr
return_tab = lt_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
ELSE.
lc_mblnr = lt_return-fieldval.
ENDIF.
ENDFORM. " GET_F4VAL
Edited by: mozam khan on Feb 28, 2009 4:39 AM*& Form PF_STATUS
FORM pf_status_set USING
ex_tab TYPE slis_t_extab .
SET PF-STATUS 'ZMIMR012_GUI' EXCLUDING ex_tab.
ENDFORM. " PF_STATUS
*& Form user_command
text
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield .
DATA: p_ref1 TYPE REF TO cl_gui_alv_grid.
CASE r_ucomm .
WHEN 'EXEC' .
CLEAR p_ref1.
IF p_ref1 IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = p_ref1.
ENDIF.
IF p_ref1 IS NOT INITIAL.
CALL METHOD p_ref1->check_changed_data.
ENDIF.
LOOP AT it_output INTO wa_output WHERE cbox EQ 'X'.
READ TABLE it_mard INTO wa_mard WITH KEY matnr = wa_output-matnr.
IF sy-subrc EQ 0.
wa_smart-lgpbe = wa_mard-lgpbe.
ENDIF.
wa_smart-matnr = wa_output-matnr.
wa_smart-maktx = wa_output-maktx.
wa_smart-meins = wa_output-meins.
wa_smart-bldat = wa_output-bldat.
wa_smart-no_cop = wa_output-menge1.
APPEND wa_smart TO it_smart.
CLEAR: wa_smart,wa_output.
ENDLOOP.
CALL METHOD p_ref1->REFRESH_TABLE_DISPLAY.
CHECK fl_del NE 'X'.
IF 1x3 = 'X'.
PERFORM print_smartform1x3.
ELSE.
PERFORM print_smartform2x4.
ENDIF.
WHEN 'SEL_ALL'.
fl_sel = 'X'." setting up the flag for all selection.
PERFORM sel_rec.
rs_selfield-refresh = 'X'.
WHEN 'DES_ALL'.
fl_del = 'X'.
PERFORM del_sel.
rs_selfield-refresh = 'X'.
ENDCASE.
ENDFORM. " user_command
" top_of_page
*& Form display_alv
FORM display_alv .
DATA: l_repid TYPE sy-repid.
l_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_pf_status_set = 'PF-STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'top_of_page'
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = it_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_output
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display_alv
*& Form get_layout
FORM get_layout .
wa_layout-box_fieldname = 'CBOX' .
wa_layout-box_tabname = 'IT_OUTPUT'.
wa_layout-colwidth_optimize = 'X'.
ENDFORM. " get_layout
" print_smartform_1x3
*& Form valid_bwart
text
--> p1 text
<-- p2 text
FORM valid_bwart .
TYPES:BEGIN OF ly_bwart,
bwart TYPE mseg-bwart,
END OF ly_bwart.
DATA:it_bwart TYPE TABLE OF ly_bwart WITH HEADER LINE.
IF so_bwart[] IS NOT INITIAL.
SELECT bwart FROM mseg INTO TABLE it_bwart
FOR ALL ENTRIES IN so_bwart[]
WHERE bwart <= so_bwart-high AND bwart => so_bwart-low.
LOOP AT it_bwart.
IF it_bwart-bwart NE '101' OR it_bwart-bwart NE '105' .
CONTINUE.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " valid_bwart
*& Form print_smartform2x4
text
-->P_WA_SMART text
-->P_IT_SMART text
FORM print_smartform1x3.
DATA : fm_name TYPE rs38l_fnam,
control_parameters TYPE ssfctrlop,
wa_job_output_info TYPE ssfcrescl,
ssfcompin TYPE ssfcompin,
ssfcompop TYPE ssfcompop.
ssfcompin-dialog = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
ARCHIVE_PARAMETERS =
USER_SETTINGS = 'X'
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJ =
OUTPUT_OPTIONS =
control_parameters = control_parameters
IMPORTING
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZMM_IM_001'
variant = ' '
direct_call = ' '
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 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.
control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.
LOOP AT it_smart INTO wa_smart.
IF wa_smart-no_cop IS NOT INITIAL.
MOVE wa_smart-no_cop TO gv_count.
ENDIF.
DO gv_count TIMES.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = control_parameters
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = ssfcompop
USER_SETTINGS = 'X'
wa_display = wa_smart
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDDO.
CLEAR gv_count.
CLEAR : wa_smart.
ENDLOOP.
CALL FUNCTION 'SSF_CLOSE'
IMPORTING
job_output_info = wa_job_output_info
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " print_smartform2x4
*& Form print_smartform2x4
text
--> p1 text
<-- p2 text
FORM print_smartform2x4 .
DATA : fm_name TYPE rs38l_fnam,
control_parameters TYPE ssfctrlop,
wa_job_output_info TYPE ssfcrescl,
ssfcompin TYPE ssfcompin,
ssfcompop TYPE ssfcompop.
ssfcompin-dialog = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
ARCHIVE_PARAMETERS =
USER_SETTINGS = 'X'
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJ =
OUTPUT_OPTIONS =
control_parameters = control_parameters
IMPORTING
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZMM_IM_002'
variant = ' '
direct_call = ' '
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 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.
control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.
LOOP AT it_smart INTO wa_smart.
IF wa_smart-no_cop IS NOT INITIAL.
MOVE wa_smart-no_cop TO gv_count.
ENDIF.
DO gv_count TIMES.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = control_parameters
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = ssfcompop
USER_SETTINGS = 'X'
wa_display = wa_smart
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDDO.
CLEAR: gv_count.
ENDLOOP.
CALL FUNCTION 'SSF_CLOSE'
IMPORTING
job_output_info = wa_job_output_info
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " print_smartform2x4
*& Form valid_selscreen
text
--> p1 text
<-- p2 text
FORM valid_selscreen .
SELECT b~menge
a~mblnr
b~bwart
b~matnr
b~meins
b~werks
b~lgort
b~ebeln
b~lifnr
a~bldat
a~budat
a~usnam
a~xblnr
INTO CORRESPONDING
FIELDS OF TABLE it_data
FROM mkpf AS a
INNER JOIN mseg AS b ON
amblnr = bmblnr
AND amjahr = bmjahr
WHERE a~mblnr IN so_mblnr
AND b~bwart IN so_bwart
AND b~bwart IN ('101', '105')
AND a~bldat IN so_bldat
AND a~budat IN so_budat
AND b~matnr IN so_matnr
AND b~matnr NE space
AND b~werks IN so_werks
AND b~lgort IN so_lgort
AND b~ebeln IN so_ebeln
AND b~lifnr IN so_lifnr
AND a~xblnr IN so_xblnr
AND a~usnam IN so_usnam.
ENDFORM. " valid_selscreen
*& Form sel_rec
text
--> p1 text
<-- p2 text
FORM sel_rec .
DATA: lv_tabix TYPE sy-tabix.
LOOP AT it_output INTO wa_output.
lv_tabix = sy-tabix.
wa_output-cbox = 'X'.
MODIFY it_output FROM wa_output TRANSPORTING cbox.
CLEAR: wa_output.
ENDLOOP.
ENDFORM. " sel_rec -
Please help me debug this code!
HELP! I can't figure out where I'm going wrong. Thank you.
import java.lang.Math.*;
import java.io.*;
public class Feature_Recognizer {
Vertices vertices; /* storage bin for vertices*/
Edges edges; /* storage bin for edges*/
Faces faces; /* storage bin for faces*/
/*** Reads file and stores data into vertices, edges, and faces bins ***/
void readFile(String file)
BufferedReader inputFile = null; /*start reading the input file*/
String[] info;
String temp;
/*need to fix io exceptions in java.lang
* They need to be caught or declared to be thrown*/
try{
inputFile = new BufferedReader(new FileReader(file));
catch (FileNotFoundException e){
System.out.println("File named"+file+"does not exist");
return;
catch (IOException e){
System.out.println("IO Exception. Error reading from:"+file);
return;
/*begin reading in data array, set into vertices/edges/faces*/
inputFile.readLine(); /* will skip comments in input files*/
temp = inputFile.readLine(); /* store number of vertices*/
vertices = new Vertices(Integer.parseInt(temp.trim())); /* initialize the vertices based on data array*/
inputFile.readLine(); /* will skip comments in input files*/
/* store vertices*/
int i=0;
while(i++<vertices.total)
temp = inputFile.readLine();
info = temp.split(" ");
vertices.addVertex(Double.parseDouble(info[0]),Double.parseDouble(info[1]),Double.parseDouble(info[2]));
inputFile.readLine(); /* will skip comments in input files*/
temp = inputFile.readLine(); /* store number of edges*/
edges = new Edges(Integer.parseInt(temp.trim())); /* initialize the edges based on the data array*/
inputFile.readLine(); /* will skip comments in input files*/
/* store edges*/
int i1=0;
while(i1++<edges.total)
temp = inputFile.readLine();
info = temp.split(" ");
edges.addEdge(vertices.getVertex(Integer.parseInt(info[0])),
vertices.getVertex(Integer.parseInt(info[1])),
Integer.parseInt(info[2]));
inputFile.readLine(); /* will skip comments in input files*/
temp = inputFile.readLine(); /* store number of faces*/
faces = new Faces(Integer.parseInt(temp.trim())); /* initialize faces based on the data array*/
inputFile.readLine(); /* will skip comments in input files*/
/* store faces*/
int i2=0;
while(i2++<faces.total)
/* input # of edges*/
temp = inputFile.readLine();
faces.addFace(Integer.parseInt(temp.trim()));
/* input faces*/
temp = inputFile.readLine();
info = temp.split(" ");
int j=0;
while(j++<faces.getFace(i2).Edge_Totals)
if(Integer.parseInt(info[j]) < 0)
faces.getFace(i2).edges.addEdge(edges.getEdge(Math.abs(Integer.parseInt(info[j]))),true);
else
faces.getFace(i2).edges.addEdge(edges.getEdge(Math.abs(Integer.parseInt(info[j]))),false);
/* input normal vector*/
temp = inputFile.readLine();
info = temp.split(" ");
int j1=0;
while(j1++<3)
faces.getFace(i2).normal[j1] = Integer.parseInt(info[j1]);
/***possibly place another IO exception in here
catch (IOException e){
System.out.println("IO Exception");
return;
/*** State Classes: edge, face, vertex ***/
/* Nested Edge object class*/
class Edge{
int identity, /* identity of edge*/
type; /* concave or convex?*/
Vertices vertices; /* vertices that make up the edge*/
Faces faces; /* faces corresponding to the edge*/
double length; /* length of edge*/
/* Edge class constructor*/
Edge(int IDENTITY, Vertex A, Vertex B, int TYPE)
identity = IDENTITY;
vertices = new Vertices(2);
vertices.addVertex(A);
vertices.addVertex(B);
type = TYPE;
faces = new Faces(2);
/* Length_Calculator will compute the length of edge*/
void Length_Calculator()
length = Math.pow( (vertices.getVertex(2).x - vertices.getVertex(1).x)*(vertices.getVertex(2).x - vertices.getVertex(1).x)
+ (vertices.getVertex(2).y - vertices.getVertex(1).y)*(vertices.getVertex(2).y - vertices.getVertex(1).y)
+ (vertices.getVertex(2).z - vertices.getVertex(1).z)*(vertices.getVertex(2).z - vertices.getVertex(1).z)
, .5 );
/* getFaces finds the faces which are related to the edge
(returns the runtime class of an object)*/
void getFaces()
int i=1;
while( i++ <=Feature_Recognizer.this.faces.total){
int j=1;
while( j++<=Feature_Recognizer.this.faces.getFace(i).Edge_Totals){
if(identity == Feature_Recognizer.this.faces.getFace(i).edges.getEdge(j).identity){
faces.addFace(Feature_Recognizer.this.faces.getFace(i));
/* Edges object class (Edge bin)nested Edges Class*/
class Edges
int index, /* current index in array*/
total; /* total number of edges*/
Edge[] edges; /* actual edges bin*/
boolean[] sign; /* positive or negative (for face object)*/
/* Edges class constructor*/
Edges(int Edge_Totals)
index = 0;
total = Edge_Totals;
edges = new Edge[Edge_Totals];
sign = new boolean[Edge_Totals];
/* method to add an already existing Edge object*/
void addEdge(Edge e)
edges[index++] = e;
/* method to an already existing Edge object*/
/* and state if it is negative or positive (for faces only)*/
void addEdge(Edge e, boolean isNegative)
sign[index] = isNegative;
edges[index++] = e;
/* method to create and add an Edge object*/
void addEdge(Vertex a, Vertex b, int type)
edges[index++] = new Edge(index,a,b,type);
/* returns the Edge corresponding to its identity*/
Edge getEdge(int identity)
return edges[identity-1];
/* finds the lengths and faces of each Edge in the bin*/
void Edge_Stats()
int i=0;
while(i++<total){
edges.Length_Calculator();
edges[i].getFaces();
/* Face object class nested face class*/
class Face
int identity, /* edge identity*/
Edge_Totals; /* number of edges that make up the face*/
Edges edges; /* edges that make up the face*/
int[] normal; /* the vector of the normal to the face*/
/* Face class constructor*/
Face(int IDENTITY, int numE)
identity = IDENTITY;
Edge_Totals = numE;
edges = new Edges(numE);
normal = new int[3];
/* Faces object class (Face bin)nested faces class*/
class Faces
int index, /* current index in array*/
total; /* total number of Faces*/
Face[] faces; /* actual faces bin*/
/* Faces class constructor*/
Faces(int numFaces)
index = 0;
total = numFaces;
faces = new Face[numFaces];
/* method to sum an already existing Face object*/
void addFace(Face f)
faces[index++] = f;
/* method to create and sum a Face object*/
void addFace(int numE)
faces[index++] = new Face(index,numE);
/* returns the Face corresponding to its identity*/
Face getFace(int identity)
return faces[identity-1];
/* Vertex object class nested vertex class*/
class Vertex
int identity; /* vertex identity*/
double x,y,z; /* coordinates*/
/* Vertex class constructor*/
Vertex(int IDENTITY, double X, double Y, double Z)
identity = IDENTITY;
x = X;
y = Y;
z = Z;
/* Vertices object class (Vertex bin)nested vertices bin*/
class Vertices
int index, /* current index in array*/
total; /* total number of vertices*/
Vertex[] points; /* actual Vertex bin*/
/* Vertices class constructor*/
Vertices(int numVertices)
index = 0;
total = numVertices;
points = new Vertex[numVertices];
/* method to add an already existing Vertex object*/
void addVertex(Vertex v)
points[index++] = v;
/* method to create and add a Vertex object*/
void addVertex(double x, double y, double z)
points[index++] = new Vertex(index,x,y,z);
/* returns the Vertex corresponding to it's identity*/
Vertex getVertex(int identity)
return points[identity-1];
/* displays each edge's type based on data array and the corresponding faces to that edge*/
void printEdges_Found(){
String shape;
System.out.println("Edge\tType\tFaces");
int i=0;
while(i++<edges.total){
if(edges.getEdge(i).type == 0)
shape = "Concave";
if(edges.getEdge(i).type == 1)
shape = "Convex";
else
println("Input file must have 0 or 1 for shape type");
System.out.println(i + "\t" + shape + "\t" + edges.getEdge(i).faces.getFace(1).identity
+ ", " + edges.getEdge(i).faces.getFace(2).identity + "\t");
System.out.println();
/* VRML output file maker*/
void VRML_Output(String file)
PrintStream outputFile = null;
outputFile = new PrintStream(new FileOutputStream(file));
outputFile.println("#VRML V2.0 utf8");
outputFile.println("\tShape{");
outputFile.println("\t\tgeometry IndexedFaceSet{");
outputFile.println("\t\t\tcoord Coordinate{");
outputFile.print("\t\t\t\tpoint[ ");
int i=0;
while(i++<vertices.total){
if(i > 0)
if(i%4 == 0) {
outputFile.println("\n");
outputFile.print("\t\t\t\t\t");
outputFile.print(vertices.getVertex(i+1).x + " " + vertices.getVertex(i+1).y
+ " " + vertices.getVertex(i+1).z);
if(i != vertices.total-1)
outputFile.print(",");
outputFile.println("]");
outputFile.println("\t\t\t}");
outputFile.print("\t\t\tcoordIndex[");
int i3=1;
while(i3++<=faces.total){
int j2=0;
while(j2++<faces.getFace(i3).edges.total){
if(faces.getFace(i3).edges.sign[j2])
outputFile.print(faces.getFace(i3).edges.getEdge(j2+1).vertices.getVertex(1).identity-1 + ", ");
else
outputFile.print(faces.getFace(i3).edges.getEdge(j2+1).vertices.getVertex(2).identity-1 + ", ");
outputFile.println("-1");
if(i != faces.total)
outputFile.print("\t\t\t\t ");
outputFile.println("\t\t\t]");
outputFile.println("\t\t}");
outputFile.println("\t}");
outputFile.close();
/*** feature recognition step:***/
/* finds the slots*/
void Slot_Finder()
int i=1;
while(i++<=edges.total){
double L=0.0, W=0.0, H=0.0;
if(edges.getEdge(i).type == 0) {
int vertexID = edges.getEdge(i).vertices.getVertex(1).identity;
int j=1;
while(j++<=edges.total)
if(vertexID == edges.getEdge(j).vertices.getVertex(1).identity || vertexID == edges.getEdge(j).vertices.getVertex(2).identity){
if(edges.getEdge(j).vertices.getVertex(1).z - edges.getEdge(j).vertices.getVertex(2).z != 0)
H = edges.getEdge(j).length;
else
if(edges.getEdge(j).length > L){
W = L;
L = edges.getEdge(j).length;
else
W = edges.getEdge(j).length;
System.out.println("A slot was found at edge #" + i + " with length " + L + ", width " + W + " and height " + H);
/* finds the bases*/
void Base_Finder()
int i=1;
while(i++<=faces.total)
if(faces.getFace(i).normal[2] == -1)
double L, W;
if (faces.getFace(i).edges.getEdge(1).length >= faces.getFace(i).edges.getEdge(2).length )
L = faces.getFace(i).edges.getEdge(1).length; W = faces.getFace(i).edges.getEdge(2).length;
else
L = faces.getFace(i).edges.getEdge(2).length; W = faces.getFace(i).edges.getEdge(1).length;
System.out.println("A base was found at face #" + i + " with length " + L + " and width " + W);
/* finds the ribs*/
void Rib_Finder()
int i=1;
while(i++<=faces.total){
if(faces.getFace(i).normal[2] == 1) {
double L, W;
if ( faces.getFace(i).edges.getEdge(1).length >= faces.getFace(i).edges.getEdge(2).length ){
L = faces.getFace(i).edges.getEdge(1).length; W = faces.getFace(i).edges.getEdge(2).length;
else {
L = faces.getFace(i).edges.getEdge(2).length; W = faces.getFace(i).edges.getEdge(1).length;
if(W < 1.5 && faces.getFace(i).edges.getEdge(1).type == 1 && faces.getFace(i).edges.getEdge(2).type == 1)
System.out.println("A rib was found at face #" + i + " with length " + L + " and width " + W);
/*** main program***/
public static void main(String[] args) {
Feature_Recognizer a = new Feature_Recognizer();
a.readFile(args[0]);
a.edges.Edge_Stats();
a.Edges_Found();
a.VRML_Output(args[1]);
a.Slot_Finder();
a.Base_Finder();
a.Rib_Finder();
}/*main ends here*/Try formatting your code better. Or use an auto formatter.
You have too many '}' before this statement delete one.
There is no such package as java.lang.Math
You have about 4 more bugs to fix to get it to compile.
Nearly there. -
All of a sudden I can't redeem promo codes for apps on my mac and don't see a place to do that on the mini. This could really slow things down - Any suggestions?
@aesadmin when searching thru these forums for apple configurator issues & app not authorized threads the common feature appears to have been iTunes (mainly to do with the device not authorized) - however i'm beginning to think this is not related on this issue.
i've tried to deauthorise my mac, then reauthorize - no change.
i've tried to re-download the redemption code spreadsheet & reimport - no change.
even tried to just change the apple id password - no change.
after all the above failed, i did the longwinded itunes downgrade - no change. -
Please, Help me check this code
public Data class{
private static void new(){
PreparedStatement ps = conn.prepareStatement("INSERT INTO Members " +
"VALUES(?, ?, ?, ?)");
ps.setString(1, "14");
ps.setString(2, "Mike");
ps.setString(3, "Nwabikwo");
ps.setString(4, "14/10/2008");
ps.executeUpdate();
public static void main(String [] arg){
new();
Where conn is a Connection object that connects to JDBC-ODBC
When I tried to run it, I expect it to update the Database but it does not
and no exception is reported.
Please, tell me where the problem is.Phemmy wrote:
public Data class{
private static void new(){
PreparedStatement ps = conn.prepareStatement("INSERT INTO Members " +
"VALUES(?, ?, ?, ?)");
ps.setString(1, "14");
ps.setString(2, "Mike");
ps.setString(3, "Nwabikwo");
ps.setString(4, "14/10/2008");
ps.executeUpdate();
public static void main(String [] arg){
new();
Where conn is a Connection object that connects to JDBC-ODBC
When I tried to run it, I expect it to update the Database but it does not
and no exception is reported.
Please, tell me where the problem is.it's because you don't commit the update and close your Connection properly. you don't close any resources correctly, so your code is flawed in every way.
you save a date as a string? awful. make a date a date.
% -
class Vehicles
public String name="<unnamed>";
Vehicles Ferrari1=new Vehicles();
Vehicles Honda1=new Vehicles();
Vehicles Toyota1=new Vehicles();
Ferrari.nameFor="Ferrari";
Honda.nameFor="Honda";
Toyota.nameFor="Toyota";
public void main(String[]args)
System.out.println("Hello Folks!");
System.out.println(Ferrari.name);
System.out.println(Honda.name);
System.out.println(Toyota.name);
System.out.println("Bye Now!");
It always says i am missing an indentifier in line 6-8 when i complie. Please help somebody!!!class Vehicles
public String name = "unnamed";
Vehicles Ferrari=new Vehicles();
public void main(String[]args)
System.out.println("Hello Folks!");
Vehicles Ferrari=new Vehicles();
System.out.println(Ferrari.name);
System.out.println("Bye Now!"); -
Please help me with this code. Newbie here!
Hi all,
Below is a sample from the project that I am doing now. Would someone be so kind as to tell me how come the internal frame doesn't appear and the compiler keeps returning an error pointing to "setContentPane(mainDeskTop);"?
Thanks in advance.
package myprojects.xmlquery;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class XMLQuery extends Frame {
public XMLQuery() {
super("XMLQuery"); //Don't know what is this statement for?
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0);
JDesktopPane mainDeskTop;
mainDeskTop = new JDesktopPane(); //a specialized layered pane
JInternalFrame frame = new JInternalFrame("test",true,true,true,true);
frame.setSize(100,100);
frame.setLocation(0,0);
frame.setVisible(true); //set frame visible
mainDeskTop.add(frame);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {}
setContentPane(mainDeskTop);
public static void main(String args[]) {
System.out.println("Starting XMLQuery...");
XMLQuery mainFrame = new XMLQuery();
mainFrame.setSize(400, 400);
mainFrame.setTitle("XMLQuery");
mainFrame.setVisible(true);Extend JFrame instead of Frame.
Denis -
Can someone explain to me this code!
public final static class SessionType
public static final SessionType APP_BASE = new SessionType();
public static final SessionType ADVANCED_APP_BASE = new SessionType();
public static final SessionType THREAD_BASE = new SessionType();
public static final SessionType USER_DEFINED = new SessionType();
private SessionType()
in the another class, i write a statement :
private static SessionType sessiontype = SessionType.APP_BASE;
then, what is the value of the sessiontype ????
or, did the virtual machine allocate any memory space to variable sessiontype ?if i instantiate an instance of the type SessionType, since the class variable declared as static is not bind to the instance of the class, so the instance of the SessionType did'nt have the variable APP_BASE, ADVANCED_APP_BASE, ......,so the instance of the SessionType only obtain the Constructor of the class, is this right ??!!!
-
Please explain to me this issue!!!!
public class abc
public static a1 = new abc();
public static a2 = new abc();
public abc()
what happen, if i instantiate the class abc with private abc myabc = new abc(); in another class' object ????i still don't understand, the a1,a2 are static and it belong to the class itself and not belong to instances of the class, this i understands, but what is the structure of the a1 or a2 attribute belong to class, is it still a1,a2,and a constructor.if it is true, then many a1 and a2 are in the a1 a2 attribute of the class itself.
-
Please help me optimize this code..
i have already checked the indexes of the tables and used the primary keys.
r_datum-sign = gco_sign_i.
r_datum-low = docdate_from.
IF NOT docdate_to IS INITIAL.
r_datum-option = gco_option_bt.
r_datum-high = docdate_to.
ELSE.
r_datum-option = gco_option_eq.
ENDIF.
APPEND r_datum.
CLEAR r_datum.
r_vbeln-sign = gco_sign_i.
r_vbeln-low = docnum_from.
IF NOT docnum_to IS INITIAL.
r_vbeln-option = gco_option_bt.
r_vbeln-high = docnum_to.
ELSE.
r_vbeln-option = gco_option_eq.
ENDIF.
APPEND r_vbeln.
CLEAR r_vbeln.
process_web_rset salesgroup
r_vkgrp
gco_sign_i
gco_option_eq.
* Get Total (Confirmed) Qty
PERFORM get_valid_itemcateg TABLES gr_pstyv.
* Header
SELECT vbak~vbeln
vbkd~inco1
vbak~erdat
vbak~gueen
vbak~ernam
vbkd~bstkd
vbak~kunnr
APPENDING CORRESPONDING FIELDS OF TABLE lt_hdr
FROM vbak INNER JOIN vbkd
ON vbak~vbeln EQ vbkd~vbeln
WHERE vbak~vbeln IN r_vbeln
AND vbak~erdat IN r_datum
AND vbak~vkgrp IN r_vkgrp
AND vbak~kunnr EQ customer
AND vbkd~posnr EQ lv_posnr
SORT lt_hdr BY vbeln.
LOOP AT lt_hdr.
* Customer Name
SELECT SINGLE kna1~name1
INTO lv_cusname
FROM kna1
WHERE kna1~kunnr EQ lt_hdr-kunnr.
MOVE lt_hdr-vbeln TO listing-sa.
MOVE lt_hdr-ernam TO listing-ordered_thru.
MOVE lt_hdr-bstkd TO listing-po.
MOVE lt_hdr-kunnr TO listing-customer.
MOVE lv_cusname TO listing-customer_name.
MOVE lt_hdr-erdat TO listing-date_created.
MOVE lt_hdr-gueen TO listing-valid_until.
CONCATENATE lt_hdr-erdat+6(2) lt_hdr-erdat+4(2) lt_hdr-erdat+0(4) INTO
listing-date_created SEPARATED BY '.'.
CONCATENATE lt_hdr-gueen+6(2) lt_hdr-gueen+4(2) lt_hdr-gueen+0(4) INTO
listing-valid_until SEPARATED BY '.'.
* Get Mode of Sale
IF lt_hdr-inco1 EQ 'FOB'.
listing-incoterms = co_inco1.
ELSEIF lt_hdr-inco1 EQ 'CIF'.
listing-incoterms = co_inco2.
ENDIF.
* Get Status
SELECT SINGLE bezei
FROM tvbst JOIN vbuk
ON tvbst~statu EQ vbuk~gbstk
INTO listing-status
WHERE tbnam EQ co_tbnam
AND spras EQ co_spras
AND fdnam EQ co_fdnam
AND vbuk~vbeln EQ listing-sa.
* Get Ship to party
SELECT SINGLE name1
FROM vbpa INNER JOIN kna1
ON vbpa~kunnr = kna1~kunnr
INTO listing-ship_to
WHERE vbeln EQ listing-sa
AND posnr EQ lv_posnr
AND parvw EQ 'WE'.
* Get Plant
SELECT SINGLE vbap~werks
t001w~name1
FROM vbap INNER JOIN t001w
ON vbap~werks EQ t001w~werks
INTO (listing-plant,
listing-plant_text)
WHERE vbap~vbeln EQ listing-sa
* Items
SELECT SINGLE
a~matnr
a~pstyv
b~bmeng
b~vrkme
INTO (lv_matnr,
lv_pstyv,
lv_bmeng,
lv_vrkme)
FROM vbap AS a INNER JOIN vbep AS b
ON a~vbeln = b~vbeln
AND a~posnr = b~posnr
WHERE a~vbeln = lt_hdr-vbeln
AND a~posnr EQ co_posnr
AND a~pstyv IN gr_pstyv
* Use zshowitem to identify items for display on SO
lv_convvl = 1.
* Convert Quantity
PERFORM check_conversion USING: lv_bmeng
listing-total_uom
lv_pstyv
lv_vrkme
lv_matnr. "<<CR002-DEVK944861 ins
IF listing-total_uom IS INITIAL.
MOVE lv_vrkme TO listing-total_uom.
ENDIF.
IF listing-total_uom IS INITIAL.
MOVE lv_vrkme TO listing-total_uom.
ENDIF.
vl_sum1 = vl_sum1 + lv_bmeng.
* ENDLOOP.
listing-total_qty = vl_sum1.
REFRESH lv_itab.
CLEAR: vl_sum1,
vl_sum2.
* Scheduling Agreement Item and Served Qty
SELECT SINGLE
b~vbeln AS vbeln2
b~rfmng
b~meins
INTO (lv_vbeln2,
lv_rfmng,
lv_meins)
FROM vbap AS a INNER JOIN vbfa AS b
ON a~vbeln EQ b~vbelv
AND a~posnr EQ b~posnv
WHERE a~vbeln = lt_hdr-vbeln
AND a~pstyv IN gr_pstyv
AND b~vbtyp_n EQ co_vbtyp_n.
IF sy-subrc EQ 0.
* Goods Issue Status per Item
SELECT SINGLE wbstk
FROM vbuk
INTO vl_drstatus
WHERE vbeln = lv_vbeln2.
* Convert Quantity
PERFORM check_conversion USING: lv_rfmng
listing-served_uom
lv_pstyv
lv_meins
lv_matnr. " <<CR002-DEVK944861 ins
* Pass Value
IF listing-served_uom IS INITIAL.
MOVE lv_meins TO listing-served_uom.
ENDIF.
vl_served_qty = vl_served_qty + lv_rfmng.
CLEAR: lt_scheditm,
vl_drstatus,
vl_sum3,
vl_meins.
ENDIF.
listing-served_qty = vl_served_qty.
CLEAR vl_served_qty.
* Append List
APPEND listing.
CLEAR: lt_hdr,
lv_itab,
lt_scheditm,
listing,
vl_datum1,
vl_datum2,
vl_sum1,
vl_sum2,
vl_sum3.
ENDLOOP.
IF sy-subrc <> 0.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = 'W'
cl = 'ZECOM'
number = 000
IMPORTING
return = return.
ELSE.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = 'S'
cl = 'ZECOM'
number = 001
IMPORTING
return = return.
ENDIF.
ENDFUNCTION.As mentioned by others avoid into corresponding fields.
If you have to join vbak/vbkd then at least try to use
Sales Organization
Distribution Channel
Division
FOr customer name do n ot select for each document, select for all entries in lt_hdr_aux before the loop where lt_hdr_aux[] = lt_hdr[] with adjacent duplicates by customer deleted and then in the loop use read instead.
Don't use inner joins on vbap to other tables instead select vbap information for all documents selected and then read.
etc etc
Use st05 to review which table accesses are giving you a problem and concentrate first on those taking into account
- not to retrieve data multiple times e.g. is customer is cust1 for deoc1 and for doc 10 then only retrieve once as detailed above.
- optimise the actual select statement - no into corresponding, using keys etc
Maybe you are looking for
-
Can anyone advise me on my nano 6th generation not syncing with newly purchased songs? The songs appear in my purchased list but simply won't sync to my nano. There is plenty of memory left. I am using Windows 7. Never had an issue before. Thanks!
-
Problem in Data extraction into BI
Hi Guys, I am having a strange problem and unable to idenitfy the root cause. I am hoping that some one can help me with this issue. System Details: BI 7.0 SAP ECC 5.0 Current Design: We have created a DSO in the BI system and created a custom extrac
-
Hi We need to get order acknowledgement dates for POs, from which tables of MM, this can be obtained ? Regards Vijay
-
Unable to sync iCloud iPhone 5 Clear app?
I have the "Clear" app on my phone. I can't seem to get it to sync to iCloud nor my iMac. Does anyone have this app on their phone and gotten it to work with iCloud? If so, please share the steps. I've already gone to the developer site and feel I've
-
I Have an ipad2 my mum has an ipad3. I can FaceTime her but she can't FaceTime me it comes up with not available. We have both put email addresses in, can anyone help please?