How to compare matnr based on '*' how tocalculate subtotals via coding
hi gurus.,
My requirement is i hv to group all sub-partnumbers in one single part number ..
for Example: BHRM2960 (8 chars) is my main Part number
for this Sub-part numbers come like this ..
BHRM2960-010
BHRM2960-020
BHRM2960-030
.. i want to group all the sub-partnumbers under main part number ..
i.e., like this 'BHRM2960*' .. how can i achieve this ..also i have to calculate total of all the sub-part numbers based on header part number through code .. how can i achieve this.. plz help me ..its urgent ..
Thanks in advance
Hi,
use function module
data : it_stb2 like stpox occurs 0 with header line,
it_spma2x like it_spma2 occurs 0 with header line,
it_matcat like cscmat occurs 0 with header line,
call function 'CS_BOM_EXPL_MAT_V2'
exporting
capid = 'PP01'
datuv = sy-datum
mktls = 'X'
mehrs = 'X'
mmory = '1'
mtnrv = it_spma2-matnr
werks = werks
tables
stb = it_stb2
matcat = it_matcat
exceptions
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
others = 8.
Regards,
V.Balaji
Reward if Usefull...
Similar Messages
-
How to compare two views/tabels from two systems via RFC
Hello
How to compare two views/tabels from two systems via RFC. I know there is a transactio or program but whichHi Tina,
You can use a trnasactions like SCMP, SADJ or SCU0 - all tools to do comparison of customizing objects across clients/systems using RFC.
Details of these tools, their usage and functionalities are available in the Help Portal -
[http://help.sap.com/saphelp_47x200/helpdata/en/70/1accb7fab511d18e0f0000e8a48612/frameset.htm]
Best Regards,
Rekha -
How to modify the coding part of KE30 reports ?
How to modify the coding part of KE30 reports ,
so that I can be able to restrict report output based on sales office.
I am unable to find out the program name also.
Regards
Anubhav>
Venkat Reddy wrote:
> Hi,
>
> If u want to know the program running for KE30 just go to SE93 and give KE30
> and click on display you can see the program running for KE30 will be SAPMKCEE.
> I think this is much simpler :-).
>
> Rather than change the standard report try to prepared your own that will be more
> comfortable since it will be complex task to achieve editing the standard program.
> Good Luck
>
> Regards
> VEnk@
>
> Edited by: Venkat Reddy on Dec 11, 2009 4:52 PM
Venkat,your answer is much simpler If the OP knows there is a tcode Se93, what if he/she does not know it??
P.S: Just a thought.
Regards.
Vishwa. -
How to print hard-coded data in multiple language in sapscript.
Hi All,
How to print hard-coded data in multiple language in sap-script, here the requirement is when printing the output
we can see the window heading, description which are mostly hard-coded here I want to print these in both language as fallows,
Goods to be delivered: = Morada de Entrega:
Total net value excl. tax = Valor Total (IVA não Incluído)
Description = Descrição
Item = linha
here I want to print in both languages like---- Goods to be delivered:/ Morada de Entrega:
and the above headings in English are hard-coded.
Kindly suggest me on this.
Thanks in advance.
Arun.Hi Arun,
Use Standard text ade those text elements. Then use those in SAP script using different languages.
Regards,
Amitava -
Through SharePoint Client Object model, how to make color coded events on Sharepoint Calendar
Hi,
Through SharePoint Client Object model, how to make color coded events on Sharepoint Calendar.
Plese share your knowledge.
Regards
TharakHi,
According to your post, my understanding is that you wanted to make a color events Calendar.
We can achieve it using the OOB method by creating the Calendars Overlay.
http://summit7systems.com/color-code-calendar-events-in-sharepoint/
You can also use the JavaScript to achieve it.
http://spsawyer.wordpress.com/2013/07/18/sharepoint-color-calendar/
http://www.planetwilson.co.uk/sharepoint-2013-colour-calendar-v2/
more reference:
http://usermanagedsolutions.com/SharePoint-User-Toolkit/Pages/Color-Coding-Calendar-List.aspx
http://blog.pathtosharepoint.com/2010/04/06/tutorial-add-color-coding-to-your-sharepoint-2007-calendar-in-15-minutes/#comment-7231
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
How to know via PowerShell "did user install office on his computer with office 365 or not"
Hello. Sorry for my english.
Subject: How to know via PowerShell "did user install office on his computer with office 365 or not"
I set to users Office 365 ProPlus license, that allows a user to install Office on up to five computers. I want to know, user use this opportunity or not, install office or not.
User can view his installation in the Office 365 portal:
But how I (like admin Office365) can view this information? Maybe via PowerShell?
Thank you...Hi,
Please see the
blog, I copied the part of here:
====
Viewing a list of Office 365 ProPlus installations
A user can see which computers she has installed Office on by signing in to the Office 365 Portal and going to the
software page.
Only the signed in user can see this information. Even if you are the administrator for your organization's Office 365 subscription, you can't see this information in any of your Office 365 administrative views. This also means you can't deactivate
a user's installation of Office on a specific computer. More on deactivation in a bit.
====
If you have further question about Office 365, I recommend you post the question to Office 365 forum:
http://community.office365.com/en-us/f/148.aspx
Regards,
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Newbie Question: Rules: Functions: How to compare String based type?
I have some XML facts in my rules dictionary defined by the following schema (fragments shown)
<xs:simpleType name="VarType">
<xs:restriction base="xs:string">
<xs:enumeration value="Foo"/>
<xs:enumeration value="Bar"/>
<xs:enumeration value="Baz"/>
<xs:enumeration value="Qux"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="ProgType">
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
<xs:element name="var" type="VarType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
Which means that a Prog of ProgType has an ID and a "list" of "var" strings restricted to bounds specified by VarType.
The issue comes when I try to create a Rules Function operating on these types.
Function-> boolean containsVar(ProgType prog,VarType var) (built using the Functions tab of the Rules editor)
for (String v : prog.var ){
if (v == var){
return true
return false
The problem we run into here is typing. If v is declared a String, as here, then v == var is invalid because types don't match. But I can't declare v a VarType due to
RUL-05583: a primitive type or fact type is expected, but neither can be found.
This problem may stem from the fact the Java's String is declared final and can't be subclassed, so the JAXB translation to Java may have to wrap it, futzing ==/equals() in the process.
SO... How do I create this method and compare these values?
TIA
Edited by: wylderbeast on Mar 10, 2011 9:15 AM - typos
Edited by: wylderbeast on Mar 10, 2011 9:18 AMAnd here's the answer.
var.value() seems to return the String value of the type
so the comparison becomes
(v == var.value())
Live and learn.... -
Compare Java based reporting to OBIEE
Hello All,
Due to a lot of misconceptions, my current client thinks that a lot of their problems will be resolved by simply retiring OBIEE and write all the reports in Java.
Some requirements are unrealistic to ask from OBIEE and some are well...limitations.
The client has asked us to give him reasons why he still should be on OBIEE. Has anyone done a comparison of Java based reports and OBIEE (or any BI tool)?
Reasons why OBIEE stands out would also help.
Thanks all!!There are many, many reasons why to use OBIEE. One of the bigger reasons being you don't need to know anything about Java in order to build an Answer Report.
I've been asked a similar question in the past, to compare OBIEE versus Java based ADF. My response is that they have two completely different purposes.
--OBIEE is end-user/middle-user driven dashboards and ad-hoc analysis.
--Java/ADF is for power-users to pre-constructed reporting systems. (forgive me but I don't know the ad-hoc capabilities of Java/ADF)
If your client has full-time java resources to commit to the creation and maintenance of a Java environment, then by all means they should probably go that route. But keep in mind that as new uses want to see different data layouts and different data sets, your java team will quickly become overburdened.
OBIEE relieves the strain on the java (IT) team and allows end-users to drive reporting with the relatively occasional support by IT.
Yes, OBIEE does have limitations, but always keep in mind that a) It's an ad-hoc Dashboard framework and not an ad-hoc java framework which has much greater flexibility but requires much more technical expertise b) There is a major release of OBIEE (11g) just around the corner that is about to change the game in terms of how OBIEE can be used. You should have your client stay on board until they can at least see the new features.
Good luck and if you found this post useful, please award points!
Best regards,
-Joe -
How to sort via multi value parameter in ssrs
I have a parameter with multi values. when the user selects ,he get of options like acount name, first name, last name.
so if user selects firstname , the data has to sort by firstname.
if he selects acount name , the data has to sort by account name.
please help me how to sort the data using parameter with multivalue? in ssrs 2008.
Thank you?Hi Venku,
Based on your description, it seems that you create a parameter with available values and you want to sort the report data based on the parameter value. If the available values are the field names in the report, you can try to open the Tablix properties
dialog box and specify the sort expression on "Sorting" tab as follows:
=Fields(Parameter!parametername.value).value
If the parameter allow multiple values and you want to sort the report data by more than one field, for example, sort the report data by "accountname" and then by "firstname", please add two sort expressions as follows:
=Fields(Parameter!parametername.value(0)).value
=Fields(Parameter!parametername.value(1)).value
If you have any question, please let me know.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
How to post via email (like with Wordpress)?
Hi,
Hopefully this isn't a silly newby question, I have been scouring the web looking for answers without any luck. I would like to be able to automatically post the contents of emails in chronological order on my website - ie. when I email something to a group I include a special email address that then posts the email contents and/or a header automaticlaly on my website. I see that this is possible with Wordpress, but I can't find anything to help figure out how to do this with HTML through Dreamweaver? I dont really want to have a portion fo my sire Wordpress based if I can avoid it. Maybe it's very simple, but does anyone have a link to a tutorial of some sort?
Thank you in advance,
GeorgeHi Paul,
If you have BusinessObjects Enterprise/Crystal Reports Server, you could use the 'Alert Notification' option under 'Schedule'.
This option can make use of the 'Report Alerts' you setup in the CR Designer.
1) To create the Alert, go to Report > Alerts > Create or Modify Alerts.
2) Add a Custom Message
3) Click condition and use a formula; for e.g:
Not(IsDate({Date_Field}))
4) Check the option 'Enabled' in the Alert Creation window
5) Save the report to BO Enterprise
6) Browse to the report > Click Schedule > Alert Notification > Enable Alert Notification
7) Type in the e-mail addresses you wish to send the alert message to along with the message.
-Abhilash -
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? -
How to video via email using flash media playback setup?
How I can send video via email? I send every week an email that contain a link to WMV file on our website. I am trying to send the same thing using flash media player. Here the html generated via flash media playback setup and will not display in an email. Any advise
<object width="400" height="400"> <param name="movie" value="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf"></param><param name="flashvars" value="src=http%3A%2F%2Fwww.4GodIsLove.com%2F%2FTV%2FFlash%2FLydua_Fares_Elhaana.flv"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="400" flashvars="src=http%3A%2F%2Fwww.4GodIsLove.com%2F%2FTV%2FFlash%2FLydua_Fares_Elhaana.flv"></embed></object>salma_salma wrote:
Thanks Janaki but how can I add a new application? I tried to do it using Flash Media Administration Console but it doesn't work
Hi Salma,
To add an application to FMS follow the below steps
1. Create a folder "my_app" under "$InstallRoot\applications" directory.
2. For simple server side code... add "main.asc" file inside "$InstallRoot\applications\my_app" directory which has the content like
application.onConnect = function(clientObj){
trace('onConnect function");
return true;
3. To add streams to the application, creates 'streams' folder inside "$InstallRoot\applications\my_app" directory, within that create '_definst_' folder and then place your FMS supported streams within the directory. So your streams for the 'my_app' application will be at "$InstallRoot\applications\my_app\streams\_definst_\mystream.flv".
You can connect to this application using the url "rtmp://your_server_name/my_app". To play the stream mystream.flv using video player, use the url "rtmp://your_server_name/my_app/mystream.flv".
Regards,
Janaki L -
SAP PI7.31 : Mail with multiple attachments - how to process via UDF
Hi
wondering how I can approach this problem. I have to read an Email with any number of attachments - it can have between 1 and 4 or maybe more of different types (CSV,XLS,PDF,ZIP). I need to read this email and extract the attachments to a folder.
Just to let you know I have done this OK for an email that I know only has 2 attachments ! Works perfectly - just no good for ?n? attachments !
Mail Sender has AF_Modules/MultipartHeaderBean to add payload Attributes
The message is sent to 2 Receivers
Each Receiver File adapter then uses AF_Modules/DynamicConfigurationBean and AF_Modules/PayloadSwapBean
Problem is that when I do not know how many attachments there are. So I will have to write a Java UDF mapping, perhaps using the classTransformationInput.
My question is : To create a Java UDF what should be structure of a sent Email message Type look like so I can feed that into a UDF to check what payload attachments there are etc ?.As long as you use java mapping, you can have any dummy structures for your interfaces.
But, if you prefer to use graphical mapping with UDF, then you should have some valid structures for your mail and file interfaces. e.g., mail pack XSD for mail interface as metioned by Indrajit Sarkar
and again the same structure for the file interface as well so that you can have one to one mapping an then make use of UDF code from the article. Use payload swap bean in the receiver file channel to replace xml payload with Zipped attachments and then finally use script to unzip this zip file.
Rgds,
Praveen Gujjeti -
Suggestions on how to make this coding better?
Hey everyone, I was just wondering if anyone had any suggestions on how to make my code better. It's for a project and I want to get a good grade on it. It works fine but I just want to see what everyone thought before I hand it in.
import java.io.*;
import java.util.StringTokenizer;
This class process the input expressions containing rational expressions and proecesses them and then outputs the results.
@author *****
@version 1.0
public class Proj1
private static String buffer = null; //User input
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static PrintWriter outfile = null;
private static int totCount = 0, goodCount = 0, badCount = 0; //Total, Valid, and Invalid counts
private static boolean fileInput = false; //File to read data
private static boolean fileOutput = false; //Output for the data
private static boolean screenOutput = false; //Output so the user can view it
private static String outFile = null; //File for output
private static String inFile = null; //File for input
Main method
public static void main (String[] args) throws Exception
Proj1 proj1 = new Proj1();
proj1(args);
runs the program
private static void proj1(String [] args) throws Exception
if (args.length == 0)
printBanner();
System.out.println("\n" + "\n" + "Please enter an expression, or type quit");
do
screenOutput=true;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
processData();
}while(!buffer.equals("quit"));//exits if quit is entered
if (args[0].charAt(0) != '-')
badOption("Invalid Option Specified ");
for(int i=1; i<args[0].length(); i++)
switch(args[0].charAt(i))
case 'f': fileInput = true;
break;
case 'o': fileOutput = true;
break;
case 'b': fileOutput = true;
screenOutput = true;
break;
default: printBanner();
invalidOption("Proj1: Invalid Option Found: " + args[0].charAt(i));
if(fileInput && args[0].length() == 2)
screenOutput = true;
if(fileInput && !fileOutput)
if(args.length == 1)
badOption("No Input File Specified.");
else
File inFile = new File(args[1]);
if(!inFile.exists())
nonExist("Input File " + args[1] + " not found");
br = new BufferedReader(new FileReader(args[1]));
printBanner();
processData();
closeFiles();
if(fileOutput && fileInput)
printBanner();
if(args.length > 2)
outFile = args[2];
else
if(args.length > 1)
outFile = "proj1.dat";
noOut("No output file specified , defaulting to proj1.dat");
inFile = args[1];
br = new BufferedReader(new FileReader(inFile));
processData();
closeFiles();
if(fileOutput && screenOutput)
printBanner();
if(args.length == 1)
outFile = "proj1.dat";
noOut("No output file specified, defaulting to proj1.dat");
System.out.println("\n" + "\n" + "Please enter an expression, or type quit");
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
processData();
closeFiles();
else
outFile=args[1];
System.out.println("\n" + "\n" + "Please enter an expression, or type quit");
br = new BufferedReader(new InputStreamReader(System.in));
processData();
closeFiles();
Processes the input data by the user by doing the specified operations and then displays the output
private static void processData() throws Exception
if(fileOutput)
outfile = new PrintWriter(new FileOutputStream(outFile), true);
else if(fileOutput && screenOutput)
outfile = new PrintWriter(new FileOutputStream(outFile), true);
buffer = br.readLine();
while(!buffer.equals(""))
StringTokenizer reader = new StringTokenizer(buffer);
int count = 0;
String number1 = null;
String number2 = null;
String op = null;
boolean valid = true;
boolean secondNumber = true;
while (reader.hasMoreTokens())
switch(count)
case 1: number1 = reader.nextToken();
break;
case 2: op = reader.nextToken();
break;
case 3: number2 = reader.nextToken();
break;
count++;
if(number1 == null || number1.equals("quit"))
printSummary(goodCount, badCount, totCount);
closeFiles();
if(number2 == null)
secondNumber = false;
char character;
int position = 0;
String s = "0123456789/-";
for(int i = 0; i < number1.length(); i++)
character = number1.charAt(i);
position = s.indexOf(character);
if(position == -1)
valid = false;
if(secondNumber)
for(int i = 0; i < number2.length(); i++)
character = number2.charAt(i);
position = s.indexOf(character);
if(position == -1)
valid=false;
int denomin2 = 0;
int numer2 = 0;
String n1 = null;
String d1 = null;
int izerCount = 0;
StringTokenizer st2 = new StringTokenizer(number1,"/");
while(st2.hasMoreTokens())
switch(izerCount)
case 1: n1 = st2.nextToken();
d1 = "1";
break;
case 2: d1 = st2.nextToken();
izerCount++;
int numer1;
int denomin1;
int tokenCount = 0;
if(valid)
numer1 = Integer.parseInt(n1);
denomin1 = Integer.parseInt(d1);
String n2 = null;
String d2 = null;
if(secondNumber)
StringTokenizer st3 = new StringTokenizer(number2, "/");
while(st3.hasMoreTokens())
switch(tokenCount)
case 1: n2 = st3.nextToken();
d2 = "1";
break;
case 2: d2 = st3.nextToken();
tokenCount++;
numer2 = Integer.parseInt(n2);
denomin2 = Integer.parseInt(d2);
RationalNumber z1 = new RationalNumber(numer2, denomin2);
RationalNumber z = new RationalNumber(numer1,denomin1);
RationalNumber z1 = new RationalNumber(numer2,denomin2);
boolean lt = true; //whether the first number is less than the second
boolean gt = true; //whether the first number is greater than the second
boolean eq = true; //whether the first number is equal to the second
boolean le = true; //whether the first number is less or equal to the second
boolean ge = true; //whether the first number is greater than or equal to the second
boolean zeroDenom = true; //whether the denominator is zero
if(denomin1 == 0 || denomin2 == 0)
zeroDenom = true;
badCount++;
else
zeroDenom = false;
if(!zeroDenom && secondNumber)
if(op.equals("+"))
RationalNumber z2 = z.add(z1);
if(screenOutput)
System.out.println(buffer + " = " + z2.getNumerator()+ "/" +z2.getDenominator());
if(fileOutput || fileOutput && screenOutput)
outfile.println(buffer + " = " + z2.getNumerator()+ "/" +z2.getDenominator());
goodCount++;
else if(op.equals("-"))
RationalNumber z3 = z.sub(z1);
if(screenOutput)
System.out.println(buffer + " = " + z3.getNumerator()+ "/" +z3.getDenominator());
if(fileOutput || fileOutput && screenOutput)
outfile.println(buffer + " = " + z3.getNumerator()+ "/" +z3.getDenominator());
goodCount++;
else if(op.equals("*"))
RationalNumber z4 = z.mlt(z1);
if(screenOutput)
System.out.println(buffer + " = " + z4.getNumerator()+ "/" +z4.getDenominator());
if(fileOutput || fileOutput && screenOutput)
outfile.println(buffer + " = " + z4.getNumerator()+ "/" +z4.getDenominator());
goodCount++;
else if(op.equals("/"))
RationalNumber z5 = z.div(z1);
if(screenOutput)
System.out.println(buffer + " = " + z5.getNumerator()+ "/" +z5.getDenominator());
if(fileOutput || fileOutput && screenOutput)
outfile.println(buffer + " = " + z5.getNumerator()+ "/" +z5.getDenominator());
goodCount++;
else if(op.equals("<"))
lt=z.lt(z1);
if(screenOutput)
System.out.println(buffer + " is " + lt);
if(fileOutput || fileOutput && screenOutput)
outfile.println(buffer + " is " + lt);
goodCount++;
else if(op.equals(">"))
gt=z.gt(z1);
if(screenOutput)
System.out.println(buffer + " is " + gt);
if(fileOutput || fileOutput && screenOutput)
outfile.println(buffer + " is " + gt);
goodCount++;
else if(op.equals("="))
eq=z.eq(z1);
if(screenOutput)
System.out.println(buffer + " is " + eq);
if(fileOutput || fileOutput && screenOutput)
outfile.println(buffer + " is " + eq);
goodCount++;
else if(op.equals("<="))
le=z.le(z1);
if(screenOutput)
System.out.println(buffer + " is " + le);
if(fileOutput || fileOutput && screenOutput)
outfile.println(buffer + " is " + le);
goodCount++;
else if(op.equals(">="))
ge=z.ge(z1);
if(screenOutput)
System.out.println(buffer + " is " + ge);
if(fileOutput || fileOutput && screenOutput)
outfile.println(buffer + " is " + ge);
goodCount++;
else
if(op==null)
if(screenOutput)
System.out.println("Invalid expression: " + buffer);
if(fileOutput || fileOutput && screenOutput)
outfile.println("Invalid Expression: " + buffer);
badCount++;
else
if(screenOutput)
System.out.println("Invalid expression: " + buffer );
if(fileOutput || fileOutput && screenOutput)
outfile.println("Invalid expression: " + buffer);
badCount++;
else
if(screenOutput)
System.out.println("Invalid operand: " + buffer);
if(fileOutput || fileOutput && screenOutput)
outfile.println("Invalid operand: " + buffer);
else
if(screenOutput)
System.out.println("Invalid operand: " + buffer);
if(fileOutput || fileOutput && screenOutput)
outfile.println("Invalid operand: " + buffer);
badCount++;
buffer = br.readLine();
Prints the banner for the program
private static void printBanner()
System.out.println("+++++++++++++++++++++++++++++++++++++++++"+"\n"+"+Welcome to the expression connection +"+"\n"+"+++++++++++++++++++++++++++++++++++++++++");
Prints the total number of expressions, total number of valid expressions, and total number of bad expressions.
private static void printSummary(int goodCount, int badCount, int totCount)
totCount = goodCount + badCount;
System.out.println("\n");
System.out.println("+++++++++++++++++++++++++++++++++++++++++");
System.out.println("+ Total Expressions: "+totCount);
System.out.println("+ Total Valid Expressions "+goodCount);
System.out.println("+ Total Bad Expressions "+badCount);
System.out.println("+++++++++++++++++++++++++++++++++++++++++");
Prints the error message if there is no output file specified
private static void noOut(String errorString)
System.out.println("\n");
System.out.println("Proj1: " + errorString);
Prints the error message if there is an invalid option input by the user
private static void invalidOption(String errorString)
System.out.println("\n");
System.out.println("Proj1: " + errorString);
System.out.println("Proj1: Usage is: java proj1 [-fob] [input] [output]");
System.exit(0);
Prints the error message if there is a bad option input by the user
private static void badOption(String errorString)
System.out.println("\n");
System.out.println("Proj1: " + errorString);
System.out.println("Proj1: Usage is: java proj1 [-fob] [input] [output]");
System.exit(0);
Prints the error message if the input file does not exist
private static void nonExist(String errorString)
System.out.println("\n");
System.out.println("Proj1: " +errorString);
System.out.println("Proj1: Usage is: java proj1 [-fob] [input] [output]");
System.exit(0);
Closes the files used by the user
private static void closeFiles( )
if(fileOutput && !screenOutput)
outfile.close();
System.exit(0);
}Well working is good...
The code itself is less than spectacular I'm afraid. There is very little
OOness to this. For your future reference when you complete a program
and it consists of nothing but static methods you have done something
incorrectly.
As far as the code you do have goes some refactoring would be nice.
The two main methods you have (proj1 but especially processData) are
too long and unwieldy. processData seems to be a program in an of
itself. It's complicated and hard to follow.
My recommendation to you would be to read this http://java.sun.com/docs/books/tutorial/java/index.html
Especially focus on the sections dealing with explanation of Object
programming. These terms and concepts can certainly be confusing to
new programmers so you may also want to consider finding yourself a
tutor to help you get a better grasp of these concepts.
In short if it works that's good. And it's also good to see that you put the
effort and time in that you have. However if I was grading your project
I'd give it a C- at best because this is a Java program in syntax only. -
How to download ANSI coding text file using function GUI_DOWNLOAD?
Hi All,
Is the coding page of the file created by funtion GUI_DOWNLOAD or WS_DOWNLOAD is ANSI or UTF-8? How to download a text file which's coding page is ANSI please?
Is this correct?
CALL function 'GUI_DOWNLOAD'
exporting
codepage = '4110'
importingThis Function Lodule will give the CODE PAGE VALUE
SCP_CODEPAGE_BY_EXTERNAL_NAME ... You have to give type of tht ENcoding like ANSI ..etc
call function 'GUI_DOWNLOAD'
exporting
filename = 'd:\customer_details.txt'
filetype = 'ASC'
CODEPAGE = code
tables
data_tab = t_customer_details
FIELDNAMES =
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22
if sy-subrc <> 0.
write : / 'Upload Failed' , sy-subrc.
else.
write : / 'Upload Completed'.
endif.
endif.
Reward if helpful...
Maybe you are looking for
-
HELP Mac OS X Deleted cannot locate hard drive to install on
Okay I have a 12' in Apple PowerBook G4 I got in winter 2003 and recently somehow the operating system got deleted. It originally came with Mac OS X Jaguar 10.2.7 and I upgraded it to Mac OS X Panther 10.3 -- at the time the problem occurred it was r
-
how to add scroll bar in table component ???
-
Antivirus/Firewall Software for macs
Hey, I've just started using a wireless internet (3G USB Modem) connection for my iMac. Should I buy an Anti virus Software application or are macs safe to use without any protection? I'd like to check my bank details online and buy stuff with my cre
-
How to deploy and run application in user created OC4J instance
Hello friends, I have created my own OC4J instance in Application Server Control.Now,how can I deploy and run application in this newly created OC4J instance.I need your help,it's urgent. Regards Prasenjit
-
ORA-06512 and/or ORA-00936 ... simple procedure problem probably
I'm passing in codes like the following to the stored procedure (below): ",IRE,UK,FR,SCOT,WALES" (a string of words seperated by a ',') Problem is I get the following error: ORA-00936: missing expression ORA-06512: at "APPNAME.PKG_TOOL", line 132 ORA