2007 Feb 17 9:21 AM
Hi All,
I have a problem with writing the data into the file.
Please look at my code once.
p_file = '/sapuser/interface/inwork/cust_credit_exposure.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT li_output INTO wa_output.
TRANSFER wa_output TO p_file.
ENDLOOP.
CLOSE DATASET p_file.
I got short dump at the line 'TRANSFER wa_output TO p_file'.
My output table has the following fields:
1)cust no
2)Amt1(CURR 19,2)
3)Amt2(CURR 19,2)
4)Currency
5) date/time
In the error analysis i got this :
The system tried to access the file
"/sapuser/interface/inwork/cust_credit_exposure.txt" but found that this file
was not opened. For this reason, it could not access the file.
Please help me in this.
Thanks
Suresh
Hi All,
I have a problem with writing the data into the file.
Please look at my code once.
p_file = '/sapuser/interface/inwork/cust_credit_exposure.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT li_output INTO wa_output.
TRANSFER wa_output TO p_file.
ENDLOOP.
CLOSE DATASET p_file.
I got short dump at the line 'TRANSFER wa_output TO p_file'.
My output table has the following fields:
1)cust no
2)Amt1(CURR 19,2)
3)Amt2(CURR 19,2)
4)Currency
5) date/time
In the error analysis i got this :
The system tried to access the file
"/sapuser/interface/inwork/cust_credit_exposure.txt" but found that this file
was not opened. For this reason, it could not access the file.
Please help me in this.
Thanks
Suresh
2007 Feb 17 9:28 AM
hi,
chk the ITAB is initial or not.
chk this sample code
report zfile_write.
Parameters: d2 type localfile default '/usr/sap/TST/SYS/Data1.txt'.
data: itab type table of string.
data: wa type string.
start-of-selection.
* suppose itab has all the values.
if itab[] is not initial. "chk this
* Copy to file
open dataset d2 for output in text mode.
loop at itab into wa.
transfer wa to d2.
endloop.
close dataset d2.
endif.Regards,
Anver
2007 Feb 17 11:44 AM
Hi Malineedi,
this one is easy:
The fields Amt1 and Amt2 are no text fields. If you open in text mode, only charcter fields can be transferred.
Amount fields in ABAP ara binary coded decimals. Starting with unicode compliance of ABAP, the system determines how many bytes are used for a character. The system does not know how to handle amount fields as text.
The solution for you depends on the use of the output file: No problem if you use BINARY mode but this might be a problem to read the amounts because BCD (binary coded decimal) amounts pack 2 decimals into 1 byte.
Otherwise you have to convert the amounts to character fields using WRITE TO an target field of sufficient size. But then you have the problem of user-dependent settings for thousands and decimals separator. (i.e. 100,000.52 or 100.000,52).
Roll up the process from the end: What do you expect to be in the file. Then find out how to create it.
Regards,
Clemens
2007 Feb 19 6:03 AM
Hi Clemens ,
Thanks for your reply. The issue is solved by taking the BINARY mode. But while writing the data to the file, the amount filed is written as
'#######' . Please help me to solve this issue. Below is the output given for ur reference.
Cust_no Amt1 Amt2 Curr Date / Time
0010034544 ########` ########### USD 20070218/214646
Thanks & Regards
Suresh
2007 Feb 19 6:12 AM
Hi,
Change the below line and check if it works:
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE<b>. "ENCODING DEFAULT.</b>
Thanks
2007 Feb 19 6:22 AM
Hi
OPEN DATASET physical_file FOR OUTPUT IN TEXT MODE.
use this to open the data sets.
Regards,
kumar
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |