‎2006 Oct 09 8:46 AM
Dear all,
Using Tcode CG3Z,I have uploaded the text file into application server with BIN&ASC both format. But the problem while reading from the program values are coming in ASC format.
"OPEN DATASET ds_name FOR INPUT IN BINARY MODE."
Can on help me on this?
Thanks in advance.
Regards,
‎2006 Oct 09 8:56 AM
hi,
chk this sa,ple code.
CG3Z - Upload a empty file to a application server from presentation server.it create a file in application server.
parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.
rgds
anver
‎2006 Oct 09 8:57 AM
Hi,
Then use the following code to read the file from application server.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
LOGICAL_FILENAME = P_INFILE
IMPORTING
FILE_NAME = INPUTFILE
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE E899 WITH text-064 P_INFILE text-065.
ENDIF.
Open the inputfile for reading in text mode
OPEN DATASET INPUTFILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE E899 WITH text-066 INPUTFILE text-067.
ENDIF.
DO.
READ DATASET INPUTFILE INTO TEXT2 . "LENGTH LENG.
MOVE TEXT2 TO I_MATCONV.
APPEND I_MATCONV.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET INPUTFILE.
also, look at this one http://www.sap-img.com/ab004.htm
Regards
Sudheer
‎2006 Oct 09 9:07 AM
hi
good
did you debug your program properly, i dont think there should not be any prob if your data is correct. Go through this link, i hope this ll give you some better idea about the OPEN DATASET STATEMENT
http://www.sapfans.com/sapfans/alex.htm
thanks
mrutyun^
‎2006 Oct 09 9:34 AM
Thanks to all for reply.
If it is 'Z' program we can do. I'm using SAP Std program "rvafss00" Billing Interface program.
I did debug and i checked the data after read from the file values are coming in ASC .
Regards,