Regarding substract 2 dates and display o/p in days
hi all
in my program i hv to substract to diffrent dates field and display result in days.
i.e suppose i hv to substract 10/6/2008-1/06/2008
display should be 9 days
Hi,
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
date1 = date1
date2 = date2 OUTPUT_FORMAT = '02'
IMPORTING
YEARS =
MONTHS =
DAYS = v_days
EXCEPTIONS
INVALID_DATES_SPECIFIED = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
In v_date you get the number of days between the two dates.
Reward points if useful.
Thanks & regards
Deepika
Similar Messages
-
Accessing sap tables data and display in webi
Hi all,
i installed business objects edge series.
i want to access SAP tables data and display in webi for adhoc reporting.
Is there any process to achieve this.Hi
currently (April 2010) you have the following options:
1. You load your R/3 data into an SAP BW and use universes based on BEx queries to create WebI reports
2. You can use SAP rapid marts. They contain Data integrator mappings (you need an installation of the DI for this) to extract and load your SAP R/3 data into a relational database. Additionally they provide universes (based on a relational schema) hich ill allo you to build WebI reports.
3. You can use the R/3 connector for the Data Federator (You need a DF installation for this). Please note that the R/3 connector is not yet a product rather just a PROTOTYPE. Take a look here: SAP BusinessObjects Web Intelligence Reporting for SAP ERP [original link is broken]
4. You can try to access the underlying database directly using the appropriate DB drivers. Please note that this is NOT RECOMMENDED. This way you cannot leverage security defined on the R/3 side in your WebI reports and you will not be able to access all data as available in R/3 since some of them are stored encoded/compressed in the underlying tables.
5. Instead of WebI you can use Crystal Reports and the R/3 drivers (eg. SAP Tables, Functions, Cluster) provided when installing the integration kit for SAP.
Regards,
Stratos -
How to Read the one Source Column data and Display the Results
Hi All,
I have one PR_ProjectType Column in my Mastertable,Based on that Column we need to reed the column data and Display the Results
Ex:
Pr_ProjectType
AD,AM
AD
AM
AD,AM,TS,CS.OT,TS
AD,AM
like that data will come now we need 1. Ad,AM then same we need 2. AD also same we need 3. AM also we need
4.AD,AM,TS,CS.OT,TS in this string we need AD,AM only.
this logic we need we have thousand of data in the table.Please help this is urgent issue
vasuHi Vasu,
Based on your description, you want to eliminate the substrings (eliminated by comma) that are not AD or AM in each value of the column. Personally, I don’t think this can be done by just using an expression in the Derived Column. To achieve your goal, here
are two approaches for your reference:
Method 1: On the query level. Replace the target substrings with different integer characters, and create a function to eliminate non-numeric characters, then replace the integer characters with the corresponding substrings. The statements
for the custom function is as follows:
CREATE FUNCTION dbo.udf_GetNumeric
(@strAlphaNumeric VARCHAR(256))
RETURNS VARCHAR(256)
AS
BEGIN
DECLARE @intAlpha INT
SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric)
BEGIN
WHILE @intAlpha > 0
BEGIN
SET @strAlphaNumeric = STUFF(@strAlphaNumeric, @intAlpha, 1, '' )
SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric )
END
END
RETURN ISNULL(@strAlphaNumeric,0)
END
GO
The SQL commands used in the OLE DB Source is like:
SELECT
ID, REPLACE(REPLACE(REPLACE(REPLACE(dbo.udf_GetNumeric(REPLACE(REPLACE(REPLACE(REPLACE([ProjectType],'AD,',1),'AM,',2),'AD',3),'AM',4)),4,'AM'),3,'AD'),2,'AM,'),1,'AD,')
FROM MyTable
Method 2: Using a Script Component. Add a Derived Column Transform to replace the target substrings as method 1, use Regex in script to remove all non-numeric characters from the string, add another Derived Column to replace the integer
characters to the corresponding substring. The script is as follows:
using System.Text.RegularExpressions;
Row.OutProjectType= Regex.Replace(Row.ProjectType, "[^.0-9]", "");
References:
http://blog.sqlauthority.com/2008/10/14/sql-server-get-numeric-value-from-alpha-numeric-string-udf-for-get-numeric-numbers-only/
http://labs.kaliko.com/2009/09/c-remove-all-non-numeric-characters.html
Regards,
Mike Yin
TechNet Community Support -
Select RTF Data and display in PDF Document
Hi all,
I have a simple table:
CONTENT_ID - NUMBER
CONTENT - VARCHAR2(4000)
On top of this table I have a form that allows the user to enter / update data. The 'CONTENT' field is a Rich Text Editor (ApEx 4.0 - CKEditor 3). This allows the user to enter and format their text as they require.
I need to be able to select this data and display it in a PDF Document (via BI Publisher).
I therefore have a simple query
select content from content_table where content_id = 1;and a simple template that processes the resulting xml:
<?xml version="1.0" encoding="UTF-8"?>
<ROWSET>
<ROW>
<CONTENT>& lt;h2& gt;
This is a heading& lt;/h2& gt;
& lt;p& gt;
This is the text& lt;/p& gt;
</CONTENT>
</ROW>
</ROWSET>(There is not really a space between the & and 'lt' etc but I had to add this to get it to display correctly here).
Where I run this past my template I get a PDF with:
<h2>
This is a heading</h2>
<p>
This is the text</p>I get the same if I generate HTML.
but what I want to see is the text formatted as the user has entered in the RTF editor.
Can this be done?
Many thanks,
MartinI think your mixing 2 technologies.
At 1 side you have xml in combination with xsl (style sheets used in BI Publisher and FOP) to generate your pdf. And at the other side you have HTML...
XML and HTML are 2 entirely different technologies which you can not mix this simple. I investigated the same problem as you had, and in the end I ended up using jasperreports instead of FOP.
Maybe BI Publisher has some html regions which you could insert into your word document but I doubt it cause more people have asked the same question on this board...
So my advice: use jasperreports (also it is free for commercial usage)
Success
Br,
Nico -
How to retrieve data and display in JSP page
hi,
i am trying to retrieve data from SQL server 2000 and display in JSP Page. I have already place the codes of the retrieve in the bean file. I wanna ask is that how to display in the JSP page. If possible, can provide example codings for mi to reference?
Thanks
Regards,
shixuanHI Tan ,
I pressume that you wanted to make use of PDK, the code can go like this .
<b><u>1) JAVA file</u></b>
import com.sapportals.htmlb.DropdownListBox;
import com.sapportals.htmlb.InputField;
import com.sapportals.htmlb.event.Event;
import com.sapportals.htmlb.page.DynPage;
import com.sapportals.htmlb.page.PageException;
import com.sapportals.portal.htmlb.page.JSPDynPage;
import com.sapportals.portal.htmlb.page.PageProcessorComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentSession;
import com.sapportals.portal.prt.component.IPortalComponentContext;
import java.sql.*;
public class P_SAP_B_User extends PageProcessorComponent
* Method : getPage()
* Description :
* Input Parameters : None
* Returns : Object of Class DynPage
public DynPage getPage()
return new P_SAP_B_UserDynPage();
} // end of dynPage()
public static class P_SAP_B_UserDynPage extends JSPDynPage
/* Variable Declaration */
/* Object of bean class P_SAP_B_CreateUser initialised to null */
private P_SAP_B_CreateUser createUserBean = null;
/* Flags for checking the occurance of Event & Error. */
private int iFlag=0;
private int iErrFlag=0;
/* Variables for storing the information
entered by user in each text field */
private String sFname;
private String sSname;
private String sAge;
private String sExp;
private String sSkill;
private String sUnit;
* Method : doInitialization()
* Description :
* Input Parameters : None
* Returns : None
public void doInitialization()
IPortalComponentSession componentSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
Object o = componentSession.getValue("createUserBean");
if(o==null || !(o instanceof P_SAP_B_CreateUser))
createUserBean = new P_SAP_B_CreateUser();
componentSession.putValue("createUserBean",createUserBean);
} // end of if
else
createUserBean = (P_SAP_B_CreateUser) o;
} // end of else
}//end of doInitialisation()
* Method : onUpdate()
* Description :
* Input Parameters : object of Event class
* Returns : None
public void onUpdate(Event e)throws PageException
/* sets flag to 1 when update button is clicked. */
iFlag=1;
* Method : doProcessAfterInput()
* Description :
* Input Parameters : None
* Returns : None
public void doProcessAfterInput() throws PageException
InputField ifFirstName = (InputField) getComponentByName("FirstName");
InputField ifSecondName = (InputField) getComponentByName("SecondName");
InputField ifAge = (InputField) getComponentByName("Age");
InputField ifExp = (InputField) getComponentByName("Exp");
InputField ifSkill = (InputField) getComponentByName("Skill");
DropdownListBox dlbUnit = (DropdownListBox) getComponentByName("Unit");
int iAge,iExp;
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IPortalComponentContext myContext = request.getComponentContext();
P_SAP_B_CreateUser myNameContainer = (P_SAP_B_CreateUser) myContext.getValue("createUserBean");
if(ifFirstName != null)
this.sFname = ifFirstName.getValueAsDataType().toString() ;
} // end of if
if(ifSecondName!= null)
this.sSname = ifSecondName.getValueAsDataType().toString() ;
} // end of if
if(ifAge!= null)
this.sAge = ifAge.getValueAsDataType().toString() ;
} // end of if
if(ifExp!= null)
this.sExp = ifExp.getValueAsDataType().toString() ;
} // end of if
if(ifSkill != null)
this.sSkill = ifSkill.getValueAsDataType().toString() ;
} // end of if
if(dlbUnit != null)
this.sUnit = dlbUnit.getSelection().toString() ; ;
} // end of if
/* Data Validation */
/* try block for numeric Exception */
try
/* checking for any field left blank by the user */
if(sFname.equals("") || sSname.equals("") || sAge.equals("")|| sExp.equals("") || sSkill.equals(""))
/* set error flag to 1 in case of any field left blank */
iErrFlag=1;
} // end of if
else
/* converting Age and Experience fields (String) to integer */
iAge= Integer.parseInt(sAge);
iExp= Integer.parseInt(sExp);
/* setting the boundaries on the value in Age Field */
if(iAge<0)
/* set error flag to 2 in case of age below 0 */
iErrFlag=2;
}// end of if
/* setting the boundaries on the value in Experience field */
else if(iExp<0 ||(iExp/12)>=iAge)
/* set error flag to 3 in case of experience below 0 or exceeding the age in years */
iErrFlag=3;
}// end of else if
/* In case of no error */
else
/* setting the bean variables */
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:Test");
String query="insert into UserData values(?,?,?,?,?,?)";
PreparedStatement prestat=con.prepareStatement(query);
/* setting the values to be inserted into the user table */
prestat.setString(1,sFname);
prestat.setString(2,sSname);
prestat.setString(3,sAge);
prestat.setString(4,sExp);
prestat.setString(5,sSkill );
prestat.setString(6,sUnit);
prestat.executeUpdate() ;
prestat.close();
con.close();
myNameContainer.setSFname(sFname);
myNameContainer.setSLname(sSname);
myNameContainer.setSAge(sAge);
myNameContainer.setSExp(sExp);
myNameContainer.setSSkill(sSkill);
myNameContainer.setSUnit(sUnit);
} // end of inner try block
catch(Exception sqle)
myNameContainer.setErrMessage("Update failed ! Please try again." );
} // end of catch corresponding to inner try
} // end of inner else
} //end of outer else
} //end of outer try block
catch(Exception e)
/* setting flag to 4 in case of non-numeric age/experience values */
iErrFlag = 4;
/* Displaying error message corresponding to the value of error flag */
switch(iErrFlag)
/* Empty Field */
case 1:myNameContainer.setErrMessage( "Please Fill all the fields");
break;
/* Invalid Value in the age field */
case 2:myNameContainer.setErrMessage( "Enter a valid value in Age field.(Hint : Have you entered Age<0 ?");
break;
/* Invalid Value in the experience field */
case 3:myNameContainer.setErrMessage( "Enter a valid value in Experience field.(Hint : Experince should not be negative or greater than your age in months)");
break;
/* Non-numeric value in the Age/ experience fields */
case 4:myNameContainer.setErrMessage( "Please Enter Numeric Value for Age and Experience");
break;
} // end of switch-case block
} //end of doProcessAfterInput()
* Method : doProcessBeforeOutput()
* Description :
* Input Parameters : None
* Returns : None
public void doProcessBeforeOutput() throws PageException
/* Displays Form for new user creation by default */
this.setJspName("P_SAP_B_UserCreationForm.jsp");
/* In case of an error display an error message page */
if(iErrFlag!=0)
setJspName("ErrorPage.jsp");
} //end of if
/* Displays the user's information as entered in the SQL
database after its been uploaded by the user */
else if(iFlag==1)
setJspName("hello.jsp");
} // end of else if
} // end of doProcessBeforeOutput()
} // end of P_SAP_B_UserDynPage Class
} // end of P_SAP_B_User class
* End of File P_SAP_B_User.java
2) Bean
package com.sap.usercreation;
import java.io.Serializable;
public class P_SAP_B_CreateUser implements Serializable
private String sFname;
private String sLname;
private String sUnit;
private String sSkill;
private String sExp;
private String sAge;
private String errMessage;
* @return
public String getSFname() {
return sFname;
* @return
public String getSLname() {
return sLname;
* @param i
* @param string
public void setSFname(String string) {
sFname = string;
* @param string
public void setSLname(String string) {
sLname = string;
* @return
public String getSUnit() {
return sUnit;
* @param string
public void setSUnit(String string) {
sUnit = string;
* @return
public String getSSkill() {
return sSkill;
public void setSSkill(String string) {
sSkill = string;
* @return
public String getSAge() {
return sAge;
* @return
public String getSExp() {
return sExp;
* @param string
public void setSAge(String string) {
sAge = string;
* @param string
public void setSExp(String string) {
sExp = string;
* @return
public String getErrMessage() {
return errMessage;
* @param string
public void setErrMessage(String string) {
errMessage = string;
3) The Jsp file i have already posted.
See if you copy this code and paste it wont work as i have not given you full code ,But yes this gives you an overview of how things can be done .
Thanx
Pankaj -
Formula for comparing dates and display data
I have 3 objects on my query: Date, Product name and Quantity sold
I have a table on my reports showing the top 3 products by quantity sold, and I want to add the quantity sold today on the same table.
I am looking for a formula that compares de dates provided by the query with current date and only displays on the cell the quantity for the current day.
Any ideas are welcome!As per my understanding, you want to display the today's sale of the product while the ranking is aaplied on the total quantity
sold.
You can create a new variable with either of the following two definitions:
Today's Date = CurrentDate()
Today's Sale = Sum([Quantity Sold]) where ([Date]=[Today's Date])
or
Today's Sale = If(([Date]=[Today's Date]) Then Sum([Quantity Sold])
Note: The two date formats should be same.
For getting the top three products you can use the hidden column(font, border and background white) and apply the ranking on
the total sale coming from the DB.
Regards,
Rohit -
Regarding : Material document data and PO data do not match (Plant)
Hi Gurus,
Please go through this BAPI program.
While uploading it is giving an error ' Material document data and PO data do not match (Plant) '.
Please help regarding this issue.For all Other moment types it is working fine except this 351 moment type.
dATA: i_excel TYPE truxs_t_text_data. "work table for excel upload
DATA: BEGIN OF it_itab OCCURS 100,
docdate(10),
postdate(10),
mvt_type(3), "Movement Type
plant(4), "Plant
lgort(4),
pur_doc(10), "Purchase Document No
po_item(3), "Purchase Document Item No
material(18), "Material Number
delnote(16),
erfmg(13),
uom(3),
lfmng(13), "Quantity
batch(10) TYPE c,
vfdat TYPE vfdat,
END OF it_itab.
DATA: it_goodsmvt_head TYPE TABLE OF bapi2017_gm_head_01 INITIAL SIZE 100,
it_goodsmvt_code TYPE TABLE OF bapi2017_gm_code INITIAL SIZE 100,
it_goodsmvt_item TYPE TABLE OF bapi2017_gm_item_create INITIAL SIZE 100.
DATA: wa_goodsmvt_head LIKE LINE OF it_goodsmvt_head,
wa_goodsmvt_code LIKE LINE OF it_goodsmvt_code,
wa_goodsmvt_item LIKE LINE OF it_goodsmvt_item.
DATA: w_mat_doc TYPE bapi2017_gm_head_ret-mat_doc,
w_year TYPE bapi2017_gm_head_ret-doc_year.
DATA: BEGIN OF it_errmsg_goodsmvt OCCURS 10.
INCLUDE STRUCTURE bapiret2.
DATA: END OF it_errmsg_goodsmvt.
DATA : obj_type LIKE bapiache09-obj_type,
obj_key LIKE bapiache09-obj_key,
obj_sys LIKE bapiache09-obj_sys.
DATA: v_date1 TYPE sy-datum.
DATA: v_date2 TYPE sy-datum.
DATA: w_lines TYPE i.
DATA: errflag.
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-100.
PARAMETERS: p_file TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK bk1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
Start-of-selection processing
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_line_header = 'X'
i_tab_raw_data = i_excel
i_filename = p_file
TABLES
i_tab_converted_data = it_itab[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT it_itab.
REFRESH it_goodsmvt_head.
REFRESH it_goodsmvt_item.
CONCATENATE it_itab-docdate6(4) it_itab-docdate3(2) it_itab-docdate+0(2) INTO v_date1.
CONCATENATE it_itab-postdate6(4) it_itab-postdate3(2) it_itab-postdate+0(2) INTO v_date2.
wa_goodsmvt_head-pstng_date = v_date2.
wa_goodsmvt_head-doc_date = v_date1.
wa_goodsmvt_head-ref_doc_no = it_itab-delnote.
wa_goodsmvt_head-pr_uname = sy-uname.
APPEND wa_goodsmvt_head TO it_goodsmvt_head.
Maintain it_goodsmvt_code
wa_goodsmvt_code-gm_code = '04'.
Maintain it_goodsmvt_item
*LOOP AT it_itab.
IF wa_goodsmvt_item-po_number IS INITIAL.
wa_goodsmvt_item-po_number = it_itab-pur_doc.
wa_goodsmvt_item-move_type = it_itab-mvt_type.
wa_goodsmvt_item-MOVE_PLANT = it_itab-plant.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = it_itab-material
IMPORTING
output = it_itab-material.
wa_goodsmvt_item-material = it_itab-material.
wa_goodsmvt_item-stge_loc = it_itab-lgort.
wa_goodsmvt_item-po_item = it_itab-po_item.
wa_goodsmvt_item-entry_qnt = it_itab-erfmg.
wa_goodsmvt_item-ENTRY_UOM_ISO = it_itab-uom.
wa_goodsmvt_item-po_pr_qnt = it_itab-lfmng.
wa_goodsmvt_item-batch = it_itab-batch.
wa_goodsmvt_item-expirydate = it_itab-vfdat.
wa_goodsmvt_item-NO_MORE_GR = 'X'.
wa_goodsmvt_item-mvt_ind = 'B'.
APPEND wa_goodsmvt_item TO it_goodsmvt_item.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_goodsmvt_head
goodsmvt_code = wa_goodsmvt_code
IMPORTING
materialdocument = w_mat_doc
TABLES
goodsmvt_item = it_goodsmvt_item
return = it_errmsg_goodsmvt.
Process of commit work
IF it_goodsmvt_head[] IS NOT INITIAL.
DESCRIBE TABLE it_goodsmvt_head LINES w_lines.
ENDIF.
IF it_goodsmvt_item[] IS NOT INITIAL.
DESCRIBE TABLE it_goodsmvt_item LINES w_lines.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
IMPORTING
RETURN =
CLEAR errflag.
READ TABLE it_errmsg_goodsmvt INDEX 1.
IF it_errmsg_goodsmvt-type EQ 'E'.
WRITE:/'Error in function', it_errmsg_goodsmvt-message.
errflag = 'X'.
ELSE.
WRITE:/ it_errmsg_goodsmvt-message.
ENDIF.
IF errflag IS INITIAL.
COMMIT WORK AND WAIT.
IF sy-subrc NE 0.
WRITE:/ 'Error in updating'.
EXIT.
ELSE.
WRITE:/ 'Material Document created successfully and the Document Number for the Material',
wa_goodsmvt_item-material,'is:', w_mat_doc, w_year.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.Hey,
Just wanted to post that in my case this was the error of MVT_IND field in item table. When I made it from 'B' to blank then it worked.
Mine is solved....
Thanks -
Regarding Goods issue date and order date.
Hi All,
Could you please tell me from where we can fetch Goods issue date and Order date.
Waiting for your reply.Preeti,
Goods issue date/order date of what ?
Goods can be issued in a number of ways, in reference to many types of documents. In each case, the GI date and order date are found in different places.
Please elaborate your request.
Best Regards,
DB49 -
Extract Archival data and display in report
Hi All,
I prepared a report to display the details of GL accounts with vendor details.
i need to extract archived documents also and display in my report.
Kindly let me know how to extract the archived FI documents.
Regards,
SaravanaHi..this is really habit of doing R and D.
Generally, we do archive the fi documents using the archiving object FI_DOCUMNT in the transaction SARE which archives all the tables related to FI application area.
Also, we do generally view the archived fi documents in the transaction SARE ..just you need to pass the object name as FI_DOCUMNT and the info structures if active.
We do also have the read program to extract the all the archive fi documents...please check this program: RFBELJ00
you can develop your own program as per the above standard one. But do you think, it is neccessary???
Please let me know if you need any inputs from me..!
Please rewards points if sounds helpful/useful.
Regards,
Shamim -
How to filter datas and display in java
Hi guys.
I'm kind of new to Java,
I've have a database where values are stored ,i just have to take one column and i got to filter one value and display all .
is there a command to filter
I just want to do that if that Not wanted value is there to ignore and display the rest of the data in the html when search is called.
i have to do this in the java , not in jsp.
mysql,hibernate,ejb,jsp are being used at my environment.
please helpSimply put you want to 'selectively' navigate through the collection of data. Here, is an alternative using Iterator pattern given below;
Create an interface
* Iterator interface has method declarations for iterating through
* data.
public interface Iterator {
public MyData next(int current);
public MyData prev(int current);
}// End of interfaceNow, create implementation classes for the above interface and you can aptly name them based upon your filtering criteria
public MyFlter implements Iterator {
* next � method which takes the current data number
* and returns the next selected data.
public MyData next (int current) {
MyData data = null;
while desired data not found: iterate --> implement your selection criteria here
return data
} Similarly implement the previous method.
Hope that helps. -
Want to Read BLOB data and display on Oracle form
Hi All,
I have a table with a BLOB field and there is blob data saved here against a account id.
I want to display the blob data on the oracle forms front end for the queried account id
Any one to help me out how to read and display blob data in Oracle and display the same
Tksthis is a commoon request please try to search the forum.
-
How would you read in each line of data and display them to message box?
How would you read in each line of data from the _.txt file_ and display the whole data using an information-type message box?
I know how to display each line of the .txt file data, but I do not know how to display the whole thing.
Here is how I did to display each line of data using the message box:
import javax.swing.JOptionPane; // Needed for the JOptionPane class
import java.io.*; // Needed for file classes
public class problem3
public static void main(String[] args) throws IOException
String filename; // Needed to read the file
String categories; // Needed to read the categories
// Get the filename.
filename = JOptionPane.showInputDialog("Enter the filname.");
// Open the file.
FileReader freader = new FileReader(filename);
BufferedReader inputFile = new BufferedReader(freader);
// Read the categories from the file.
categories = inputFile.readLine();
// If a category was read, display it and
// read the remainig categories.
while(categories != null)
// Display the last category read.
JOptionPane.showMessageDialog(categories);
// Read the next category.
categories = inputFile.readLine();
// Close the file.
inputFile.close();
}I think I need to change here:
// If a category was read, display it and
// read the remainig categories.
while(categories != null)
// Display the last category read.
JOptionPane.showMessageDialog(categories);
// Read the next category.
categories = inputFile.readLine();
}but I don't know how to.
Could you please help me?
Thank you.kyorochan wrote:
jverd wrote:
What is not understood about your question is which part of "read a bunch of lines and display them in a textbox" do you not understand.
First thing's first though: You do recognize that "read a bunch of lines and display them in a textbox" has a few distinct and completely independent parts, right?I'm sorry. I'm not good at English, so I do not understand what you said...
What I was trying to say is "How to display the whole lines of .txt file in single dialog box."We know that.
Do you understand that any problem can be broken down into smaller pieces?
Do you understand that your problem has the following pieces?
1. Read lines from the file.
2. Put the lines together into one String.
3. Put the String into the message box.
and maybe
4. Make sure the message box contents are split into lines exactly as the file was.
(You didn't make it clear if that last one is a requirement.)
Do you understand that 1-4 are completely independent problems and can be solved separately from each other?
Do you understand that you have stated that you already know how to do 1 and 3?
Therefore, you are NOT asking "How to display the whole lines of .txt file in single dialog box." Rather, you ARE asking either #2 or #4 or both.
If you say once more "display all the lines of the file in one dialog box," then it is clear that we are unable to communicate with you and we cannot help you. -
Add text item data and display the output in another text item
Hi! All,
I have four text item. like HA,DA,basic_salary and total_sal.I want to add the data entered in the text item in HA,DA,basic_salary and display in total_sal text item.How can I do this.Please help in this matter.
Thanks,
Abha1.Select the text item TOTAL_SAL
2.Open property palette
3.Under Calculation node
Set calculation mode as Formula
Set Formula as nvl(:ha,0)+nvl(:da,0)+nvl(:basic_salary,0) -
Regarding the Master Data and the MRP maintained.
Hi,
i have one query,my client has 4 plant,for manufacturing a product there are 10 operation.The 4 operation is taking on Plant A.The 5th and 5th operation is is in Plant B.The 7th operation is at Sub-contractor to vendor and return back to Plant A,and the remining operation is at Plant A.
So what are the Master Data and MRP we have mainted for that?
Please revert back.
Thanks,
MohitDear,
Sub-contracting is carried out for 2 types-
1) Operation SubContracting & 2) Material SubContracting
You need to activate SubCon key (30) in MRP2 for the material which you want to send.
When you run MRP, it will check the system, if you have the stock as per requirement in the system. If the adequate stock is unavailable it will create PR, which you will need to convert in SubCon Purchase Order.
Operation SubContracting
You have to activate External Processing
"X" (T Code OPJ8) in PP01 Control key for that operation which u want to do externally
In the routing for the externally processed operation enter the control key as PP02
In the operation details screen in the External Processing tab enable the check box subcontracting
Enter thr info rec no and other details and save.
Thru ME58 Convert purchase requisition to purchase order Thru ME2O Send the material to subcontractor. .Migo receive the material from subcontractor (check theMovement type-541)
Hope it will help you.
Regards,
R.Brahmankar -
Getting file data and displaying it in a dynamic text box
The purpose of this function is to load and display a
specific menu for a restaurant (lunch, dinner, dessert, etc.)
This script is located inside of a movie clip that has the
text box and buttons.
There are 4 buttons that have event listeners that go to a
function that determines which button was pushed, and then sends a
call to loadMenu with a string that has the filename.txt.
In frame 1 of the movie clip, the variables used in the code
are declared as such:
var newMenuRequest:URLRequest = new URLRequest();
var newMenuLoad:URLLoader = new URLLoader();
var loadThisMenu:String = ""; //This is the variable the
buttonclick function alters and sets as the string to send to the
loadMenu.
My error is 1195: attempted access of inaccessible method url
with static type flash.net:URLRequest
Any ideas?quote:
Originally posted by:
GWD
newMenuRequest is an instance of a URLRequest.... and it
doesn't have a url method.
It has a url property.
I would be inclined to create a new URLRequest each time. But
perhaps that's not necessary.
Try changing
newMenuRequest.url(menuName);
to:
newMenuRequest.url=menuName;
see if that works.
Yeah I realize it's a little inefficient.
THANK YOU SO MUCH FOR THE SUGGESTION. works perfectly.
Maybe you are looking for
-
CP 6.0.1.240 - Video Demo Project vs. Video Recording & YouTube
Hello, I have a project with two small slide videos included. I recorded them using Record New Video Demo and I embedded them on 2 different slides using Video > Insert Video. Once embedded I added text captions etc and timed them to coincide with
-
I just downloaded the newest version of Firebox and I don't like the tabs feature. Every time I click on a link within a web page or do anything else that takes me to a different web page, please open a new window.
-
Magic Trackpad recognized as mouse in 10.9
I have a Magic Trackpad that, when I attempt to pair it with my 2013 MacBook Air, connects as a mouse. As in, it works as a traditional trackpad-no multitouch whatsoever. I don't have any mice connected, and I open up the "mouse" preferences, and it
-
i was transferring my information from my old iphone to the new one, and i forgot that i had some pictures in the new one. i did the restoring information and the pictures in new one are gone. how can i get them back???? please
-
Update Query is Performing Full table Scan of 1 Millions Records
Hello Everyboby I have one update query , UPDATE tablea SET task_status = 12 WHERE tablea.link_id >0 AND tablea.task_status <> 0 AND tablea.event_class='eventexception' AND Exists(SELECT 1 from tablea