How to follow best coding practices and make this code runable.
How to change this code to make it work and follow best coding practices.
This code is to add fields to internal table LIST which already exist.
In the loop are all the selections which are to be made.
But i am new to ABAP and not sure how to make this work.
please help me.
DATA: wa_list LIKE LINE OF list,
l_v_index TYPE i.
DATA: t_price_result1 TYPE STANDARD TABLE OF komv WITH HEADER LINE INITIAL SIZE 0.
DATA: wa_result LIKE LINE OF t_price_result1.
LOOP AT list INTO wa_list.
l_v_index = sy-tabix.
*GET MATERIAL DOCUMENT(MBLNR) AND DELIVERY NUMBER(XBLNR)
SELECT mkpf~mblnr
mkpf~xblnr
into (wa_list-mblnr, wa_list-xblnr )
* INTO i_list
from mkpf inner join mseg
* up to 1 rows
on mkpf~mandt = mseg~mandt
and mkpf~mblnr = mseg~mblnr
and mkpf~mjahr = mseg~mjahr
where mseg~matnr = wa_list-matnr
and mseg~charg = wa_list-charg
and mseg~kunnr = wa_list-kunnr
and mseg~sobkz = wa_list-sobkz
and mseg~werks = wa_list-werks
and mkpf~budat in budat.
"RFC3762
ENDSELECT.
wa_list-mblnr = list-mblnr.
wa_list-xblnr = list-xblnr.
* GET POSNR FROM TABLE LIPS
SELECT posnr
FROM lips
INTO list-posnr
up to 1 rows
WHERE vbeln = wa_list-xblnr AND
matnr = wa_list-matnr.
ENDSELECT.
wa_list-posnr = list-posnr.
* GET SALES ORDER #
SELECT vbelv
FROM vbfa
INTO list-vbelv
up to 1 rows
* INTO wa_list
WHERE vbeln = wa_list-xblnr.
ENDSELECT.
wa_list-vbelv = list-vbelv.
*GET PO
SELECT bstkd
FROM vbkd
INTO list-bstkd
up to 1 rows
WHERE vbeln = wa_list-vbelv
AND posnr = 0.
ENDSELECT.
wa_list-bstkd = list-bstkd.
*get serial number
SELECT SINGLE obknr
FROM ser01
INTO list-obknr
WHERE lief_nr = wa_list-xblnr
AND posnr = wa_list-posnr.
wa_list-obknr = list-obknr.
SELECT sernr
FROM objk
INTO list-sernr
up to 1 rows
WHERE obknr = wa_list-obknr.
ENDSELECT.
wa_list-sernr = wa_list-sernr.
*get date
SELECT budat FROM mkpf
INTO list-budat
up to 1 rows
where mblnr = wa_list-mblnr.
ENDSELECT.
wa_list-budat = list-budat.
*get CLP
SELECT vkorg vtweg spart
INTO (list-vkorg, list-vtweg, list-spart)
up to 1 rows
FROM vbak WHERE vbeln = wa_list-vbelv.
ENDSELECT.
wa_list-vkorg = list-vkorg.
wa_list-vtweg = list-vtweg.
wa_list-spart = list-spart.
SELECT pstyv
INTO list-pstyv
FROM vbap
up to 1 rows
WHERE vbeln = wa_list-vbelv AND posnr = wa_list-posnr.
ENDSELECT.
wa_list-pstyv = list-pstyv.
CALL FUNCTION 'Z_SD_PRICING_CONDITION'
EXPORTING
i_organization = wa_list-vkorg
i_dist_channel = wa_list-vtweg
i_division = wa_list-spart
i_customer = wa_list-kunnr
i_plant = wa_list-werks
* i_pricng_date = sy-datum
i_material = wa_list-matnr
* I_SALES_UNIT = 'EA'
* I_QUANTITY = '1.000'
i_stor_loc = '0001'
i_item_cat = 'TAN'
* I_AUART =
* I_REFRESH = 'X'
* I_KOMP =
* I_KOMK =
* IMPORTING
* E_MES_TYPE =
* E_MES_NUMBER
* E_MESSAGE =
TABLES
t_price_result = t_price_result1
* EXCEPTIONS
* CUSTOMER_NOT_FOUND = 1
* PLANT_NOT_FOUND = 2
* MATERIAL_NOT_FOUND = 3
** PLANT_MATERIAL_NOT_FOUND = 4
* SALES_DATA_NOT_FOUND = 5
* ORG_UNIT_NOT_FOUND = 6
* UNABLE_TO_CALCULATE_PRICE = 7
* UNABLE_TO_FORMAT_PRICE = 8
* MANDATORY_INFOR_MISSING = 9
* OTHERS = 10
LOOP AT t_price_result1.
IF t_price_result1-kschl = 'ZPR2'.
wa_list-kbetr = t_price_result1-kbetr.
ELSE.
wa_list-kbetr = 0.
ENDIF.
ENDLOOP.
MODIFY list FROM wa_list INDEX l_v_index.
ENDLOOP.
Hi,
Lets first start from your Select Statement.....Replace your SELECT ....ENDSELECT by SELECT Into Internal Table
Your program is having a SELECT...ENDSELECT within LOOP...ENDLOOP........One should avoid doing this as far as possible.
SELECT mkpf~mblnr
mkpf~xblnr
INTO itab
for all entires i_list
from mkpf inner join mseg
on mkpfmandt = msegmandt
and mkpfmblnr = msegmblnr
and mkpfmjahr = msegmjahr
where mseg~matnr = i_list-matnr
and mseg~charg = i_list-charg
and mseg~kunnr = i_list-kunnr
and mseg~sobkz = i_list-sobkz
and mseg~werks = i_list-werks
and mkpf~budat in budat.
Restructure youe complete code with this approach and Share your Finding's.
You can also think of using a SAP Standard FM.
Anyway..What is the objective/Output of this report?
Similar Messages
-
Hi, can you tell me how to create website on iweb and make it public, and tell me how to put a password on it, thanks.
Find a webhosting company :
http://www.google.jo/search?q=webhosting+jordan
They will provide the instructions how to password protect a directory (=folder)?
Until you find one, you can practice on your own computer :
http://www.wyodor.net/Tutorials/iWebDemo/sFTP.html
Here's a some tutorials :
http://www.apple.com/findouthow/web/ -
How do you sync voice memos and make CD's of them?
How do you sync voice memos and make CD's of them?
When you sync the phone with your computer voice memos are copied to your iTunes library with the Genre "Voice memo".
To burn to CD you do it the same way you would any music; create a playlist of the memo(s), the right click on the playlist and choose "burn to CD". -
How do I take a photo and make it the shape of the object I choose, eg. oval, etc?
I am not in front of a Mac at the moment but believe it is:
select the image > Menu > Format > Mask with shape > choose oval
Peter -
How to clean up my mac and make it run faster
I want to know how to clean up my mac and make it run faster.. seems very bogged down lately and doesnt do stuff very fast anymore..
macworld.com/mac-troubleshooting-what-to-do-when-your -computer-is-too-slow.
Basically... Make sure you have enough Free Hard Drive space for your Mac to Perform as expected...
This is what Apple has to say.
http://support.apple.com/kb/PH10798
More Info Here...
ds store > Why is my computer slow?
Thomas A Reed > Mac Performance Guide
To keep your Mac Happy... See Here...
http://support.apple.com/kb/HT1147
http://www.thexlab.com/faqs/maintainingmacosx.html
Mac OS X: About background maintenance tasks -
How to keep the Sonogram settings and make them "Sticky"?
I am a Forensic Audio Examiner and would love to use Soundtrack Pro. Does anyone know how to keep the Sonogram settings and make them "Sticky" so you don't have to reset it every time you open up the project?
Also the Sonogram loses it's frequency range settings while changing the zoom.
Where is the feedback link for this application?
Thanksare you talking about the spectrum analysis?
-
Hi
are there any best coding practices for EP development?can anybody suggest the material?
PrasadEP, as in Enterprise Portal?
James -
How to save a list template and make use of it in another website as webpart ?
How to save a list template and make use of it in another website as webpart ?
1. Save As "List A" as .STP
2. Go to another website, in the document workspace I try to Add webpart -> Browse -> Upload the STP file, but after that the List A webpart still doesn't appear.
Any clue which part went wrong?Hi,
firstly you need to upload the .STP file to a list solution gallery of the site and then you can add the list (under custom name) to the webpage
see here for how to-
http://office.microsoft.com/en-us/sharepoint-server-help/copy-or-move-a-list-by-using-a-list-template-HA101782479.aspx
Hope this helps!
Ram - SharePoint Architect
Blog - SharePointDeveloper.in
Please vote or mark your question answered, if my reply helps you -
How can i repair my logo and make the fill transparent, in ID CC?
I am first time user for InDesign CC how can i repair my logo and make the fill transparent, in ID CC?
No I did it InDesign CC, ill try illustrator, but I was able to fill in with a light grey that made the other parts of logo stand out, so I may just leave it that way.
-
How to create a content profile and Why this need
how to create a content profile and Why this need
Hi,
You will need profiles to control the following behavior:
- Which metadata to be shown in the checkin form and search form
- Define default values to certain metadata
- Make metadata editable, hidden, info only etc
- Allow the user to see only relevant metadata, for example you could have 50 metadata defined, but all you need for the user to input is 10 for say HR documents, you can show only these 10 metadata for the user to contribute
HTH
Regards,
- Anand -
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....... -
How do I make this code generate a new pro when the "NEXT" button is pushed
How do I make this code generate a new set of problem when the "NEXT" Button is pushed
* To change this template, choose Tools | Templates
* and open the template in the editor.
/* Figure out how to create a new set of problms
* Type a list of specifications, include a list of test cases
* DONE :]
package javaapplication1;
import java.awt.GridLayout;
import java.awt.Window;
import javax.swing.*;
import java.awt.event.*;
* @author Baba Akinlolu -
class Grid extends JFrame{
int done = 0;
final int score = 0;
final int total = 0;
//Create Panels
JPanel p2 = new JPanel();
JPanel p3 = new JPanel();
final JPanel p1 = new JPanel();
//Create Radio buttons & group them
ButtonGroup group = new ButtonGroup();
final JRadioButton ADD = new JRadioButton("Addition");
final JRadioButton SUB = new JRadioButton("Subtraction");
final JRadioButton MUL = new JRadioButton("Multiplication");
final JRadioButton DIV = new JRadioButton("Division");
//Create buttons
JButton NEXT = new JButton("NEXT");
JButton END = new JButton("End");
//Create Labels
JLabel l1 = new JLabel("First num");
JLabel l2 = new JLabel("Second num");
JLabel l3 = new JLabel("Answer:");
JLabel l4 = new JLabel("Score:");
final JLabel l5 = new JLabel("");
JLabel l6 = new JLabel("/");
final JLabel l7 = new JLabel("");
//Create Textfields
final JTextField number = new JTextField(Generator1());
final JTextField number2 = new JTextField(Generator1());
final JTextField answer = new JTextField(5);
Grid(){
setLayout(new GridLayout(4, 4, 2 , 2));
p2.add(ADD);
p2.add(SUB);
group.add(ADD);
group.add(SUB);
group.add(MUL);
group.add(DIV);
p2.add(ADD);
p2.add(SUB);
p2.add(DIV);
p2.add(MUL);
//Add to panels
p1.add(l1);
p1.add(number);
p1.add(l2);
p1.add(number2);
p1.add(l3);
p1.add(answer);
p1.add(l4);
p1.add(l5);
p1.add(l6);
p1.add(l7);
p3.add(NEXT);
p3.add(END);
//Add panels
add(p2);
add(p1);
add(p3);
//Create Listners
Listeners();
void Listeners(){
NEXT.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int answer1 = 0;
//Grab the numbers entered
int numm1 = Integer.parseInt(number.getText());
int numm2 = Integer.parseInt(number2.getText());
int nummsanswer = Integer.parseInt(answer.getText());
//Set the score and total into new variabls
int nummscore = score;
int nummtotal = total;
//Check if the add radio button is selected if so add
if (ADD.isSelected() == true){
answer1 = numm1 + numm2;
//otherwise check if the subtract button is selected if so subtract
else if (SUB.isSelected() == true){
answer1 = numm1 - numm2;
//check if the multiplication button is selected if so multiply
else if (MUL.isSelected() == true){
answer1 = numm1 * numm2;
//check if the division button is selected if so divide
else if (DIV.isSelected() == true){
answer1 = numm1 / numm2;
//If the answer user entered is the same with th true answer
if (nummsanswer == answer1){
//add to the total and score
nummtotal += 1;
nummscore += 1;
//Convert the input back to String
String newscore = String.valueOf(nummscore);
String newtotal = String.valueOf(nummtotal);
//Set the text
l5.setText(newscore);
l7.setText(newtotal);
//Otherwise just increase the total counter
else {
nummtotal += 1;
String newtotal = String.valueOf(nummtotal);
l7.setText(newtotal);
//Create End listener
END.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// get the root window and call dispose on it
Window win = SwingUtilities.getWindowAncestor(p1);
win.dispose();
//new Grid();
String Generator1(){
int randomnum;
randomnum = (1 + (int)(Math.random() * 100));
String randomnumm = String.valueOf(randomnum);
return randomnumm;
public class Main {
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
JFrame frame = new Grid();
frame.setTitle("Flashcard Testing");
frame.setSize(500, 200);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}Edited by: SirSaula on Dec 7, 2009 10:17 AMNot only are you continuing to post in the wrong forum but now you are multiposting: [http://forums.sun.com/thread.jspa?threadID=5418935]
If people haven't answered you other posting its probably because we don't understand the question. Quit cluttering the forum by asking the same question over and over and then next time you have a new question post it in the proper forum. Your first posting was moved becuase you didn't post it properly. -
Each song on my iTunes has a duplicate. How do I delete all duplicates and prevent this from happening again in the future?
After I had updated to Itunes 11 (also on Windows 7), I had the same experience, but I suspect that it was because I accepted a proposal to set up an external media library in order to simplify security backups. An associated result was that I had lost all of my playlists!
What I did was to restore the entire library off my Ipod, using a very good program called PodToPC (a free download is available) selecting an option to replace all of the stuff in the Itunes library. I use the Ipod Classic simply because it has a large capacity to hold my collection of CD and Vinyls. No way was I going to modify duplicates of 10000 tracks in 750 playslists by hand! I did have a few residual problems with some of the playlist specs but, after a few hours of work all was restored.
I hope this is useful. -
How to prevent people asking how to prevent "click to activate and use this control"
When I visit the fourms, I keep seeing these questions about
how to disable
"click to activate and use this control". Its really annoying
and
disrupting my web experience. I do know this really this is a
blatant
attack on Adobe and Flash by Microsoft and is obviously
related to the Adobe
takeover of Macromedia, and probably also related to the fact
that it is now
impossible for anyone to install Flash Player (which Adobe is
ignoring
because their support is so useless since the takeover). Is
there something
I can do to prevent these questions being posted? I've
searched all the
forums and cannot find any information. Surely someone else
has had this
problem.
JeckylSome people don't like to search...
Some people don't know what to search...
Some people don't even know there is a search...
Just ask them to search for "click to activate and use this
control".
Search
Flash Support Forums
Search
Google -
How to enter dates in HypPlanning and make calculations
Hi,
Please help. I need to input two dates (with month and year only) using Hyperion Planning and make a calculations of the number of months that are between.
Example
Jan-2010 to Dec-2010 = 12 Months
Jan-2010 to Jul-20111 = 19 Months
Please any advice or best practices.
Kind RegardsHave a look at the following post :- Re: Days behaviour between two dates
Cheers
John
http://john-goodwin.blogspot.com/
Maybe you are looking for
-
Hi, How can i read this table with where condition in OOPS? is it possible? Give some idea how to proceed? Inside method i have written like this. ret is my return parameter. code: Loop at me->s001_raw[] assigning <arr_s001>. read table ret[] w
-
I have little or no control of the curser. It cuts in and out without any command or direction from the pad or trackpad.
-
where can i find my lost tracks now my itunes match has expired???
-
I'm trying to use automator to extract addresses from a text document. It's a long list of addresses and I eventually need to print them on to mailing labels. The trouble is having them identified, and extracted. After that I can put them into addres
-
Apple please provide way to disable Edge but enable WiFi
I am planning a trip outside the US. I have read the posts about people who spend a week abroad and come back to an outrageous AT&T bill because of the international Edge usage charges (sometimes even incidental). I called AT&T and yes they have an i