Performance Tuning Issues ( How to Optimize this Code)
_How to Optimize this Code_
FORM MATL_CODE_DESC.
SELECT * FROM VBAK WHERE VKORG EQ SAL_ORG AND
VBELN IN VBELN AND
VTWEG IN DIS_CHN AND
SPART IN DIVISION AND
VKBUR IN SAL_OFF AND
VBTYP EQ 'C' AND
KUNNR IN KUNNR AND
ERDAT BETWEEN DAT_FROM AND DAT_TO.
SELECT * FROM VBAP WHERE VBELN EQ VBAK-VBELN AND
MATNR IN MATNR.
SELECT SINGLE * FROM MAKT WHERE MATNR EQ VBAP-MATNR.
IF SY-SUBRC EQ 0.
IF ( VBAP-NETWR EQ 0 AND VBAP-UEPOS NE 0 ).
IF ( VBAP-UEPVW NE 'B' AND VBAP-UEPVW NE 'C' ).
MOVE VBAP-VBELN TO ITAB1-SAL_ORD_NUM.
MOVE VBAP-POSNR TO ITAB1-POSNR.
MOVE VBAP-MATNR TO ITAB1-FREE_MATL.
MOVE VBAP-KWMENG TO ITAB1-FREE_QTY.
MOVE VBAP-KLMENG TO ITAB1-KLMENG.
MOVE VBAP-VRKME TO ITAB1-FREE_UNIT.
MOVE VBAP-WAVWR TO ITAB1-FREE_VALUE.
MOVE VBAK-VTWEG TO ITAB1-VTWEG.
MOVE VBAP-UEPOS TO ITAB1-UEPOS.
ENDIF.
ELSE.
MOVE VBAK-VBELN TO ITAB1-SAL_ORD_NUM.
MOVE VBAK-VTWEG TO ITAB1-VTWEG.
MOVE VBAK-ERDAT TO ITAB1-SAL_ORD_DATE.
MOVE VBAK-KUNNR TO ITAB1-CUST_NUM.
MOVE VBAK-KNUMV TO ITAB1-KNUMV.
SELECT SINGLE * FROM KONV WHERE KNUMV EQ VBAK-KNUMV AND
KSTEU = 'C' AND
KHERK EQ 'A' AND
KMPRS = 'X'.
IF SY-SUBRC EQ 0.
ITAB1-REMARKS = 'Manual Price Change'.
ENDIF.
SELECT SINGLE * FROM KONV WHERE KNUMV EQ VBAK-KNUMV AND
KSTEU = 'C' AND
KHERK IN ('C','D') AND
KMPRS = 'X' AND
KRECH IN ('A','B').
IF SY-SUBRC EQ 0.
IF KONV-KRECH EQ 'A'.
MOVE : KONV-KSCHL TO G_KSCHL.
G_KBETR = ( KONV-KBETR / 10 ).
MOVE G_KBETR TO G_KBETR1.
CONCATENATE G_KSCHL G_KBETR1 '%'
INTO ITAB1-REMARKS SEPARATED BY SPACE.
ELSEIF KONV-KRECH EQ 'B'.
MOVE : KONV-KSCHL TO G_KSCHL.
G_KBETR = KONV-KBETR.
MOVE G_KBETR TO G_KBETR1.
CONCATENATE G_KSCHL G_KBETR1
INTO ITAB1-REMARKS SEPARATED BY SPACE.
ENDIF.
ELSE.
ITAB1-REMARKS = 'Manual Price Change'.
ENDIF.
CLEAR : G_KBETR, G_KSCHL,G_KBETR1.
MOVE VBAP-KWMENG TO ITAB1-QTY.
MOVE VBAP-VRKME TO ITAB1-QTY_UNIT.
IF VBAP-UMVKN NE 0.
ITAB1-KLMENG = ( VBAP-UMVKZ / VBAP-UMVKN ) * VBAP-KWMENG.
ENDIF.
IF ITAB1-KLMENG NE 0.
VBAP-NETWR = ( VBAP-NETWR / VBAP-KWMENG ).
MOVE VBAP-NETWR TO ITAB1-INV_PRICE.
ENDIF.
MOVE VBAP-POSNR TO ITAB1-POSNR.
MOVE VBAP-MATNR TO ITAB1-MATNR.
MOVE MAKT-MAKTX TO ITAB1-MAKTX.
ENDIF.
SELECT SINGLE * FROM VBKD WHERE VBELN EQ VBAK-VBELN AND
BSARK NE 'DFUE'.
IF SY-SUBRC EQ 0.
ITAB1-INV_PRICE = ITAB1-INV_PRICE * VBKD-KURSK.
APPEND ITAB1.
CLEAR ITAB1.
ELSE.
CLEAR ITAB1.
ENDIF.
ENDIF.
ENDSELECT.
ENDSELECT.
ENDFORM. " MATL_CODE_DESC
Hi Vijay,
You could start by using INNER JOINS:
SELECT ......
FROM ( VBAK
INNER JOIN VBAP
ON VBAPVBELN = VBAKVBELN
INNER JOIN MAKT
ON MAKTMATNR = VBAPMATNR AND
MAKT~SPRAS = SYST-LANGU )
INTO TABLE itab
WHERE VBAK~VBELN IN VBELN
AND VBAK~VTWEG IN DIS_CHN
AND VBAK~SPART IN DIVISION
AND VBAK~VKBUR IN SAL_OFF
AND VBAK~VBTYP EQ 'C'
AND VBAK~KUNNR IN KUNNR
AND VBAK~ERDAT BETWEEN DAT_FROM AND DAT_TO
AND VBAP~NETWR EQ 0
AND VBAP~UEPOS NE 0
Regards,
John.
Similar Messages
-
How to optimize this code + is design proper
Well I have to implement tree programming here , what i mean by tree
programming is i have data stored in tree format i,e I have parent
object which will have child objects of same type the level of depth can
go any long:
I am able to store objects in tree format and also able to display properly Here
is code but I am facing problems when i have to filter some child nodes based on some conditions:
I have two question is this code fine is there anything wrong with desin Plus how to handle removing child node in tree scenation where child can be in any place.Below is code
package menu;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.chartis.gp.support.util.BrokerSupportUtil;
import com.chartis.gp.support.vo.Links;
import com.chartis.kernel.user.UserVO;
import com.chartis.kernel.utils.Utils;
public class Utility{
/* IN this class NavModel,CModel,CNode are some dummy classes
* which help us read contents form some resources which are stored in dummy format
* as Example of tree format stored data below is the example
* tree
* child1
* child2
* child3
* child3-1
* child:q
* child:r
* child:a
* child3-2
* child4
private static void populateChildLinks(NavModel navModel, Object objectNode, Links parent ){
try{
List<Links> childLinks = new ArrayList<Links>();
Iterator it = navModel.getChildren( objectNode );
while( it.hasNext() ){
NavNode node = (NavNode) it.next();
CNode contentNode = node.getContentNode();
Links links = new Links();
links.setNodeName( contentNode.getNodeName() );
childLinks.add( links );
if( navModel.hasChildren( node ) ){
populateChildLinks( node, links );
parent.setChildren( childLinks );
catch( Exception e ){
private static Links createCategoryLinks(String categoryLinkName){
Links categoryLinks = new Links();
categoryLinks.setNodeName( categoryLinkName );
return categoryLinks;
public static Links setupLinks(String categoryLinkName,String name) {
Links categoryLinks=null;
CModel contentModel = new CModel();
NavModel navModel = new NavModel();
categoryLinks = Utility.createCategoryLinks( categoryLinkName);
Object objectNode = contentModel.getLocator().findByUniqueName(name);
if( objectNode != null ){
if( navModel.hasChildren( objectNode ) ){
populateChildLinks( navModel,objectNode, categoryLinks );
// This is where i am facing issue once i get list of links of childs
// i have to delete how can i find that particular child in the list
// do i have to iterate through all the links and delete or which
// way is better
private static void filterLinks( Links parentNode,
List<Links> childNodeList ){
List<Links> filteredResourceList = new ArrayList<Links>();
if( childNodeList!=null ){
Iterator<Links> childNodeIt = childNodeList.iterator();
while( childNodeIt.hasNext() ){
Links childNode = (Links) childNodeIt.next();
if(childNode.getChildren().size() >0 ){
filterLinks( childNode, childNode.getChildren() );
boolean removeNode = filterContents( childNode);
if(! removeNode ){
filteredResourceList.add( childNode );
Iterator<Links> filteredResourceIt = filteredResourceList.iterator();
while( filteredResourceIt.hasNext() ){
Links childNode = (Links) filteredResourceIt.next();
parentNode.getChildren().remove( childNode );
// Let us consider this as some dummy method which returns true or false based on some conditions
private static boolean filterContents( menu.Links childNode ){
return false;
package menu;
import java.util.List;
public class Links{
private String nodeName;
private List<Links> children;
public List<Links> getChildren(){
return children;
public void setChildren( List<Links> children ){
this.children = children;
public String getNodeName(){
return nodeName;
public void setNodeName( String nodeName ){
this.nodeName = nodeName;
package menu;
public class TreeDisplay{
public static void main( String[] args ){
Links link = Utility.setupLinks( "SomeName", "ResiyrbceBane");
Utility.filterLinks( link, link.getChildren() );
}Is the utility class with so many static class is ok?Vicky wrote:
Thanks TPD
If you could write more on it , it will be great i rarely find ocasations of using interfaces , however i don't think creating a new tree with valid node could be better solution as you have to create a new tree keeping the same hierarchy .The advantage is that all other components do not need to know that they work with a filtered tree.
Certainly you can do it the other way around bye passing the tree and the filter to eg. the <tt>NotePrinter</tt> Object, but than all components working with the tree meight neet to know that ther are Node filters.
I just came up with the Idea to give the nodes themselfes knowlege of the Filter via <tt>setFilter(Filter<Links> myFilter)</tt>. You would call this on the root node and in the <tt>getChildren()</tt> method you would check if the child apllies to the filter and pass that filter to the eliable childs before putting them into a new collection which is returned to the caller. Ofcause you should initialise the <tt>this.filter</tt> property in <tt>Links</tt> with a <tt>ALL_NODES</tt> constant.
Also you should resist the tamptation to make the <tt>this.filter</tt> property in <tt>Links</tt> static. This would save you one line of code in the <tt>getCildren()</tt> method by the cost that you cannot have different trees with different filters in the same JVM.
This kind of interference between threads is pretty hard to find later in production environments...
bye
TPD -
How to Optimize this code?
Hi All
I have a procedure which runs fine,but since the data in table XYZ,ABC runs into millions it becomes too slow..Can any one guide me in optimising the code.I have already created indexes on these columns.
CREATE OR REPLACE PROCEDURE test AS
CURSOR c1 IS
SELECT
t.cutGrp,
t.cutGrpCode,
t.modelDesc,
t.startdate,
t.enddate,
avg(t.price) price,
avg(t.netprice) netprice,
sum(t.awdQTY) awardqty,
sum(t.planQTY) revplanqty,
FROM
ABC t
GROUP BY
t.cutGrp,
t.cutGrpCode,
t.modelDesc,
t.startdate,
t.enddate;
counter NUMBER := 0;
l_aggregate NUMBER;
BEGIN
FOR rec IN c1
LOOP
counter := counter + 1;
SELECT
sum(t.anotherQTY) INTO l_aggregate
FROM
XYZ t
WHERE
t.cutstomer_Grp = rec.cutGrp
AND t.cutGrp_Code = rec.cutGrpCode
AND t.product_model = rec.modelDesc;
UPDATE XYZ t
SET
t.testQTY = l_aggregate,
t.testprice = rec.price,
t.testnetprice = rec.netprice,
t.testawardQTY = rec.awardqty,
t.testplanQTY = rec.revplanqty,
t.fcstartdate = rec.startdate,
t.fcenddate = rec.enddate
WHERE
t.cutstomer_Grp = rec.cutGrp
AND t.cutGrp_Code = rec.cutGrpCode
AND t.cutGrp_Code = rec.modelDesc;
END LOOP;
COMMIT WORK;
END test;
SHOW ERRORS;Hi All
This the only query i could come up with...But this gives me error
ORA-30926 unable to get a stable set of rows in the source tables.Also this code does not address
SELECT
sum(t.anotherQTY) INTO l_aggregate
FROM
XYZ t
WHERE
t.cutstomer_Grp = rec.cutGrp
AND t.cutGrp_Code = rec.cutGrpCode
AND t.product_model = rec.modelDesc;<b>This is what i came up with </b> so any code help is appreciated
MERGE INTO sgforecastrecord b
USING (
SELECT
cutGrp
cutGrpCode ,
modelDesc,
startdate,
enddate,
avg(price) price,
avg(netprice) netprice,
sum(awdQTY) awardqty,
sum(planQTY) revplanqty
FROM
ABC
GROUP BY
cutGrp,
cutGrp,
modelDesc,
startdate,
enddate
) t
on (
t.cutstomer_Grp = b.cutGrp
AND t.cutGrp_Code = b.cutGrpCode
AND t.product_model = b.modelDesc;
WHEN MATCHED THEN
UPDATE set
b.testprice = t.price,
b.testnetprice = t.netprice,
b.testawardQTY = t.awardqty,
b.testplanQTY = t.revplanqty,
b.fcstartdate = t.startdate,
b.fcenddate = t.enddate
-
How to optimize this select statement its a simple select....
how to optimize this select statement as the records in earlier table is abt i million
and this simplet select statement is not executing and taking lot of time
SELECT guid
stcts
INTO table gt_corcts
FROM corcts
FOR all entries in gt_mege
WHERE /sapsll/corcts~stcts = gt_mege-ctsex
and /sapsll/corcts~guid_pobj = gt_Sagmeld-guid_pobj.
regards
AroraHi Arora,
Using Package size is very simple and you can avoid the time out and as well as the problem because of memory. Some time if you have too many records in the internal table, then you will get a short dump called TSV_TNEW_PAGE_ALLOC_FAILED.
Below is the sample code.
DATA p_size = 50000
SELECT field1 field2 field3
INTO TABLE itab1 PACKAGE SIZE p_size
FROM dtab
WHERE <condition>
Other logic or process on the internal table itab1
FREE itab1.
ENDSELECT.
Here the only problem is you have to put the ENDSELECT.
How it works
In the first select it will select 50000 records ( or the p_size you gave). That will be in the internal table itab1.
In the second select it will clear the 50000 records already there and append next 50000 records from the database table.
So care should be taken to do all the logic or process with in select and endselect.
Some ABAP standards may not allow you to use select-endselect. But this is the best way to handle huge data without short dumps and memory related problems.
I am using this approach. My data is much more huge than yours. At an average of atleast 5 millions records per select.
Good luck and hope this help you.
Regards,
Kasthuri Rangan Srinivasan -
Anyone knows how to make this code to netbeans??
anyone knows how to make this code to netbeans?? i just want to convert it into netbeans... im not really advance with this software... anyway..just reply if you have any idea...or steps how to build it... etc.... thanks guys...
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.util.regex.*;
public class FilterTable {
public static void main(String args[]) {
Runnable runner = new Runnable() {
public void run() {
JFrame frame = new JFrame("Sorting JTable");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Object rows[][] = {
{"AMZN", "Amazon", 41.28},
{"EBAY", "eBay", 41.57},
{"GOOG", "Google", 388.33},
{"MSFT", "Microsoft", 26.56},
{"NOK", "Nokia Corp", 17.13},
{"ORCL", "Oracle Corp.", 12.52},
{"SUNW", "Sun Microsystems", 3.86},
{"TWX", "Time Warner", 17.66},
{"VOD", "Vodafone Group", 26.02},
{"YHOO", "Yahoo!", 37.69}
Object columns[] = {"Symbol", "Name", "Price"};
TableModel model =
new DefaultTableModel(rows, columns) {
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
returnValue = getValueAt(0, column).getClass();
} else {
returnValue = Object.class;
return returnValue;
JTable table = new JTable(model);
final TableRowSorter<TableModel> sorter =
new TableRowSorter<TableModel>(model);
table.setRowSorter(sorter);
JScrollPane pane = new JScrollPane(table);
frame.add(pane, BorderLayout.CENTER);
JPanel panel = new JPanel(new BorderLayout());
JLabel label = new JLabel("Filter");
panel.add(label, BorderLayout.WEST);
final JTextField filterText =
new JTextField("SUN");
panel.add(filterText, BorderLayout.CENTER);
frame.add(panel, BorderLayout.NORTH);
JButton button = new JButton("Filter");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String text = filterText.getText();
if (text.length() == 0) {
sorter.setRowFilter(null);
} else {
try {
sorter.setRowFilter(
RowFilter.regexFilter(text));
} catch (PatternSyntaxException pse) {
System.err.println("Bad regex pattern");
frame.add(button, BorderLayout.SOUTH);
frame.setSize(300, 250);
frame.setVisible(true);
EventQueue.invokeLater(runner);
}its okay onmosh.....what we need to
this...forum....is to have a good......relationship
of programmers......and to start with .....we need to
have a good attitude........right.....???.....no
matter how good you are in programming but if you did
not posses the right kind of attitude....everything
is useless.....in the first place....all we
want....is just to ask...some....help....but
conflicts......but unluckily......we did not expect
that there are members in here which......not
good...to follow.....just as suggestion for those
people not having the right kind of attidude...why
can't you do in a very nice message sharing in a very
nice....way....why we need to put some
stupid....stuff...words.....can't you live with out
******* ****....its not.....lastly especially you
have your children right now and people around...that
somehow......idiolize...you even me....is one of
them......but showing but attitude....is not
good......tnx....hope you'll take it this....in the
positive side.....be optimistic...guys....the
world..is not yours....all of us will just past
away....always..remember that one.....treasure..our
stay in this....temporary home.....which...is
world....Whoa. That post seems to be killing my brain.
URK
Join........us..........do not be..........afraid....... -
Hello
can someone please tell me how to modify this code so that I dont have to enter the file path at all? When i give the same file path constants to both the read and write VIs I'm getting an error message.
Attachments:
read and write.vi 11 KBYup use the low level File I/O opening the reference once, and closing it once.
As for the path selection you have an unwired input which is the path to use. Programatically set that and you won't be prompted to select a path. Usually this is done with a path constant to a folder, then using the Build Path, to set the file name in that folder.
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously. -
Email Issue - How to turnoff "This message contains unloaded images"?
Email Issue - How to turnoff "This message contains unloaded images"? and having to hit "Load Images" every time I view email msg.
Mail > Preferences > Viewing
Select "Display remote images in HTML messages" -
How to optimize this RW code? (full version)
Hello: (Sorry for the wrong previous post, hope the moderator delete it)
I have this code:
import java.io.*;
class Number
private byte val=0;
public void Read(DataInputStream ar) throws Exception {val=ar.readByte();}
public void Read(RandomAccessFile ar) throws Exception {val=ar.readByte();}
public void Write(RandomAccessFile ar) throws Exception {ar.writeByte(val);}
public void Write(DataOutputStream ar) throws Exception {ar.writeByte(val);}
}As you can see, I have methods for storing and writing into RandomAccessFiles and DataStreams. The code for RW is the same for both media. Is there any way to use the same code for Read(DataInputStream ar) and Read(RandomAccessFile ar)? Note that actually my class is more complex and can contain many data for RW: integers, doubles, objects, so that's why I want to simplify it. I thought about this possibility:
public void Read(Object ar) throws Exception
if(ar instanceof RandomAccessFile) val= ((RandomAccessFile)ar).readByte();
if(ar instanceof DataInputStream ) val= ((DataInputStream )ar).readByte();
public void Write(Object ar) throws Exception
if(ar instanceof RandomAccessFile) val= ((RandomAccessFile)ar).writeByte(val);
if(ar instanceof DataOutputStream ) val= ((DataOutputStream )ar).writeByte(val);
}But as you can see I have to make casts and repeat the code, I only got the advantage of having one single method.
Any suggestion?
Thanks!Both DataOutputStream and RandomAccessFile implement the interfaces DataOutput, so you could do:
public void write(DataOutput out) throws Exception
out.writeByte(value);
}(the other case, RandomAccessFile and DataInputStream, use DataInput) -
How to optimize this SQL. Help needed.
Hi All,
Can you please help with this SQL:
SELECT /*+ INDEX(zl1 zipcode_lat1) */
zl2.zipcode as zipcode,l.location_id as location_id,
sqrt(POWER((69.1 * ((zl2.latitude*57.295779513082320876798154814105) - (zl1.latitude*57.295779513082320876798154814105))),2) + POWER((69.1 * ((zl2.longitude*57.295779513082320876798154814105) - (zl1.longitude*57.295779513082320876798154814105)) * cos((zl1.latitude*57.295779513082320876798154814105)/57.3)),2)) as distance
FROM location_atao l, zipcode_atao zl1, client c, zipcode_atao zl2
WHERE zl1.zipcode = l.zipcode
AND l.client_id = c.client_id
AND c.client_id = 306363
And l.appType = 'HOURLY'
and c.milessearchzipcode >= sqrt(POWER((69.1 * ((zl2.latitude*57.295779513082320876798154814105) - (zl1.latitude*57.295779513082320876798154814105))),2) + POWER((69.1 * ((zl2.longitude*57.295779513082320876798154814105) - (zl1.longitude*57.295779513082320876798154814105)) * cos((zl1.latitude*57.295779513082320876798154814105)/57.3)),2))
I tried to optimize it by adding country column in zipcode_atao table. So that we can limit the search in zipcode_atao table based on country.
Any other suggestions.
ThanksWelcome to the forum.
Please follow the instructions given in this thread:
How to post a SQL statement tuning request
HOW TO: Post a SQL statement tuning request - template posting
and add the nessecary details we need to your thread.
Depending on your database version (the result of: select * from v$version; ):
Have you tried running the query without the index-hint?
Are your table (and index) statatistics up-to-date? -
Performance tuning issues........
Please guide me alternate option for below set of code:
LOOP AT ITAB1 WHERE DISC LT 0.
SELECT * FROM KONV WHERE KNUMV EQ ITAB1-KNUMV AND
KPOSN EQ ITAB1-POSNR AND
KSTEU EQ 'C'.
IF SY-SUBRC EQ 0.
ITAB1-FREE_INDI = 'Y'.
EXIT.
ENDIF.
ENDSELECT.
MODIFY ITAB1 TRANSPORTING FREE_INDI.
ENDLOOP.
*How to merge into one loop :
LOOP AT ITAB1.
IF ITAB1-FREE_MATL NE ''.
ITAB1-FREE_INDI = 'Y'.
MODIFY ITAB1.
GTEST = ITAB1-POSNR - 10.
READ TABLE ITAB1 WITH KEY SAL_ORD_NUM = ITAB1-SAL_ORD_NUM
POSNR = GTEST.
ITAB1-FREE_MATL = 'X'.
MODIFY ITAB1 TRANSPORTING FREE_MATL WHERE
SAL_ORD_NUM = ITAB1-SAL_ORD_NUM AND POSNR EQ GTEST.
CLEAR GTEST.
ENDIF.
ENDLOOP.
LOOP AT ITAB1 WHERE FREE_INDI EQ 'Y'.
IF ITAB1-UEPOS EQ G_UEPOS.
CLEAR ITAB1-FREE_INDI.
MODIFY ITAB1.
ENDIF.
MOVE ITAB1-UEPOS TO G_UEPOS.
ENDLOOP.
Thanx & Regrds.
Vijay..._How to Optimize this Code_
FORM MATL_CODE_DESC.
SELECT * FROM VBAK WHERE VKORG EQ SAL_ORG AND
VBELN IN VBELN AND
VTWEG IN DIS_CHN AND
SPART IN DIVISION AND
VKBUR IN SAL_OFF AND
VBTYP EQ 'C' AND
KUNNR IN KUNNR AND
ERDAT BETWEEN DAT_FROM AND DAT_TO.
SELECT * FROM VBAP WHERE VBELN EQ VBAK-VBELN AND
MATNR IN MATNR.
SELECT SINGLE * FROM MAKT WHERE MATNR EQ VBAP-MATNR.
IF SY-SUBRC EQ 0.
IF ( VBAP-NETWR EQ 0 AND VBAP-UEPOS NE 0 ).
IF ( VBAP-UEPVW NE 'B' AND VBAP-UEPVW NE 'C' ).
MOVE VBAP-VBELN TO ITAB1-SAL_ORD_NUM.
MOVE VBAP-POSNR TO ITAB1-POSNR.
MOVE VBAP-MATNR TO ITAB1-FREE_MATL.
MOVE VBAP-KWMENG TO ITAB1-FREE_QTY.
MOVE VBAP-KLMENG TO ITAB1-KLMENG.
MOVE VBAP-VRKME TO ITAB1-FREE_UNIT.
MOVE VBAP-WAVWR TO ITAB1-FREE_VALUE.
MOVE VBAK-VTWEG TO ITAB1-VTWEG.
MOVE VBAP-UEPOS TO ITAB1-UEPOS.
ENDIF.
ELSE.
MOVE VBAK-VBELN TO ITAB1-SAL_ORD_NUM.
MOVE VBAK-VTWEG TO ITAB1-VTWEG.
MOVE VBAK-ERDAT TO ITAB1-SAL_ORD_DATE.
MOVE VBAK-KUNNR TO ITAB1-CUST_NUM.
MOVE VBAK-KNUMV TO ITAB1-KNUMV.
SELECT SINGLE * FROM KONV WHERE KNUMV EQ VBAK-KNUMV AND
KSTEU = 'C' AND
KHERK EQ 'A' AND
KMPRS = 'X'.
IF SY-SUBRC EQ 0.
ITAB1-REMARKS = 'Manual Price Change'.
ENDIF.
SELECT SINGLE * FROM KONV WHERE KNUMV EQ VBAK-KNUMV AND
KSTEU = 'C' AND
KHERK IN ('C','D') AND
KMPRS = 'X' AND
KRECH IN ('A','B').
IF SY-SUBRC EQ 0.
IF KONV-KRECH EQ 'A'.
MOVE : KONV-KSCHL TO G_KSCHL.
G_KBETR = ( KONV-KBETR / 10 ).
MOVE G_KBETR TO G_KBETR1.
CONCATENATE G_KSCHL G_KBETR1 '%'
INTO ITAB1-REMARKS SEPARATED BY SPACE.
ELSEIF KONV-KRECH EQ 'B'.
MOVE : KONV-KSCHL TO G_KSCHL.
G_KBETR = KONV-KBETR.
MOVE G_KBETR TO G_KBETR1.
CONCATENATE G_KSCHL G_KBETR1
INTO ITAB1-REMARKS SEPARATED BY SPACE.
ENDIF.
ELSE.
ITAB1-REMARKS = 'Manual Price Change'.
ENDIF.
CLEAR : G_KBETR, G_KSCHL,G_KBETR1.
MOVE VBAP-KWMENG TO ITAB1-QTY.
MOVE VBAP-VRKME TO ITAB1-QTY_UNIT.
IF VBAP-UMVKN NE 0.
ITAB1-KLMENG = ( VBAP-UMVKZ / VBAP-UMVKN ) * VBAP-KWMENG.
ENDIF.
IF ITAB1-KLMENG NE 0.
VBAP-NETWR = ( VBAP-NETWR / VBAP-KWMENG ).
MOVE VBAP-NETWR TO ITAB1-INV_PRICE.
ENDIF.
MOVE VBAP-POSNR TO ITAB1-POSNR.
MOVE VBAP-MATNR TO ITAB1-MATNR.
MOVE MAKT-MAKTX TO ITAB1-MAKTX.
ENDIF.
SELECT SINGLE * FROM VBKD WHERE VBELN EQ VBAK-VBELN AND
BSARK NE 'DFUE'.
IF SY-SUBRC EQ 0.
ITAB1-INV_PRICE = ITAB1-INV_PRICE * VBKD-KURSK.
APPEND ITAB1.
CLEAR ITAB1.
ELSE.
CLEAR ITAB1.
ENDIF.
ENDIF.
ENDSELECT.
ENDSELECT.
ENDFORM. " MATL_CODE_DESC
Edited by: Vijay kumar on Jan 8, 2008 6:50 PM -
How to implement this code in labview?
How do implement this pseudo code in labview? Please keep in mind "a" and "c" in the code below ARE VARIABLES
for i =0 to i=maxvalue
if i <= a
output = output2
else if i > a AND i<=c
output = output2
else if i < c
output = output3
else i = d
output = output4
I understance i can use a case structures and modify the label, but i do not know how to make the label dependent on a variable value.
ThanksTry an array of boudaries and use threshold array. See this old example:
Now just iterate over an array of values using a FOR loop.
LabVIEW Champion . Do more with less code and in less time . -
Hi folks,
I having a problem with performance tuning ... Below is a sample query
SELECT /*+ PARALLEL (K 4) */ DISTINCT ltrim(rtrim(ibc_item)), substr(IBC_BUSINESS_CLASS, 1,1)
FROM AAA K
WHERE ltrim(rtrim(ibc_item)) NOT IN
select /*+ PARALLEL (II 4) */ DISTINCT ltrim(rtrim(THIRD_MAINKEY)) FROM BBB II
WHERE SECOND_MAINKEY = 3
UNION
SELECT /*+ PARALLEL (III 4) */ DISTINCT ltrim(rtrim(BLN_BUSINESS_LINE_NAME)) FROM CCC III
WHERE BLN_BUSINESS_LINE = 3
The above query is having a cost of 460 Million. I tried creating index but oracle is not using index as a FT scan looks better. (I too feel FT scan is the best as 90% of the rows are used in the table)
After using the parallel hint the cost goes to 100 Million ....
Is there any way to decrease the cost ...
Thanks in advance for ur help !Be aware too Nalla, that the PARALLEL hint will rule out the use of an index if Oracle adheres to it.
This is what I would try:
SELECT /*+ PARALLEL (K 4) */ DISTINCT TRIM(ibc_item), substr(IBC_BUSINESS_CLASS, 1,1)
FROM AAA K
WHERE NOT EXISTS (
SELECT 1
FROM BBB II
WHERE SECOND_MAINKEY = 3
AND TRIM(THIRD_MAINKEY) = TRIM(K.ibc_item))
AND NOT EXISTS (
SELECT 1
FROM CCC III
WHERE BLN_BUSINESS_LINE = 3
AND TRIM(BLN_BUSINESS_LINE_NAME) = TRIM(K.ibc_item))But I don't like this at all: TRIM(K.ibc_item), and you never need to use DISTINCT with NOT IN or NOT EXISTS.
Try this:
SELECT DISTINCT TRIM(ibc_item), substr(IBC_BUSINESS_CLASS, 1,1)
FROM AAA K
WHERE NOT EXISTS (
SELECT 1
FROM BBB II
WHERE SECOND_MAINKEY = 3
AND TRIM(THIRD_MAINKEY) = K.ibc_item
AND NOT EXISTS (
SELECT 1
FROM CCC III
WHERE BLN_BUSINESS_LINE = 3
AND TRIM(BLN_BUSINESS_LINE_NAME) = K.ibc_itemThis may not work though, since you may have whitespaces in K.ibc_item. -
How to optimize this sql by writing MINUS function.
Hi all,
how to optimize the sql by writing MINUS function.
these are my tables
1. CREATE TABLE POSTPAID
RECORD VARCHAR2(2000 BYTE),
FLAG NUMBER
Record format:
Mobile no in 1:10 of that length
2. CREATE TABLE SUBSCRIBER
PHONE_NO VARCHAR2(10 BYTE)
My requirement is following sql need write using ‘minus’ as this one is very slow
select record record from POSTPAID where substr(record,9,10) NOT in (select PHONE_NO from SUBSCRIBER)
ThanksWhy are you very particular about using "MINUS". You can optimize the sql by using "NOT EXISTS" instead of "NOT IN" as below:
SELECT RECORD FROM POSTPAID A WHERE NOT EXISTS (SELECT 1 FROM SUBSCRIBER B WHERE SUBSTR(A.RECORD,9,10) = B.PHONE_NO) -
How to write this code ?
I need to write 3 classes that each one can get to the other with the same instance of the class , so how do i write this code ?
thanks a lottry out singleton pattern with all the three classes. following link may help...
http://www.javareference.com/jrexamples/viewexample.jsp?id=25 -
How to test this code ???
Hi All,
One quick question:
..>>>>How do you test below InterfaceImpl classes in a simple program to test the code ???
//below is the sample of the example I am running .
Thanks
Jack
//interface 1
same package;
interface someInterfaceName1 {
public void setLastName();
public String getLastName();
//inerface 2
same package;
interface someInterfaceName2{
public void setBillingAddress(somename1 billing){
public void setShippingAddress(somename1 shipping){
// implementation class1
samepackage;
public class someInterfaceName1Impl implements someInterfaceName1 {
private String lastName="";
someInterfaceName1Impl();
public void setLastName(String lastName){
this.lastName=lastName;
public String getLastName(){
return LastName;
//implementatio class2 for interface 2
samepackage;
class someInterfaceName2Impl implements someInterfaceName2
public void setBillingAddress(interface1 billto){
billto.setlastName(someValue); --?????
public void setShippingAddress(interface1 shipto) {
shipto.setFirstName(someValue); --- ?????
//How to test the code ??
package samepackage;
class testMyCode {
public static void main(String args[]){
// how do you get the interfaces implementation here to test with dummy values ????Something along these lines (but departing from your code a bit...) public static void test() {
Interface1 ifc1 = new Impl1();
String tmpStr;
int tmpInt;
ifc1.setName("joe");
tmpStr = ifc1.getName();
if (!("joe".equals(tmpStr))) {
System.err.println("set/getName failed. Put in joe but got out " + tmpStr);
ifc1.setBirthdate("May 1 1980");
tmpInt = ifc1.getAge();
if (tmpInt != 24) {
System.err.println("setBirthdate/getAge failed. Put in May 1 1980, expected 24 but got " + tmpInt);
try {
tmpStr = "Booger 99, 19seventy-beer";
ifc1.setBirthdate(tmpStr);
//shouldn't get here
System.err.println("setBirthdate accepted invalid date: " + tmpStr);
catch (InvalidBirthdateException exc) {
// we want this, since it means our code properly rejected a bad date
} Or, when you start writing serious code, look into junit
ジ
Maybe you are looking for
-
Audio IC OP-AMP Tests with RMAA and Audigy 2ZS Platinum
Here are some [url="http://www.jensign.com/RMAA/RMAAOpAmpTests.html">RMAA test results[/url]?and basic circuit-design information for a few commercial audio IC op am ps. The information might be useful for those wanting to build utility audio circuit
-
How do I uninstall 10.4.5
Hey, I recently updated to tiger 10.4.5 WHAT A MISTAKE!! Now the computer cannot recognize any of my video cameras. I need to do work tonight for uni!!! So how do I revert back to using 10.4.4?? PS. why do apple screw us around so much? The idea of a
-
Hi, i have a textfield and Button in my Applet. Applet is running locally. if i typed my directory in the textfield and press the reterive button means Applet has to display all the images in that paticular directory. Actually in the button's action
-
How can I connect with the AspNetUsers table in MVC 5?
I have a model, in which I have used several foreign keys from other tables. The point is that I also need to get the Id of the user, from the AspNetUsers table, though, I don't know how. I have done something like this, but it doesn't seem to be wor
-
Rfcexec.exe as a service
Hi all, Can someone please tell me how to go about starting the rfcexec.exe as a service on an Win 2003 server? Thanks in advance, Iqbal