on 05-15-2006 9:42 AM
hai,
please rectify this, how to create a file in application server ?
can any one forward a sample code for creating a file in application server.
hazam
Refer this thread
http://www.sapdevelopment.co.uk/file/file_updownpop.htm
http://www.sapdevelopment.co.uk/file/file_downloadsap.htm
Reward points and close the thread if ur problem got solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi hazam,
You can use these statements
OPEN DATASET
TRANSFER
CLOSE DATASET
or you can refer to this link
http://www.kabai.com/abaps/z33.htm
Regards
Sumit Bhutani
Ps reward points if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hii
Use
<b>CG3Y and CG3Z transaction
USe AL11 to view file</b>
Reading and Writing a text file from and to the application server
sy-subrc = 0 Record read from file
sy-subrc = 4 End of file reached
data: w_dataset1(27) value '/var/textfile.txt',
w_dataset2(27) value '/var/outfile.txt'.
data:begin of itab1 occurs 0, "Text file format
matnr(18), "MATERIAL NUMBER
bwkrs(4), "PLANT
end of itab1.
*Uploading of text file from Application server.
<b>open dataset w_dataset1 for input in text mode.</b>
do.
if sy-subrc <> 0.
exit.
endif.
<b>read dataset w_dataset1 into itab1.</b>
append itab1.
clear itab1.
enddo.
close dataset w_dataset1.
*Downloading of text file to Application server.
<b>open dataset w_dataset2 for output in text mode.</b>
loop at itable.
<b>transfer itable to w_dataset2.</b>
endloop.
<b>close dataset w_dataset2.</b>
hope this helps
Thanks&Regards
Naresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hazam,
Please check the below code.
Data : P_UFILE(60) " Unix File name
TYPE C
value '/emn_R3/hr/ben_age25_dep'.
CLEAR GD_SUBRC.
<b>OPEN DATASET</b> GD_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC <> 0.
GD_SUBRC = SY-SUBRC.
gs_error-pernr = gs_0021-pernr.
gs_error-ename = gd_ename.
gs_error-mess
= 'Can not open File:'(017) + gd_file.
append gs_error to gt_error.
clear gs_error.
* CLEAR GD_MSG1.
* CONCATENATE 'Can not open File:'(017)
* GD_FILE
* INTO GD_MSG1.
* WRITE : / GD_MSG1.
ELSE.
LOOP AT GT_BODY INTO GS_BODY.
<b>TRANSFER</b> GS_BODY TO GD_FILE.
ENDLOOP.
<b>CLOSE DATASET</b> GD_FILE.
ENDIF.
Hope this will help you.
Thanks&Regards,
Siri.
Message was edited by: Srilatha T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can create an Application server file by using
<b>Open dataset <filename> for output </b>
Thanks,
Rashmi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hazam,
You can create a file on Application server using ABAP statements <b>OPEN DATASET, TRANSFER and CLOSEDATASET</b>.
The code for creating a file on application server is as follows.
*---Open Dataset
OPEN DATASET <app_server_file> FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
MESSAGE i000 WITH 'Unable to open app_server_file'.
ELSE.
LOOP AT it_record.
TRANSFER it_record TO <app_server_file>.
ENDLOOP.
ENDIF.
*---Close Dataset
CLOSE DATASET <app_server_file>.
Thanks,
Vinay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.