Common Date: How to input same period in a dashboard
Hi there,
I'm a newbe in BO InfoView, and i9u2019de like to know, how I can create in a dashboard a input form, that provide input to all documents (Web Intelligence report, analytic graphics...).
Best regards,
Bruno Silva
Hi there,
I'm a newbe in BO InfoView, and i9u2019de like to know, how I can create in a dashboard a input form, that provide input to all documents (Web Intelligence report, analytic graphics...).
Best regards,
Bruno Silva
Similar Messages
-
How to determine current period start and end dates
Hi All,
If given previous period start date and end date, how to determine current period start date and end date?
Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
Can you please suggest an FM to determine the current period dates?
Thanks & Regards
Gowthami>
gowthami karunya wrote:
> If given previous period start date and end date, how to determine current period start date and end date?
> Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
Hello,
I am assuming you have the Company Code with you & proposing this solution.
TABLES: bkpf.
PARAMETERS:
p_bukrs TYPE bukrs.
SELECT-OPTIONS:
s_date FOR bkpf-budat.
DATA :
l_perio LIKE bkpf-monat,
l_poper TYPE poper,
l_year LIKE bkpf-gjahr,
l_spmon TYPE spmon,
l_periv TYPE periv,
l_date1 TYPE datum,
l_date2 TYPE datum.
CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
EXPORTING
companycodeid = p_bukrs
posting_date = s_date-high
IMPORTING
fiscal_year = l_year
fiscal_period = l_perio.
CONCATENATE l_year l_perio INTO l_spmon.
* Get the next period
IF l_perio < 12.
l_perio = l_perio + 1.
ELSE.
l_perio = '01'.
l_year = l_year + 1.
ENDIF.
MOVE l_perio TO l_poper.
SELECT SINGLE periv INTO l_periv
FROM t001
WHERE bukrs = p_bukrs.
IF sy-subrc = 0.
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = l_year
i_periv = l_periv
i_poper = l_poper
IMPORTING
e_date = l_date1
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 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.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = l_year
i_periv = l_periv
i_poper = l_poper
IMPORTING
e_date = l_date2
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 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.
WRITE: / l_date1, l_date2.
ENDIF. -
User exit to calculate Same period Last Year
Dear gurus,
can some help me to code the user exit to calculate the same period last year for bex variable
i.e
System date :18.05.2010
Same period last tear : 18.05.2009
Your help highly appreciated
Thank you
BRHi,
The above code creates problem only when date is 29th of Feb.
To find whether year -1 is leap yr or not include following code also:
l_year = sy-datum(4)-1 .
l_mod4 = l_year mod 4.
l_mod100 = l_year mod 100.
l_mod400 = l_year mod 400.
if ( l_mod4 = 0 and l_mod100 ne 0 ) or l_mod400 eq 0.
if( l_date = 29)
l_date= l_date -1.
endif.
endif.
Modify your code according to youe need. Hope this helps you.
Thanks,
Jitender. -
How to pass the data from a input table to RFC data service?
Hi,
I am doing a prototype with VC, I'm wondering how VC pass the data from a table view to a backend data service? For example, I have one RFC in the backend system with a tabel type importing parameter, now I want to pass all the data from an input table view to the RFC, I guess it's possible but I don't know how to do it.
I try to create some events between the input table and data service, but seems there is no a system event can export the whole table to the backend data service.
Thanks for your answer.Thanks for your answer, I tried the solution 2, I create "Submit" button, and ser the mapping scope to be "All data rows", it only works when I select at least one row, otherwise the data would not be passed.
Another question is I have serveral imported table parameter, for each table I have one "submit" event, I want these tables to be submitted at the same time, but if I click the submit button in one table toolbar, I can only submit the table data which has a submit button clicked, for other tables, the data is not passed, how can I achieve it?
Thanks. -
Hello, all,
how can I enter data in an input schedule on a member in the EPM Add-On that is not a base member?
E.g. I want to implement a top-down-planning scenario and I have the following hierarchy:
Europe
Germany
France
UK
Spain
Italy
How can I enter a value on Europe in an input schedule in order to allocate this value afterwards?
Thanks in advance and best regards
GerdGerd,
It should be something like below -
EuropeInput
Europe
Germany
France
UK
Spain
Italy
EuropeInput shall be kept out of hierarchy and should be a base level member. Users will enter the numbers in this member. In your script logic, you will make use of this member to allocate the data in Bas(Europe) i.e. Germany, France, etc.
Effectively, after allocation the same data will be rolled up to Europe.
Many top-down planning would use such work-around as BPC doesn't allow writing to parent node.
Regards,
Ashish -
How i can give date in each input for applying the exchange rate in Query.
Hi Gurus,
We have a requirement to create some currency conversion queries. In the selection screen user should be able to give four inputs. Like given below
Input 1. a) key figures
b) Fiscal Year
c) Fiscal Period
d) Exchange Rate Type
e) Date (Exchange rate will be applied which is applicable on the given date)
Input 2. a) key figures
b) Fiscal Year
c) Fiscal Period
d) Exchange Rate Type
e) Date (Exchange rate will be applied which is applicable on the given date)
Input 3. a) key figures
b) Fiscal Year
c) Fiscal Period
d) Exchange Rate Type
e) Date (Exchange rate will be applied which is applicable on the given date)
Input 4. a) key figures
b) Fiscal Year
c) Fiscal Period
d) Exchange Rate Type
e) Date (Exchange rate will be applied which is applicable on the given date)
So we will have 4 key figures in the query results with the exchange rate applied on the given date.
I will make four restricted key figures and make the query. I do not know how i can give date in each input for applying the exchange rate.
Please give your suggestions to resolve my problem.
Many thaks in advance.You can not bring the key figures in the selection screen for the currency translation. Instead you can apply a currency translation type to respective key figures in the query definition.
The currency translation type can be defined in RSCUR transaction, where you can maintain the parameters like Exchange Rate Type, Exchange Rate Date etc.
You can refer one of my article on this at
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/600157ec-44e5-2b10-abb0-dc9d06ba6c2f
Hope this helps.
Regards,
Yogesh -
How to get common datas from two int.tables
hi,
please tell me , how to i will get the common datas between two int. tables
& place them in third int. table.
give me syntax.
regards
subhasis.Hi Subhasis,
<b>SORT :</b></u>
SORT itab.
Extras:
1. ... BY f1 f2 ... fn
2. ... ASCENDING
3. ... DESCENDING
4. ... AS TEXT
5. ... STABLE
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Field symbols not allowed as sort criterion.
Effect
The entries in the internal table are sorted in ascending order using the key from the table definition (DATA, TYPES).
Addition 1
... BY f1 f2 ... fn
Effect
Uses the sort key defined by the sub-fields f1, f2, ..., fn of the table itab instead of the table key. The fields can be of any type; even number fields and tables are allowed.
You can also specify the sort fields dynamically in the form (name). If name is blank at runtime, the sort field is ignored. If itab is a table with a header line, you can also use a field symbol pointing to the header line of itab as a dynamic sort criterion. A field symbol that is not assigned is ignored. If a field symbol is assigned, but does not point to the header line of the internal table, a runtime error occurs.
If the line type of the internal table contains object reference variables as components, or the entire line type is a reference variable, you can use the attributes of the object to which a reference is pointing in a line as sort criteria (see Attributes of Objects as the Key of an Internal Table.
You can address the entire line of an internal table as the key using the pseudocomponent TABLE_LINE. This is particularly relevant for tables with a non-structured line type when you want to address the whole line as the key of the table (see also Pseudocomponent TABLE_LINE With Internal Tables).
If you use one of the additions 2 to 5 before BY, it applies to all fields of the sort key by default. You can also specify these additions after each individual sort field f1, f2, ..., fn. For each key field, this defines an individual sort rule which overrides the default.
Addition 2
... ASCENDING
Effect
Sorts in ascending order. This is also the default if no sort order is specified directly after SORT. For this reason, it is not necessary to specify ASCENDING explicitly as the default sort order.
With the addition BY, you can also specify ASCENDING directly after a sort field to define ascending order explicitly as the sort sequence for this field.
Addition 3
... DESCENDING
Effect
Sorts in descending order. If the addition comes right after SORT, DESCENDING is taken as the default for all fields of the sort key.
With the addition BY, you can also specify DESCENDING directly after a sort field.
Addition 4
... AS TEXT
Effect
Text fields are sorted appropriate to the locale. This means that the relative order of characters is defined according to the text environment being used.
When an internal mode is opened (in other words, when a roll area is opened), the text environment is automatically set to the logon language specified in the user master record. If necessary, however, you can change the text environment explicitly in your program by using a SET-LOCALE statement.
If the addition comes directly after itab, locale-specific rules are used for all fields of the sort key where the type of these fields is C or W. After the sort, the sequence of entries usually does not match the sequence which results otherwise, without using the addition AS TEXT, i.e. with binary sorting.
With the addition BY, you can also specify AS TEXT directly after a sort field, provided it is of type C or W, or a structured type. Otherwise, a runtime error occurs. In sort fields with a structured type, AS TEXT only affects subcomponents with type C or W.
In case of an invalid character, a SYSLOG message is written, and the respective record is inserted at the end.
Note
Please keep the rules for site-specific sorting in mind.
Example
Sort a name table with different keys:
TYPES: BEGIN OF PERSON_TYPE,
NAME(10) TYPE C,
AGE TYPE I,
COUNTRY(3) TYPE C,
END OF PERSON_TYPE.
DATA: PERSON TYPE STANDARD TABLE OF PERSON_TYPE WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 5,
WA_PERSON TYPE PERSON_TYPE.
WA_PERSON-NAME = 'Muller'. WA_PERSON-AGE = 22.
WA_PERSON-COUNTRY = 'USA'.
APPEND WA_PERSON TO PERSON.
WA_PERSON-NAME = 'Moller'. WA_PERSON-AGE = 25.
WA_PERSON-COUNTRY = 'FRG'.
APPEND WA_PERSON TO PERSON.
WA_PERSON-NAME = 'Möller'. WA_PERSON-AGE = 22.
WA_PERSON-COUNTRY = 'USA'.
APPEND WA_PERSON TO PERSON.
WA_PERSON-NAME = 'Miller'. WA_PERSON-AGE = 23.
WA_PERSON-COUNTRY = 'USA'.
APPEND WA_PERSON TO PERSON.
SORT PERSON.
Now, the sequence of the table entries is as follows:
Miller 23 USA
Moller 25 FRG
Muller 22 USA
Möller 22 USA
If, for example, you apply German sort rules where the umlaut comes directly after the letter 'o' in the sort, the data record beginning with 'Möller' would not be in the right place in this sequence. It should come second.
Provided a German-language locale is set (e.g. sorting is according to German grammatical rules, see also SET LOCALE), you can sort the names according to German rules as follows:
SORT PERSON BY NAME AS TEXT.
Now, the sequence of table entries is as follows:
Miller 23 USA
Moller 25 FRG
Möller 22 USA
Muller 22 USA
Further examples:
SORT PERSON DESCENDING BY COUNTRY AGE NAME.
Now, the sequence of table entries is as follows:
Miller 23 USA
Möller 22 USA
Muller 22 USA
Moller 25 FRG
SORT PERSON DESCENDING BY AGE ASCENDING NAME AS TEXT.
Now, the sequence of table entries is as follows:
Muller 22 USA
Möller 22 USA
Miller 23 USA
Moller 25 FRG
Addition 5
... STABLE
Effect
Uses a stable sort, that is, the relative sequence of entries that have the same sort key remains unchanged.
Unlike additions 2 to 4, you cannot use this addition directly after a sort field.
Notes
General:
The number of sort fields is restricted to 250.
The sort process is only stable if you use the STABLE addition. Otherwise, a predefined sequence of fields used to sort a list is not usually retained.
It does not make sense to use the SORT command for a SORTED TABLE. If the table type is statically declared, the system returns a syntax error if you try to SORT the table. If the table type is not statically declared (for example, because the table was passed to a FORM routine as an INDEX TABLE in a parameter), and the system can interpret the SORT statement as an empty operation, it ignores the statement. This is the case when the key in the BY clause corresponds to the beginning of the table key. Otherwise, a runtime error occurs.
To delete all duplicate entries from a sorted internal table (e.g. just after SORT), you can use the DELETE ADJACENT DUPLICATES FROM itab statement.
When using the addition AS TEXT, the sequence of entries after the sort does not usually match the sequence resulting from a binary sort, i.e. if the addition AS TEXT is not specified. The consequence of this is that after the SORT, you are not allowed to access with the READ TABLE itab ... BINARY SEARCH statement.
If you still want to access data sorted apppropriate to the locale with a binary search, you can do this by including an additional component in the table where you can explictly store the data formatted using the CONVERT TEXT ... INTO SORTABLE CODE statement. This is also recommended for performance reasons if you have to re-sort the table several times according to locale-specific criteria.
If the internal table has more than 2^19 lines or is larger than 12 MB, the system sorts it physically using an external auxiliary file. You can specify the directory in which the file should be created using the SAP profile parameter DIR_SORTTMP. By default, the system uses the SAP data directory (SAP profile parameter DIR_DATA).
Notes
Performance:
The runtime required to sort an internal table increases with the number of entries and the length of the sort key.
Sorting an internal table with 100 entries with a 50 byte key requires about 1300 msn (standardized microseconds). Using a 30-byte key, the runtime is about 950 msn.
If one of the specified sort criteria is itself an internal table, SORT may sometimes take much longer.
The runtime increases if you use a stable sort.
Physical sorting reduces the runtime required for subsequent sequential processing.
Reward If Useful.
Regards,
Chitra -
How to input data into an arraylist from a text file?
I am trying to take data from a text file and put that data into an arraylist. First here is the text file:
[item1, 10, 125.0, item2, 10, 12.0, item3, 20, 158.0]
3
4530.0
[item5, 65, 555.5, item4, 29, 689.0]
2
56088.5
[item7, 84, 34.5, item6, 103, 0.5, item8, 85, 1.36]
3
3065.1The text between the [ ] is the output from my arraylists. I have three arraylists. The first [ ] belongs to arraylist A, the second to arraylist B, and the third to arraylist C. The format of the arraylists is this:
<item name>,<# in stock>,<value of one item>
The first number below the arraylists in the text file represents the number of items in the list. The second number below the arraylists represents the total value of the items in the arraylists.
Here is the class file I have (yes, it does everything):
import java.io.*;
import java.util.Scanner;
import java.util.ArrayList;
public class Inventory extends Object
public int toAdd = 0;
private boolean done = false; //Are we done yet?
public String strItemName; //The name of the item type.
public int intNumInStock; //The number in stock of that type.
public double dblValueOfOneItem; //The value of one item.
public String strNumberInStock;
public double dblTotalValueA; //The total value of warehouse A.
public double dblTotalValueB; //The total value of warehouse B.
public double dblTotalValueC; //The total value of warehouse C.
public int intWarehouseAItemCount; //Counter for items in warehouse A.
public int intWarehouseBItemCount; //Counter for items in warehouse B.
public int intWarehouseCItemCount; //Counter for items in warehouse C.
ArrayList warehouseAList = new ArrayList(); //Create the Warehouse A ArrayList.
ArrayList warehouseBList = new ArrayList(); //Create the Warehouse B arrayList.
ArrayList warehouseCList = new ArrayList(); //Create the Warehouse C arrayList.
/** Construct a new Inventory object. */
public Inventory()
super();
/**Add items to the Warehouse A ArrayList.*/
private void createWareHouseA()
System.out.println("!" + toAdd + " item types will be added to warehouse A.");
//Cast
String strNumInStock = Integer.toString(intNumInStock);
String strValueOfOneItem = Double.toString(dblValueOfOneItem);
this.strNumberInStock = strNumInStock;
System.out.println("!Initial size of warehouseAList : " +
warehouseAList.size());
//Add items to the array List
warehouseAList.add(this.strItemName);
warehouseAList.add(this.strNumberInStock);
warehouseAList.add(this.dblValueOfOneItem);
System.out.println("!size of arrayList after additions " + warehouseAList.size());
/**Add items to the Warehouse B ArrayList.*/
private void createWareHouseB()
System.out.println("!" + toAdd + " item types will be added to warehouse B.");
//Cast
String strNumInStock = Integer.toString(intNumInStock);
String strValueOfOneItem = Double.toString(dblValueOfOneItem);
this.strNumberInStock = strNumInStock;
System.out.println("!Initial size of warehouseBList : " +
warehouseBList.size());
//Add items to the array List
warehouseBList.add(this.strItemName);
warehouseBList.add(this.strNumberInStock);
warehouseBList.add(this.dblValueOfOneItem);
System.out.println("!size of arrayList after additions " + warehouseBList.size());
/**Add items to the Warehouse C ArrayList.*/
private void createWareHouseC()
System.out.println("!" + toAdd + " item types will be added to warehouse C.");
//Cast
String strNumInStock = Integer.toString(intNumInStock);
String strValueOfOneItem = Double.toString(dblValueOfOneItem);
this.strNumberInStock = strNumInStock;
System.out.println("!Initial size of warehouseCList : " +
warehouseCList.size());
//Add items to the array List
warehouseCList.add(this.strItemName);
warehouseCList.add(this.strNumberInStock);
warehouseCList.add(this.dblValueOfOneItem);
System.out.println("!size of arrayList after additions " + warehouseCList.size());
/**Interpret the commands entered by the user.*/
public void cmdInterpreter()
this.displayHelp();
Scanner cin = new Scanner(System.in);
while (!this.done)
System.out.print(">");
//"line" equals the next line of input.
String line = cin.nextLine();
this.executeCmd(line);
/**Execute one line entered by the user.
* @param cmdLN; The command entered by the user to execute. */
private void executeCmd(String cmdLN)
Scanner line = new Scanner(cmdLN);
if (line.hasNext())
String cmd = line.next();
//What to do when users enter the various commands below.
if (cmd.equals("help"))
this.displayHelp();
else if (cmd.equals("Q!"))
this.done = true;
else if (cmd.equals("F") && line.hasNext())
this.inputFromFile(line.next());
else if (cmd.equals("K") && line.hasNext())
int numItemsToAdd = Integer.valueOf( line.next() ).intValue();
this.toAdd = numItemsToAdd;
this.inputFromKeyboard(numItemsToAdd);
/**What to do if input comes from a file.
* @param inputFile; The name of the input file to process.*/
private void inputFromFile(String inputFile)
Scanner cin = new Scanner(System.in);
System.out.println("!Using input file " + inputFile + ".");
System.out.print("!Enter the name of the output file: ");
String outputFile = cin.next();
System.out.println("!Using output file " + outputFile + ".");
try
BufferedReader in = new BufferedReader(new FileReader(inputFile));
//Scanner in = new Scanner(new File(inputFile));
//Initialize the String variables.
String line1 = null;
String line2 = null;
String line3 = null;
String line4 = null;
String line5 = null;
String line6 = null;
String line7 = null;
String line8 = null;
String line9 = null;
System.out.println(in.equals(",") + " see?");
//System.out.println((char)(char)in.read() + " experiment");
/**This loop assigns values to the string variables based on the
* values on each line in the input file. */
while(in.readLine() != null)
line1 = in.readLine();
line2 = in.readLine();
line3 = in.readLine();
line4 = in.readLine();
line5 = in.readLine();
line6 = in.readLine();
line7 = in.readLine();
line8 = in.readLine();
line9 = in.readLine();
//Print the contents of each line in the input file.
System.out.println("!value of line 1: " + line1);
System.out.println("!value of line 2: " + line2);
System.out.println("!value of line 3: " + line3);
System.out.println("!value of line 4: " + line4);
System.out.println("!value of line 5: " + line5);
System.out.println("!value of line 6: " + line6);
System.out.println("!value of line 7: " + line7);
System.out.println("!value of line 8: " + line8);
System.out.println("!value of line 9: " + line9);
/**Add items to the warehouses.*/
warehouseAList.add(line1);
warehouseBList.add(line4);
warehouseCList.add(line7);
/**Add the item count and total value for warehouse A.*/
int intLine2 = Integer.valueOf(line2).intValue();
this.intWarehouseAItemCount = intLine2;
double dblLine3 = Double.valueOf(line3).doubleValue();
this.dblTotalValueA = dblLine3;
/**Add the item count and total value for warehouse B.*/
int intLine5 = Integer.valueOf(line5).intValue();
this.intWarehouseBItemCount = intLine5;
double dblLine6 = Double.valueOf(line6).doubleValue();
this.dblTotalValueB = dblLine6;
/**Add the item count and total value for warehouse C.*/
int intLine8 = Integer.valueOf(line8).intValue();
this.intWarehouseCItemCount = intLine8;
double dblLine9 = Double.valueOf(line9).doubleValue();
this.dblTotalValueC = dblLine9;
/**Ask the user how many items to add or delete from inventory.*/
System.out.print("Enter the number to add to inventory for " +
warehouseAList.get(0) + ":");
String toAddOrDel = cin.next();
/**Print the contents of all the warehouses. */
System.out.println(" ");
//Print the contents of warehouse A.
System.out.println("!--------------------------------");
System.out.println("!----------Warehouse A:----------");
System.out.println("!--------------------------------");
//Print the item list for warehouse A.
System.out.println(warehouseAList);
//Print the total amount of items in warehouse A.
System.out.println("Total items: " + this.intWarehouseAItemCount);
//Print the total value of the items in warehouse A.
System.out.println("Total value: " + this.dblTotalValueA);
System.out.println("!--------------------------------");
System.out.println("!----------Warehouse B:----------");
System.out.println("!--------------------------------");
//Print the item list for warehouse B.
System.out.println("!warehouseB: " + warehouseBList);
//Print the total amount of items in warehouse B.
System.out.println("Total items: " + this.intWarehouseBItemCount);
//Print the total value of the items in warehouse B.
System.out.println("Total value: " + this.dblTotalValueB);
System.out.println("!--------------------------------");
System.out.println("!----------Warehouse C:----------");
System.out.println("!--------------------------------");
//Print the item list for warehouse C.
System.out.println("!warehouseC: " + warehouseCList);
//Print the total amount of items in warehouse C.
System.out.println("Total items: " + this.intWarehouseCItemCount);
//Print the total value of the items in warehouse C.
System.out.println("Total value: " + this.dblTotalValueC);
in.close();
catch (FileNotFoundException e)
System.out.println("!Error: Unable to open file for reading.");
catch (EOFException e)
System.out.println("!Error: EOF encountered, file may be corrupted.");
catch (IOException e)
System.out.println("!Error: Cannot read from file.");
/**What to do if input comes from the keyboard.
* @param numItems; The total number of items that will be added to the
* Warehouse(s). */
public void inputFromKeyboard(int numItems)
System.out.println("!You will be adding " + numItems + " items to " +
"inventory from the keyboard. ");
this.toAdd = numItems;
Scanner cin = new Scanner(System.in);
//Prompt user for name of output file.
System.out.print("!Enter the name of the output file: ");
String outputFile = cin.next();
/**This loop asks the user for information about the item(s) and inputs
*them into the appropriate array.*/
int count = 0;
while (numItems > count)
//Item name.
System.out.print("!Item name: ");
String addItemName = cin.next();
//Number in stock.
System.out.print("!Number in stock: ");
String addNumInStock = cin.next();
//Initial warehouse.
System.out.print("!Initial warehouse(A,B,C): ");
String addInitWarehouse = cin.next();
//Value of one item.
System.out.print("!Value of one item: ");
String addValueOfOneItem = cin.next();
//Add or delete from inventory
System.out.print("!Enter amount to add or delete from inventory: ");
String strAddOrDelete = cin.next();
System.out.println("!Amount to add or delete: " + strAddOrDelete);
//Cast
int intAddNumInStock = Integer.valueOf(addNumInStock).intValue();
double doubleAddValueOfOneItem = Double.valueOf(addValueOfOneItem).doubleValue();
int intAddOrDelete = Integer.valueOf(strAddOrDelete).intValue();
/**Add intAddNumInStock with intAddOrDelete to determine the amount
* to add or delete from inventory (If a user wishes to remove items
* from inventory simply add negative values). */
intAddNumInStock = intAddNumInStock + intAddOrDelete;
System.out.println("!Inventory after modifications: " + strAddOrDelete);
this.strItemName = addItemName;
this.intNumInStock = intAddNumInStock;
this.dblValueOfOneItem = doubleAddValueOfOneItem;
//Put items into warehouse A if appropriate.
if (intAddNumInStock < 25)
//Increment the warehouse A item count.
this.intWarehouseAItemCount = this.intWarehouseAItemCount + 1;
//Calculate the total value of warehouse A.
this.dblTotalValueA = this.dblTotalValueA + intAddNumInStock * doubleAddValueOfOneItem;
//Create the warehouse A array list.
this.createWareHouseA();
//Put items into warehouse B if appropriate.
if (intAddNumInStock >= 25)
if (intAddNumInStock < 75)
//Increment the warehouse B item count.
this.intWarehouseBItemCount = this.intWarehouseBItemCount + 1;
//Calculate the total value of warehouse B.
this.dblTotalValueB = this.dblTotalValueB + intAddNumInStock * doubleAddValueOfOneItem;
//Create the warehouse B array list.
this.createWareHouseB();
//Put items into warehouse C if appropriate.
if (intAddNumInStock >= 75)
//Increment the warehouse C item count.
this.intWarehouseCItemCount = this.intWarehouseCItemCount + 1;
//Calculate the total value of warehouse C.
this.dblTotalValueC = this.dblTotalValueC + intAddNumInStock * doubleAddValueOfOneItem;
//Create the warehouse C array list.
this.createWareHouseC();
//display helpful information.
System.out.println("!--------------------------------");
System.out.println("!" + addItemName + " is the item name.");
System.out.println("!" + addNumInStock + " is the number in stock.");
System.out.println("!" + addInitWarehouse + " is the initial warehouse.");
System.out.println("!" + addValueOfOneItem + " is the value of one item.");
System.out.println("!--------------------------------------------------");
//Increment the counters.
count++;
/**Create and write to the output file. */
try
//Use the output file specified by the user.
PrintWriter out = new PrintWriter(outputFile);
/**Write warehouse A details.*/
//Blank the first line.
out.println(" ");
//Write the array list for warehouse A.
out.println(warehouseAList);
//Write the amount of items in warehouse A.
out.println(intWarehouseAItemCount);
//Write the total value for warehouse A.
out.println(dblTotalValueA);
/**Write warehosue B details.*/
//Write the array list for warehouse B.
out.println(warehouseBList);
//Write the amount of items in warehouse B.
out.println(intWarehouseBItemCount);
//Write the total value for warehouse B.
out.println(dblTotalValueB);
/**Write warehouse C details.*/
//Write the array list for warehouse C.
out.println(warehouseCList);
//Write the amount of items in warehouse C.
out.println(intWarehouseCItemCount);
//Write the total value for warehouse C.
out.println(dblTotalValueC);
//Close the output file.
out.close();
catch (FileNotFoundException e)
System.out.println("Error: Unable to open file for reading.");
catch (IOException e)
System.out.println("Error: Cannot read from file.");
/**View the contents and the value of each warehouse.*/
System.out.println("!---------------Inventory Summary------------------");
System.out.println("!--------------------------------------------------");
System.out.println("!--------------------LEGEND:-----------------------");
System.out.println("!<item type>, <amount in stock>,<value of one item>");
System.out.println("!--------------------------------------------------");
System.out.println("!------------------Warehouse A:--------------------");
System.out.println("!--------------------------------------------------");
//Display Items in warehouse A.
System.out.println(warehouseAList);
//Total items in warehouse A.
System.out.println("Total items: " + intWarehouseAItemCount);
//Display total value of warehouse A.
System.out.println("Total value: " + "$" + dblTotalValueA);
System.out.println("!--------------------------------------------------");
System.out.println("!------------------Warehouse B:--------------------");
System.out.println("!--------------------------------------------------");
//Display Items in warehouse B.
System.out.println(warehouseBList);
//Total items in warehouse B.
System.out.println("Total items: " + intWarehouseBItemCount);
//Display total value of warehouse B.
System.out.println("Total value: " + "$" + dblTotalValueB);
System.out.println("!--------------------------------------------------");
System.out.println("!------------------Warehouse C:--------------------");
System.out.println("!--------------------------------------------------");
//Display Items in warehouse C.
System.out.println(warehouseCList);
//Total items in warehouse C.
System.out.println("Total items: " + intWarehouseCItemCount);
//Display total value of warehouse C.
System.out.println("Total value: " + "$" + dblTotalValueC);
/**Display a help message.*/
private void displayHelp()
System.out.println("!--------------------------------");
System.out.println("! General Help:");
System.out.println("!--------------------------------");
System.out.println("! ");
System.out.println("!'help' display this help message.");
System.out.println("!'Q!' quit this program.");
System.out.println("!--------------------------------");
System.out.println("! Input File Specific Commands:");
System.out.println("!--------------------------------");
System.out.println("! ");
System.out.println("!'F' <name> type F followed by the name of the " +
"file to be used for input.");
System.out.println("!---------------------------------------");
System.out.println("! Input From Keyboard Specific Commands:");
System.out.println("!---------------------------------------");
System.out.println("! ");
System.out.println("!'K' <number> type K followed by the number of " +
"items that will be added. ");
System.out.println("! ");
}Program file:
public class InventoryProg
public static void main(String[] args)
//Create a new Inventory object.
Inventory test = new Inventory();
//Execute the command interpreter.
test.cmdInterpreter();
}Right now I am stuck on this and I cannot progress any further until I figure out how to input the data in the text file back into a arraylist.
Thanks in advance.Thanks but I figured it out. Heres a sample of the code i used to solve my problem:
try
//Warehouse A BufferedReader.
BufferedReader inA = new BufferedReader(new FileReader(inputFileWarehouseA));
//Warehouse B BufferedReader.
BufferedReader inB = new BufferedReader(new FileReader(inputFileWarehouseB));
//Warehouse C BufferedReader.
BufferedReader inC = new BufferedReader(new FileReader(inputFileWarehouseC));
//Warehouse details BufferedReader.
BufferedReader inDetails = new BufferedReader(new FileReader(inputFileDetails));
//Will hold values in warehouse arraylists.
String lineA = null;
String lineB = null;
String lineC = null;
//Will hold the details of each warehouse.
String line1 = null;
String line2 = null;
String line3 = null;
String line4 = null;
String line5 = null;
String line6 = null;
//Get the item count and total value for each warehouse.
while(inDetails.readLine() != null)
line1 = inDetails.readLine();
line2 = inDetails.readLine();
line3 = inDetails.readLine();
line4 = inDetails.readLine();
line5 = inDetails.readLine();
line6 = inDetails.readLine();
/**Assign the item count and total value to warehouse A.*/
//Cast.
int intLine1 = Integer.valueOf(line1).intValue();
double dblLine2 = Double.valueOf(line2).doubleValue();
//Assign the values.
this.intWarehouseAItemCount = intLine1;
this.dblTotalValueA = dblLine2;
/**Assign the item count and total value to warehouse B.*/
//Cast.
int intLine3 = Integer.valueOf(line3).intValue();
double dblLine4 = Double.valueOf(line4).doubleValue();
//Assign the values.
this.intWarehouseBItemCount = intLine3;
this.dblTotalValueB = dblLine4;
/**Assign the item count and total value to warehouse C.*/
//Cast.
int intLine5 = Integer.valueOf(line5).intValue();
double dblLine6 = Double.valueOf(line6).doubleValue();
//Assign the values.
this.intWarehouseCItemCount = intLine5;
this.dblTotalValueC = dblLine6;
/**Put the items back into the warehouses arraylists. */
//Add items to warehouse A.
while((lineA = inA.readLine()) != null)
warehouseAList.add(lineA);
//Add items to warehouse B.
while((lineB = inB.readLine()) != null)
warehouseBList.add(lineB);
//Add items to warehouse C.
while((lineC = inC.readLine()) != null)
warehouseCList.add(lineC);
}(this isn't the whole try statement its pretty long) -
i have multiple devices backed up to the same computer each with different data. how do i keep them from syncing all data when i back up or transfer stuff from the computer to a device? one is an iphone 6 and the others are ipad mini first gens, each ipad has 64gb and the iphone has 128, need to keep the data seperate as they are not all mine
Itunes content and pics are NOT part of the backup that itunes performs.
Backing up, updating, and restoring iPad, iPod touch, and iPhone software
You should transfer any purchases from iphone regularly: File>Transfer Purchases , if they fail to be transferred when you sync.
You buy one and only one download. It is your responsibility to move/copy/backup your purchases.
You can try contacting itunes support and asking for an exception, but they are under no obligation to allow.
http://www.apple.com/support/itunes -
How to make use of adjacent data elements within the same buffer
Hi,
Does anyone know how to make use of adjacent data elements within the same buffer? To make my question clearly, I would like to give you an example. In my application, I set "sample to read" as 10 which means at each loop 10 data samples will be taken into a buffer. Now, what I would like to do is to do some calculations on adjacent data samples in same buffer. I tried to use "shift register" for this, but it seemed to me that it only can deal with the calculation between data from adjacent loops. In other words, it skips 9 data elements and take the 10th one for the calculation.
Here I also attach my VI showing what I did.
Thank you very much in advance,
Suksun
Attachments:
wheel_encoder_1.vi 98 KBHi Suksun,
I hope you'll forgive me for distilling your code - mainly to understand it better. I tried to duplicate your logic exactly - which required reversing the "derivatives"-array before concatination with the current samples array. As in your code, the last velocity is being paired with the first position. If first velocity is really supposed to be paired with first position, just remove the "Reverse 1D Array" node.
cheers
Message Edited by Dynamik on 01-07-2006 03:17 AM
Message Edited by Dynamik on 01-07-2006 03:19 AM
When they give imbeciles handicap-parking, I won't have so far to walk!
Attachments:
encoder2.GIF 14 KB
encoder2.vi 102 KB -
Metadata: how to use same data on multiple tracks in a project.
I need to figure out how to cut and paste metadata from one audio file to the next. I am transferring 500 vinyl albums to digital. I would like to be able to fill in the ID3 and other metadata that is the same for the 10 to 12 songs on the disk and have that information transfer to each of the files I ultimately turn into mp3. How can I do that. Essentially, artist, album, recording data, comments, genre, and copyright are all the same.
My workflow is to copy all of the tracks from the master recording of the disk into individual audio files and save those as the MP3. If I enter metadata manually in the audio track, it is saved with the MP3 and read by iTunes when converted. However, I want to be able to create one metadata -- I guess template -- with the data that is the same and have that automatically transferred from the master to the cuts.
Is it possible?Not in Audition, I'm afraid. But there's certainly software that will allow extensive metadata manipulation of ID3 tags available, possibly for just the reasons you are mentioning. You have to bear in mind that Audition is essentially an editor, and MP3s are just a saving possibility, and not the format it natively works in, so it's not extensively set up to deal with them in the way you want; not it's job, really!
-
How to compare a Date data with Current Year and Period Member on FIX
Hi experts,
I have a Project dim that each member is a Project (P01, P02...)
and Account dim that stores information of the each Project (Name, Start date, Finished Date...)
Finished Date member is in Date data type
So how can write a IF condition below in order to compare Project Finished Date with Current Year and Period members on FIX
FIX (@Descendants(Projects), Descendants(All Year), Descendants("Year Total")...)
IF (@CURRMBR(Period)->@CURRMBR(Year) < Project->FinishedDate)
Do something...
Else
Do something
Please help me on this. Sorry for my bad grammar. Please ask if there is anything unclear
Many thanks,
Huy Van.
Edited by: Huy Van on Jan 29, 2013 1:14 AM
Edited by: Huy Van on Jan 29, 2013 2:24 AM
Edited by: Huy Van on Jan 29, 2013 2:25 AM
Edited by: Huy Van on Jan 29, 2013 6:04 PMHere is what I have done. Post for whom may concern later
VAR FM; /* Finished Month of Project*/
VAR FY; /* Finished Year of Project */
VAR CM; /* Capture Current Month on FIX statments */
VAR CY; /* Capture Current Year on FIX statments*/
FIX ( @RELATIVE( "Year", 0), @RELATIVE( "Period", 0), @IDescendants( "Base Projects")....)
FY = @ROUND( "TGHT"->"NA Contract"->"FY06"->"NA Period" / 10000, 0);
FM = @MOD( @ROUND( "TGHT"->"NA Contract"->"FY06"->"NA Period" / 100, 0), 100);
/* For FY13 return 13... */
CY = @JgetDoubleFromString( @CONCATENATE( "20", @SUBSTRING( @NAME( @CURRMBRRANGE( Year, Lev, 0, 0, 0)), 2)));
/* Set CM value based on currrent Period On FIX statement */
IF ( @ISMBR( "Jan"))
CM = 1;
ELSEIF ( @ISMBR( "Feb"))
CM = 2;
ELSEIF ( @ISMBR( "Dec"))
CM = 12;
ENDIF
IF ( CY < FY OR ( CY == FY AND CM < FM))
Do something...
ELSE
Do something...
ENDIF
ENDFIX
Edited by: Huy Van on Feb 19, 2013 11:10 PM
Edited by: Huy Van on Feb 20, 2013 7:46 PM -
Dear Team,
Japanese characters alone are not passing correctly (passing like ??? or some unreadable characters) to Adobe application when we create input variable as XML data type. The same solution works fine if we change input variable data type to document type. Could you please do needful. Thank youHello,
most recent patches for IGS and kernel installed. Now it works. -
How to get the same period last year value using Fiscal Calendar?
Hi there,
I am using DAX in a Tabular Model project but I am getting stuck trying to get the following:
We are using a Fiscal Calendar (from 01 April to 31 March).
Previous Period Value
Value
2012
April
15
May
10
Jun
20
2013
April
15
30
May
10
20
Jun
20
25
I have tried to use sameperiodlastyear but there is an error saying that this function cannot be used for non contiguous dates. DATEADD is given the same error...
Could anyone help me getting the right measure expressions for [Previous Period Value]?
Thanks and best regards,
JossHi Joss,
In SQL Server Analysis Services, we can can compare revenue with the hierarchy periods (year, month, day) by using the PARALLELPERIOD function, and now you want to compare with custom periods. (NOTE: We cannot compare it with the PARALLELPERIOD function
since
PARALLELPERIOD function returns a member from a prior period in the same relative position as a specified member. So if the first time span not equal to the second one (such as the first period is 3 days, and the second period is 2 month)). Here
is a sample query about PARALLELPERIOD function for your reference.
with
set Hotels as
[Hotels].[Hotel ID].&[1015],
[Hotels].[Hotel ID].&[5640],
[Hotels].[Hotel ID].&[8800]
set Period as [Arrival Date].[Date].[Month].&[2012]&[1]:[Arrival Date].[Date].[Month].&[2012]&[12]
member [Arrival Date].[Date].[0] as sum({ Period })
member [Total Amount N-1] as (PARALLELPERIOD([Arrival Date].[Date].[Year], 1, [Arrival Date].[Date].[Year].&[2012]), [Measures].[Total Amount])
select
[Measures].[Total Amount],
[Measures].[Total Amount N-1]
} on 0,
nonemptycrossjoin
Hotels,
Hotels.[Hotel].children,
*{[Arrival Date].[Date].[0]}
} on 1
from [Booking_Cube]
Regards,
Charlie Liao
TechNet Community Support -
How to use same Data Type and Length for two fields
How to use same data type and length for two fields when using 'FOR ALL ENTRIES IN' in a select statement? For instance the select queries are :
SELECT bukrs gjahr belnr lifnr budat bldat zlspr dmbtr waers shkzg
FROM bsik
INTO TABLE it_bsik
WHERE bukrs = p_bukrs
AND lifnr IN s_lifnr.
IF it_bsik IS NOT INITIAL.
SELECT belnr gjahr awkey awtyp
FROM bkpf
INTO TABLE it_bkpf
FOR ALL ENTRIES IN it_bsik
WHERE belnr = it_bsik-belnr
AND gjahr = it_bsik-gjahr.
IF it_bkpf IS NOT INITIAL.
SELECT belnr gjahr lifnr xblnr
FROM rbkp
INTO TABLE it_rbkp
FOR ALL ENTRIES IN it_bkpf
WHERE belnr = it_bkpf-awkey+0(10)
AND gjahr = it_bkpf-awkey+10(4).
ENDIF.
ENDIF.
Here it gives an error in the 3rd select query that 'When you use the addition "FOR ALL ENTRIES IN itab", the fields "GJAHR" and "IT_BKPF2-AWKEY+10(4)" must have the same type and the same length.'
Kindly clarify.Hi Saurabh,
Please see the example code that I have developed for you. It will help you solve the problem.
REPORT ZTEST_3 .
tables : BKPF.
data : begin of it_bkpf occurs 1,
belnr type RE_BELNR,
awkey type awkey,
awtyp type awtyp,
gjahr type GJAHR,
end of it_bkpf.
data : begin of it_bkpf1 occurs 1,
belnr type RE_BELNR,
awkey type gjahr, " change the data type
awtyp type awtyp,
gjahr type GJAHR,
end of it_bkpf1.
data : begin of it_rbkp occurs 1,
belnr type BELNR_D,
gjahr type gjahr,
lifnr type LIFRE,
xblnr type XBLNR,
end of it_rbkp.
select belnr
awkey
awtyp
gjahr
from bkpf
into table it_bkpf
where BUKRS = 'TELH'.
loop at it_bkpf.
it_bkpf1-belnr = it_bkpf-belnr.
it_bkpf1-awkey = it_bkpf-awkey+10(4). "Here only append the required length.
it_bkpf1-awtyp = it_bkpf-awtyp.
it_bkpf1-gjahr = it_bkpf-gjahr.
append it_bkpf1.
clear it_bkpf1.
endloop.
select belnr
gjahr
lifnr
xblnr
from RBKP
into table it_rbkp
for all entries in it_bkpf1
where belnr = it_bkpf1-belnr
This is just an example. Change the fields according to your requirement.
Regards
Abhii
Edited by: Abhii on Mar 9, 2011 9:08 AM
Maybe you are looking for
-
How to find country of user who is accessing website
I want to find the know the country of my user whether they are from USA or INDIA or UK etc.
-
Can anyone decipher this?
Can anyone decipher this from a MacBook Air? Version:1.0 StartHTML:0000000177 EndHTML:0000023165 StartFragment:0000002541 EndFragment:0000023129 SourceURL:file://localhost/Users/Station03/Desktop/error%20report.docx Interval Since
-
What Do You Use To Defrag? and what other maintnance on drives?
i was reading in the logic manual about defrag disks. the only things i've done to my disks where run disk permisions, repair disk and also disk warrior. now is there something else that needs to be done to main hard drive, internal audio drive and e
-
i upgrated my ipad...now i cant even get pass welcome...help
-
CRMXIF_ORDER_SAVE_M02 - how to populate pricing conditions at header lvl?
Hi all, im using lsmw idoc basic type CRMXIF_ORDER_SAVE_M02 to create Service Orders. my problem now is, it only contains pricing conditions segment (E101CRMXIF_PRCD_COND_XT) under the item level. is there anyway so that i can populate the pricing co