How to add new line to the file?
Hello,
I will like to print 2 line of string in the following format to the
file:- file.txt
String1
String2
How to print a new line after String1 so that String2 can be written after String1?
- Eugene -
Do you mean...
PrintWriter pw=new PrintWriter(new FileOutputStream("file"));
pw.println(string1);
pw.println(string2);
pw.close();
the println puts a new line after string1.
Similar Messages
-
Add new line in the Flat file based on the field value
Hi,
Following is my Flat File -
Customer X Y
1001 1 2
1002 0 1
Based on the X and Y value I need to add new lines in the Flat file. If X>0 then add a new line with repeating row and Y>0 add again a new line with repeating row. If X or Y=0 then no need to add any repeating new line.
So, here for the above example I need output as-
Customer X Y
1001 1 2
1001 1 2
1001 1 2
1002 0 1
1002 0 1
Suggest how we can achieve this?
Regards,
Tridib KonwarHi Tridib,
I tried your scenario and You will have to use the custom xslt to get the expected result.
Please find bellow the xslt code which you can use in your map.
<?xml version="1.0" encoding="utf-16" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0" xmlns:ns0="http://PracticeAtul.XYFlatFileSchema">
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/ns0:XYComp" />
</xsl:template>
<xsl:template match="/ns0:XYComp">
<ns0:XYComp>
<XYComp_Child1>
<XYComp_Child1_Child1>
<xsl:value-of select="XYComp_Child1/XYComp_Child1_Child1/text()" />
</XYComp_Child1_Child1>
<XYComp_Child1_Child2>
<xsl:value-of select="XYComp_Child1/XYComp_Child1_Child2/text()" />
</XYComp_Child1_Child2>
<XYComp_Child1_Child3>
<xsl:value-of select="XYComp_Child1/XYComp_Child1_Child3/text()" />
</XYComp_Child1_Child3>
<xsl:value-of select="XYComp_Child1/text()" />
</XYComp_Child1>
<xsl:for-each select="XYComp_Child2">
<XYComp_Child2>
<XYComp_Child2_Child1>
<xsl:value-of select="XYComp_Child2_Child1/text()" />
</XYComp_Child2_Child1>
<XYComp_Child2_Child2>
<xsl:value-of select="XYComp_Child2_Child2/text()" />
</XYComp_Child2_Child2>
<XYComp_Child2_Child3>
<xsl:value-of select="XYComp_Child2_Child3/text()" />
</XYComp_Child2_Child3>
</XYComp_Child2>
<xsl:if test="XYComp_Child2_Child2/text()!=0">
<XYComp_Child2>
<XYComp_Child2_Child1>
<xsl:value-of select="XYComp_Child2_Child1/text()" />
</XYComp_Child2_Child1>
<XYComp_Child2_Child2>
<xsl:value-of select="XYComp_Child2_Child2/text()" />
</XYComp_Child2_Child2>
<XYComp_Child2_Child3>
<xsl:value-of select="XYComp_Child2_Child3/text()" />
</XYComp_Child2_Child3>
</XYComp_Child2>
</xsl:if>
<xsl:if test="XYComp_Child2_Child3/text()!=0">
<XYComp_Child2>
<XYComp_Child2_Child1>
<xsl:value-of select="XYComp_Child2_Child1/text()" />
</XYComp_Child2_Child1>
<XYComp_Child2_Child2>
<xsl:value-of select="XYComp_Child2_Child2/text()" />
</XYComp_Child2_Child2>
<XYComp_Child2_Child3>
<xsl:value-of select="XYComp_Child2_Child3/text()" />
</XYComp_Child2_Child3>
</XYComp_Child2>
</xsl:if>
</xsl:for-each>
</ns0:XYComp>
</xsl:template>
</xsl:stylesheet>
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.
Atul Toke -
How to add new fields to the DME file in F110
Hi,
We have a requirement add new fields to the file that is used in F110.
.I did go in to DMEE transaction but I hae no idea how to add new fileds to the existing file.
Can anybody please help me in resolving the issue.
Thanks
Venkat
Edited by: Venkat R on Jun 8, 2009 8:45 AMHi,
There is no function module for that, We have created our own function module and attached to that field.
Refer the below code. This will fetch the document number.
DATA: lwa_item TYPE dmee_paym_if_type,
l_fpayp TYPE fpayp,
l_fpayhx TYPE fpayhx,
first_flag TYPE c,
lv_lifnr TYPE lifnr,
voucher_id TYPE string,
voucher TYPE string,
invoice_id TYPE belnr_d,
voucher_len1 TYPE i,
voucher_len TYPE i.
TYPES:
BEGIN OF lt_regup,
xblnr TYPE xblnr1,
belnr TYPE belnr_d,
END OF lt_regup.
DATA: lt_regup TYPE STANDARD TABLE OF regup,
lv_regup TYPE regup.
Hope this helps.
Raja.A
Edited by: Raja.A on Feb 16, 2011 7:17 PM -
How to write new line on resource file.
Hello Everyone,
Can you please help me add new row on resource file, here is the code i have used to read my resource file.
I have no idea on how to add new line... Please help
private void btnBrowse1_Click(object sender, EventArgs e)
BrowseFile();
//versionIncrement();
if (txtInputfile.Text.Length > 0)
PathSelection = txtInputfile.Text;
oDataSet = new DataSet();
//now am reading the files fro the path that is selected
XmlReadMode omode = oDataSet.ReadXml(PathSelection);
for (int i = 0; i < oDataSet.Tables[2].Rows.Count; i++)
string comment = oDataSet.Tables["data"].Rows[i][2].ToString();
//the elements array contain all the columns filled
string[] elements = comment.Split('-'); //when it reaches the comma, it will jump to the next line
string font = elements[0]; //Font
string datestamp = elements[1]; //DateStamp
string commentVal = elements[2]; //Comment
string[] row = new string[] { oDataSet.Tables["data"].Rows[i][0].ToString(), oDataSet.Tables["data"].Rows[i][1].ToString(), font, datestamp = DateTime.Now.ToString(), commentVal };
Gridview_Input.Rows.Add(row);Hello
Sitholimela,
>> Can you please help me add new row on resource file, here is the code i have used to read my resource file.
From your description, it seems that your resource file is a XML format file, if so, you could also have a try to use
LINQ To XML which is easy to operate the XML file to add new row to your resource file, and here is an example to show how to add a new element/row to the specific tree:
Linq to XML Add element to specific sub tree
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to add new line in message on my S890
My stock keyboard in Lenovo S890 doesn't have enter key, is this normal ? How to add new line ?
However this happened only in messages, while using whatsapp the enter key present.Hi,
the fact that your question is posted in Order Management section, does the move order automatically generated by OM?
nevertheless, i don't think you should (or allowed, in this case) to add a new line in transact move order. Transact move order only queries (not create records) the move order lines eligible to allocate and transact.
So, I don't see why you need to add a new line in transact move order.
You can, however, add a new line in the allocation of the lines, where for instance, you need to have half of the line allocated to one locator, and the other half to another locator
Thanks -
How to add new fields to the system form (Ex.expenses to a/r invoice form)
hi
can any one tell me how to add new fields to the system form (Ex.expenses to a/r invoice form)
i want to add expenses field to system a/r invoice form and connect data base also.
i used the code of samples\11.system form manipulation(vb.net) but i'm not able to get it....so can any one help with code or concepts.
reply soon plz..
thankQIf I understood you correctly, you are just trying to add new fields to the invoice form and then use them in your form. you should first go and add the field to your tables, which you would do by going to Tool --> User Defined Fields --> Manage User Fields. There are different documents or categories given. For ex. for invoices, Sales Orders you would add your field under the Marketing Documents. If you want the field to be just one per invoice, add it to the Title, otherwise if you want a field per invoice or Sales Order line, add it to the Rows section. Once you have done that then you can just create a edit box or drop down to represent the field and set the datasource for that to your field. If you want example code to do that, let me know.
-
How to add new line item using BAPI BAPI_CONTRACT_CHANGE for contract-ME32K
HI Experts,
how to add new line item using BAPI: BAPI_CONTRACT_CHANGE for existing contract.
Requirement:
Already the contract having two line items using ME31K.
Custom program has to add new line items in existing contract.
Thanks,
SendilI got the solution:
We can do like this:
1. Get all details using details, BAPI_CONTRACT_GETDETAIL.
2. After getting results, append new line item. Then use your BAPI.
Check this posting program.. where this bapi is used, use the same coding technique.
IDOC_INPUT_PURCONTRACT_CHANGE -
hai Friends , i've some problems, i really don't know how to add new line when typing
ThanksSorry you feel that way. It is still a new platform and is improving with every update. Hopefully the next update will make things better for you then.
If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
If your issue is resolved, don't forget to click the Solution button on the resolution! -
How to write new line to a File?
How to write new line to a file?
I have a string to be written to a file. the string contains "\n" in it. But why it is not showing the new line in the file.
I have tryed FileWriter class and FileOutputStream class, but none of them works?
any suggestion please...Probably using PrintStream::println() is a portable way.
import java.io.FileOutputStream;
import java.io.PrintStream;
public class NewLine {
public static void main(String[] args) {
try {
PrintStream ps = new PrintStream(new FileOutputStream("foo.txt"));
ps.write("string".getBytes());
ps.println();
ps.close();
} catch (java.io.IOException e) {
e.printStackTrace();
}Regards, -
CRM IC Winclient - How to add new fields in the BP Search of TRX CIC0
Hello Experts,
I want to know how to add new fields in the BP Search of TRX CIC0. In the HTML that we're using here I need to add the URL of the BP.
Can you help me?
Thanks in advance.
Caíque EscalerHi
make append to tables in se11 - CCMBP1FIELDS, CCMBP2FIELDS
in spro in Define customer-specific search control -> mark fields with X.
and enhance html template CRM_CIC_SEARCH_DISPLAY. -> tcode smw0, look for package CRM_CIC_COMPONENTS for html CRM_CIC_SEARCH_DISPLAY. export it from SAP, edit, and import.
you will need to enhance function module used for searching - you will find him in spro in Search Strategies.
Regards
Radek -
How to add new fields in the EBP front end..
Hi All,
Can any one let me know the process of how to add new fileds in the shopping cart creation screens by using the "Tag Browser" option in the Object navigator.
Best Regards,
Mahesh. JHi
<b>Please go through the following links for more details and examples -></b>
http://help.sap.com/saphelp_47x200/helpdata/en/a2/8c6eeb2d8911d596a000a0c94260a5/frameset.htm
http://help.sap.com/saphelp_47x200/helpdata/en/d3/5ecbe22a8a11d5991f00508b6b8b11/frameset.htm
This will definitely help.
<u>For adding customer fields to the Shopping cart, you need to refer SAP OSS Bote 672960 and 485891.</u>
Do let me know, incase you need any other details.
Regards
- Atul -
How to add new line in transact move order line
Hi,
i am able to update locaotr in Transact move order.
But i want to add two locators for the same line.
I tried to insert one more record in data base, but getting error unique index error.
so how can we add new line in transact move order line .
please help to slove this isse.
Thanks In Advance
Venu.Hi,
the fact that your question is posted in Order Management section, does the move order automatically generated by OM?
nevertheless, i don't think you should (or allowed, in this case) to add a new line in transact move order. Transact move order only queries (not create records) the move order lines eligible to allocate and transact.
So, I don't see why you need to add a new line in transact move order.
You can, however, add a new line in the allocation of the lines, where for instance, you need to have half of the line allocated to one locator, and the other half to another locator
Thanks -
How to insert new line in the copied schema with transaction code PE01?
Dear Experts,
I have copied HKT0 to ZKT0 , i want to insert new line between line 150 and line 160 in ZKT0, I don't know how to insert new line 160, who can tell me ?
Looking forward to your reply.
Best Regards,
MerryHi,
1. Open your schema,
2. In first colume "Line" select line where you want to add new line,
3. Replace first value in the column field (that indicates number of line) with character I (means insert),
4. Press enter
The line will be added. The same way you can add lines to PCR.
To delete use character D.
Cheers -
How to add new line item to PO using BAPI_PO_CREATE1
Hi,
I have a purchase order with 2 line items, now i want to add new line item to the same PO using BAPI_PO_CREATE1.
Here new line item should be created with reference PR line item.But this PR line item is Dynamic it get generated once the Sales order line item get changed.
Please let me know how can i pass the PR doc no, PR line item no as reference to create the new PO line item.
Thanks
BhuvanaHi,
I think you need to use BAPI: BAPI_PO_GETDETAIL, then BAPI:BAPI_PO_CHANGE.
BAPI_PO_CREATE1 equals ME21N, but adding new line item needs to be done in ME22N.
Cheers, -
How to add new line item to SO using BAPI_SALESORDER_CREATEFROMDAT2
Hi,
I have sales order A with 1 line item, now i want to add new line item with material x and quantity y to the existing sales order A
using BAPI_SALESORDER_CREATEFROMDAT2.
Line item no for new line item should be generated by SAP internally.Please let me know the mandatory parameters to be passed to the BAPI to fulfill the requirement.
DATA: order_header TYPE bapisdhd1,
order_inx TYPE bapisdhd1x,
partners TYPE TABLE OF bapiparnr,
wa_partners TYPE bapiparnr.
CLEAR: salesdocument,order_header_inx,wa_in, wa_inx.
REFRESH: item_in, item_inx.
salesdocument = wa_vbup-vbeln.
order_header_inx-updateflag = 'X'.
wa_in-itm_number = ' '.
wa_in-material = p_nmatnr.
wa_in-target_qty = gv_menge - gv_wemng.
APPEND wa_in TO item_in.
wa_inx-itm_number = ' '.
wa_inx-updateflag = 'U'.
wa_inx-target_qty = 'X'.
APPEND wa_inx TO item_inx.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
salesdocumentin = salesdocument
order_header_in = order_header
order_header_inx = order_inx
IMPORTING
salesdocument = salesdocument
TABLES
return = return
order_items_in = item_in
order_items_inx = item_inx
order_partners = partners.
Thanks
BhuvanaHello,
You can use FM: BAPI_SALESORDER_CHANGE with update indicator I (insert)
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = l_vbeln
order_header_inx = l_wa_order_header_inx
simulation = l_simulation
tables
return = l_i_return
order_item_in = l_i_order_item
order_item_inx = l_i_order_item_inx
partners = l_i_partners
schedule_lines = l_i_schedule_lines
schedule_linesx = l_i_schedule_linesx
extensionin = l_i_extensionin.
Thanks
Subhankar
Maybe you are looking for
-
Can I import movie clips to imovie from iphoto?
I am having difficulty importing Iphoto video into the imovie. Any suggestions?
-
Hello gurus, I have done generic extraction on table OSMON, the feild which i have included in are, SERVER(Server name) 1,ADATE(Date of analysis) 2,CPUMAX(Max. CPU usage for 1 day
-
PSE 11 Runtime Error R6034 "An application has made an attempt to load the C runtime library incorrectly." I just start getting this message when starting up Win 7 Ultimate 64 bit laptop! In researching the error I found it to be caused by PSE 11.
-
What's the difference in the user experience of ion3, wmii and dwm.
I want to try something new, especially some new concepts, not just another wm, nor I actually 'need' something - in the moment xfce just works for me. Of course, I have thoroughly read the (available) documentation of these WMs and tested a session
-
How to minimize the gap between two regions in a page
Hi All, How to minimize two regions in a page ? I have two regions in page but I need to minimize the (default) space gap between these regions as it looks too large. Thanks for the answer. Jeffry