Open data set
hi friends
i make one file like dat.i use open data set so dat file created
so my question is that where this file is created ?
it will create on applicationserver?
bcoz its not create on my local drive.
Hi
Yes
A file will be created on Application server.
We use DATASET concept for reading, writing, transfering data from Local to Application servers.
see the sample code
ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
*& Report ZUPLOADTAB *
*& Example of Uploading tab delimited file *
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
DATA: ld_file LIKE rlgrap-filename.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 like pa0002-VORNA,
name2 like pa0002-name2,
age type i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Text version of data table
TYPES: begin of t_uploadtxt,
name1(10) type c,
name2(15) type c,
age(5) type c,
end of t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) type c.
constants: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*START-OF-SELECTION
START-OF-SELECTION.
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop.
Reward points for useful Answers
Regards
Anji
Similar Messages
-
Download using open data set and close data set
can any body please send some sample pgm using open data set and close data set .the data should get downloaded in application server
very simple pgm neededHi Arun,
See the Sample code for BDC using OPEN DATASET.
report ZSDBDCP_PRICING no standard page heading
line-size 255.
include zbdcrecx1.
*--Internal Table To hold condition records data from flat file.
Data: begin of it_pricing occurs 0,
key(4),
f1(4),
f2(4),
f3(2),
f4(18),
f5(16),
end of it_pricing.
*--Internal Table To hold condition records header .
data : begin of it_header occurs 0,
key(4),
f1(4),
f2(4),
f3(2),
end of it_header.
*--Internal Table To hold condition records details .
data : begin of it_details occurs 0,
key(4),
f4(18),
f5(16),
end of it_details.
data : v_sno(2),
v_rows type i,
v_fname(40).
start-of-selection.
refresh : it_pricing,it_header,it_details.
clear : it_pricing,it_header,it_details.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\WINDOWS\Desktop\pricing.txt'
FILETYPE = 'DAT'
TABLES
DATA_TAB = it_pricing
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
WRITE : / 'Condition Records ', P_FNAME, ' on ', SY-DATUM.
OPEN DATASET P_FNAME FOR INPUT IN TEXT MODE.
if sy-subrc ne 0.
write : / 'File could not be uploaded.. Check file name.'.
stop.
endif.
CLEAR : it_pricing[], it_pricing.
DO.
READ DATASET P_FNAME INTO V_STR.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
write v_str.
translate v_str using '#/'.
SPLIT V_STR AT ',' INTO it_pricing-key
it_pricing-F1 it_pricing-F2 it_pricing-F3
it_pricing-F4 it_pricing-F5 .
APPEND it_pricing.
CLEAR it_pricing.
ENDDO.
IF it_pricing[] IS INITIAL.
WRITE : / 'No data found to upload'.
STOP.
ENDIF.
loop at it_pricing.
At new key.
read table it_pricing index sy-tabix.
move-corresponding it_pricing to it_header.
append it_header.
clear it_header.
endat.
move-corresponding it_pricing to it_details.
append it_details.
clear it_details.
endloop.
perform open_group.
v_rows = sy-srows - 8.
loop at it_header.
perform bdc_dynpro using 'SAPMV13A' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RV13A-KSCHL'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RV13A-KSCHL'
it_header-f1.
perform bdc_dynpro using 'SAPMV13A' '1004'.
perform bdc_field using 'BDC_CURSOR'
'KONP-KBETR(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KOMG-VKORG'
it_header-f2.
perform bdc_field using 'KOMG-VTWEG'
it_header-f3.
**Table Control
v_sno = 0.
loop at it_details where key eq it_header-key.
v_sno = v_sno + 1.
clear v_fname.
CONCATENATE 'KOMG-MATNR(' V_SNO ')' INTO V_FNAME.
perform bdc_field using v_fname
it_details-f4.
clear v_fname.
CONCATENATE 'KONP-KBETR(' V_SNO ')' INTO V_FNAME.
perform bdc_field using v_fname
it_details-f5.
if v_sno eq v_rows.
v_sno = 0.
perform bdc_dynpro using 'SAPMV13A' '1004'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPMV13A' '1004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endif.
endloop.
*--Save
perform bdc_dynpro using 'SAPMV13A' '1004'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_transaction using 'VK11'.
endloop.
perform close_group.
Hope this resolves your query.
Reward all the helpful answers.
Regards -
What is open data set and close data set
what is open data set and close data set,
how to use the files in sap directories ?hi,
Open Dataset is used to read or write on to application server ... other than that i am not sure that there exists any way to do the same ... here is a short description for that
FILE HANDLING IN SAP
Introduction
Files on application server are sequential files.
Files on presentation server / workstation are local files.
A sequential file is also called a dataset.
Handling of Sequential file
Three steps are involved in sequential file handling
OPEN
PROCESS
CLOSE
Here processing of file can be READING a file or WRITING on to a file.
OPEN FILE
Before data can be processed, a file needs to be opened.
After processing file is closed.
Syntax:
OPEN DATASET <file name> FOR {OUTPUT/INPUT/APPENDING}
IN {TEXT/BINARY} MODE
This statement returns SY_SUBRC as 0 for successful opening of file or 8, if unsuccessful.
OUTPUT: Opens the file for writing. If the dataset already exists, this will place the cursor at the start of the dataset, the old contents get deleted at the end of the program or when the CLOSE DATASET is encountered.
INPUT: Opens a file for READ and places the cursor at the beginning of the file.
FOR APPENDING: Opens the file for writing and places the cursor at the end of file. If the file does not exist, it is generated.
BINARY MODE: The READ or TRANSFER will be character wise. Each time n characters are READ or transferred. The next READ or TRANSFER will start from the next character position and not on the next line.
IN TEXT MODE: The READ or TRANSFER will start at the beginning of a new line each time. If for READ, the destination is shorter than the source, it gets truncated. If destination is longer, then it is padded with spaces.
Defaults: If nothing is mentioned, then defaults are FOR INPUT and in BINARY MODE.
PROCESS FILE:
Processing a file involves READing the file or Writing on to file TRANSFER.
TRANSFER Statement
Syntax:
TRANSFER <field> TO <file name>.
<Field> can also be a field string / work area / DDIC structure.
Each transfer statement writes a statement to the dataset. In binary mode, it writes the length of the field to the dataset. In text mode, it writes one line to the dataset.
If the file is not already open, TRANSFER tries to OPEN file FOR OUTPUT (IN BINARY MODE) or using the last OPEN DATASET statement for this file.
IF FILE HANDLING, TRANSFER IS THE ONLY STATEMENT WHICH DOES NOT RETURN SY-SUBRC
READ Statement
Syntax:
READ DATASET <file name> INTO <field>.
<Field> can also be a field string / work area / DDIC structure.
Each READ will get one record from the dataset. In binary mode it reads the length of the field and in text mode it reads each line.
CLOSE FILE:
The program will close all sequential files, which are open at the end of the program. However, it is a good programming practice to explicitly close all the datasets that were opened.
Syntax:
CLOSE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the CLOSE is successful or not.
DELETE FILE:
A dataset can be deleted.
Syntax:
DELETE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the DELETE is successful or not.
Pseudo logic for processing the sequential files:
For reading:
Open dataset for input in a particular mode.
Start DO loop.
Read dataset into a field.
If READ is not successful.
Exit the loop.
Endif.
Do relevant processing for that record.
End the do loop.
Close the dataset.
For writing:
Open dataset for output / Appending in a particular mode.
Populate the field that is to be transferred.
TRANSFER the filed to a dataset.
Close the dataset.
Regards
Anver
if hlped pls mark points -
How to use open data set in SAP
Hi SAP Gurus,
Could anyone help, how to use open data set in SAP.
I need to upload a file from Application server (ZSAPUSAGEDATA) to internal table (IT_FINAL).
Thanks & Regards,
Krishnau2026Hi Krishna.
These are the steps you need to follow.
tables: specify the table.
data: begin of fs_...
end of fs_ " Structure Field string.
data: t_table like
standard table
of fs_...
data:
w_file TYPE string.
data:
fname(10) VALUE '.\xyz.TXT'.
select-options: if any.
PARAMETERS:
p_file LIKE rlgrap-filename.
w_file = p_file.
select .... statement
OPEN DATASET fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
LOOP AT t_... INTO fs_....
write:/ .....
TRANSFER fs_... TO fname.
or
TRANSFER t_... TO fname
ENDLOOP.
CLOSE DATASET fname.
Reward points wisely and if you are benefitted or ask for more detailed explanation if problem not solved.
Regards Harsh. -
Hi Guys,
I am using Open dataset for downloading the data into Application server .I am getting the error file path is not opened but in al11 i was able to see the path what i mentioned here except bseg.txt file.I am getting error at Open data set statement.I have to write the bseg table data into the file bseg.txt in application server.can any body suggest the solution for this problem.
Very urgent.
wa_BSEG_file = '/interfaces/DR1/MM/outbounb/ZMMOF3007/BSEG.txt'.
OPEN DATASET wa_BSEG_file FOR OUTPUT "Write to appl. server
IN TEXT MODE
Encoding default. "Open dataset Return code
IF sy-subrc = 0.
TRANSFER it_cosp1 to wa_BSEG_file.
Write : 'File Transferred BSIK'.
ELSE .
Write : 'File Not Found / Transferred BSIK'.
ENDIF.
CLOSE DATASET wa_BSEG_file.
Very urgent.Full marks will be alloted if u give me the correct answer.
Thanks,
Gopi.Hi,
Due to serveral reasons
1. Check whether you have proper authority in the directory?
2. check the whether any files with same name?
3. use addition message in the open dataset statement so that you can know the system message it getting.
DATA: msg(100).
OPEN DATASET wa_BSEG_file FOR OUTPUT MESSAGE msg
IN TEXT MODE Encoding default.
aRs -
Open data set from Text mode to Binary mode
Hello All,
In a program i am using the command
OPEN DATASET file FOR OUTPUT IN TEXT MODE
ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
Now i want to change this open data set to binary mode. I mean to change the command like below.
OPEN DATASET file FOR OUTPUT IN BINARY MODE.
when i do this. the output in the file is totally changing. I mean previously i have some text now i have some diffrent characters.
How can i use this command with out change in the output as previous output. Please tell me the changes and why i have to do.
OPEN DATASET file FOR OUTPUT IN BINARY MODE.
Regards,
Lisa.
Message was edited by:
Lisa RoyText Mode means that the records in the file have a carriage return marking the end of each record.
Binary Mode means the file is a string of data.
You can't read a text file in BINARY MODE, or a binary file in TEXT MODE.
If you are changing the mode, then you must be supplied with a file in the new mode. -
OPEN DATA SET .. EXCEL OUTPUT
Hello frnds,
I had requirement to genrate a excel file ... In a given format.
How should I ?? Preffered through Open data set .... Is it possible
With Regards.Hi Manmeet,
Try this sample code,
TABLES: ZVIJ.
DATA : BEGIN OF WA,
NAME(6) TYPE C,
AGE(3) TYPE C,
DES(5) TYPE C,
SALARY(3) TYPE C,
INCENT(3) TYPE C,
END OF WA,
IT LIKE TABLE OF WA WITH HEADER LINE.
DATA : BEGIN OF WA1,
NAME(6) TYPE C,
AGE TYPE I,
DES(4) TYPE C,
SALARY TYPE I,
INCENT TYPE I,
END OF WA1,
IT1 LIKE TABLE OF WA1 WITH HEADER LINE.
OPEN DATASET 'SAMP' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\Documents and Settings\Desktop\Book62.XLS' --> XLS
for Excel file.
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = IT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
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 .
IT1-NAME = IT-NAME.
IT1-AGE = IT-AGE.
IT1-DES = IT-DES.
IT1-SALARY = IT-SALARY.
IT1-INCENT = IT-INCENT.
APPEND IT1.
ENDLOOP.
LOOP AT IT1.
ZVIJ-NAME = IT1-NAME.
ZVIJ-AGE = IT1-AGE.
ZVIJ-DES = IT1-DES.
ZVIJ-SALARY = IT1-SALARY.
ZVIJ-INCENT = IT1-INCENT.
INSERT ZVIJ.
ENDLOOP.
Thanks.
Reward If Helpful. -
Hello ,
I am sending file to print server and i am accounting problems with special characters
In first version of program ( please see the code below )
"OPEN DATASET g_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT."
The special characters l from German and French alphabet were NOT printed properly , and we had some nonsense results . Other '"Normal "characters like A , B... are printed without errors .
To prevent this error i wrote new line of code for open data set ( below ).
"OPEN DATASET g_filename FOR OUTPUT IN LEGACY TEXT MODE CODE PAGE '4110' IGNORING CONVERSION ERRORS."
This was working only when FTP was NOT used , when FTP was used i had following short dump.
I am working in SAP release 6.0
Please Advice
SHORT DUMP Message :
What happened?
The conversion of texts in code page '4102' to code page '4110' is not
supported here.
The current ABAP program 'SAPLZPRN_AUTO_LBL' had to be interrupted because
incorrect
data would have been created by the conversion.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CODEPAGE_CONVERTER_INIT', was
not caught in
procedure "Z_TRANSFER_FILE" "(FUNCTION)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Possibly, one of the codepages '4102' or '4110' - needed for the
conversion - is unknown to the system. Another option is, that a Unicode
codepage was specified for a file in LEGACY MODE, which is not allowed.
Additional parameters for the codepage conversion (as , for example, the
replacement character) might have invalid values. You can find further
information under 'Inernal notes'.
If the problem occurred at opening, reading, or writing of a file, then
the file name was '/te/mm/labels/0488_20091208_051317_EC008119_01_001.dd'.
(Further information about this file: " X ")Hi,
Also check the character set supported by the Printer. Printer configuration should also be checked on SAP side to determine character set and code page using SPAD.
Regards,
Nishad -
Hello all,
Can we specify Encoding in the OPEN DATA SET statement,i found out that we can encode it with UTF-8.
but i want to encode my data in Latin1 ISO-8859-1.
is it possible?
if yes how to do it?
plz help its urgent:(Hello Surmeet
For me this sounds like that your string contains characters from two different encodings, e.g. ISO-8859-1 and ISO-8859-2.
You could try to use option
OPEN DATASET ... IGNORING CONVERSION ERRORS.
Alternatively, you could surround the OPEN DATASET statement with a
TRY.
OPEN DATASET ...
CATCH CX_SY_CONVERSION_CODEPAGE INTO lo_error.
ld_msg = lo_error->get_text( ). " get the message text
ENDTRY.
block and analyse the error message text. Hopefully you will find some hints to solve the problem.
<i>Note</i>: For details refer to the ABAP keyword documentation of OPEN DATASET.
Regards
Uwe -
OPEN DATA SET change character "SPACE" to '..'
Hi!
I am loadind a XML file by OPEN DATA SET but it is changing from the "space" Hex = 20 to '..' Hex = "0D0C".
Do you know where is the problem?
Thanks.
ABAP -
>
OPEN DATASET VP_FILEXML FOR INPUT IN BINARY MODE.
OPEN DATASET VP_FILEXML FOR INPUT IN TEXT MODE ENCODING UTF-8.
REFRESH objbin.
DO.
READ DATASET VP_FILEXML INTO objbin.
IF sy-subrc EQ 0.
APPEND objbin.
CLEAR objbin.
ELSE.
APPEND objbin.
CLEAR objbin.
IF V_FLAG_EXIT = 'X'.
EXIT.
ENDIF.
V_FLAG_EXIT = 'X'.
ENDIF.
ENDDO.
CLOSE DATASET VP_FILEXML.Hi
Change TYPE X values to TYPE C in data declaration ans then call class CL_ABAP_CHAR_UTILITIES
For "0D0C" call class:
for 0D:
CLASS cl_abap_char_utilities DEFINITION LOAD.
DATA : C_CR TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
for 0C:
CLASS cl_abap_char_utilities DEFINITION LOAD.
DATA : C_FORM TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>FORM_FEED.
check this link for more details.. [Link|http://help.sap.com/saphelp_nw04/helpdata/en/79/c554d9b3dc11d5993800508b6b8b11/frameset.htm]
you will get more information on hexa decimal related
Thanks and regards. -
Hello ,
I use the command OPEN DATA SET in order to upload file content from server ,
the problem is that i getting error :_No such file or directory ._
the file is exist in server I can see it when i put the path on windows start->run
and i give the permission for the folder to everyone .
1. My question is what i miss here
2. when i do little test and try to use GUI_UPLOAD i see the file content so i don't understand what is wrong here the file is not on my local PC
Regards
Jameshi James,
the parameter file_name receives the name of the file (ja, ja, ja.......)
here comes the explanation:
in the transaction FILE you must define phisical and logical path for a file:
for example:
MY_FILE => pointing to the folder /host/temp/
and here comes the call to the function in your program:
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
client = sy-mandt
logical_path = l_path " the name of your logical path defined in trx FILE (MY_FILE)
file_name = p_filename " the name of the file you want to read (for example: file.txt )
IMPORTING
file_name_with_path = file_trg
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 4
OTHERS = 5.
in the variable file_trg you should get the value /host/temp/file.txt (from the example) to do the open dataset.
sorry about my english
regards, Sebastiá -
Hello
How can we set the length of the record size in the open data set. I have like 40 fields of internal table and I need to upload it to Appl server. I could do it but all the fields dont appear. How can set the record size ? Can anyone explain..ThanksHI Vicky,
doesn't show all fileds: scence in the file?
then either you are not passing the whole data or you are not selecting the whole data to the sending internal table
change your declaration to the string rather than character....
follow the code below:
DATA: filepath TYPE string.
OPEN DATASET filepath FOR OUTPUT IN BINARY MODE.
LOOP AT l_xml_table INTO l_xml_rec.
TRANSFER your itab TO filepath.
ENDLOOP.
CLOSE DATASET filepath. -
Open data set problem with binary mode
Hi everyone,
I am trying to read into a buffer the content of a binary file (like Excel) and to write that content file using open data set into a folder destination.
The file destination has a size diferent than from the original one and cannot be open.
Here is the code.
DATA: lv_file_name(100),
lt_content LIKE sdokcntbin OCCURS 0 WITH HEADER LINE.
MOVE '\computerTestA1.xls' TO lv_file_name.
OPEN DATASET lv_file_name FOR INPUT IN BINARY MODE.
IF sy-subrc NE 0.
EXIT.
ENDIF.
DO.
READ DATASET lv_file_name INTO lt_content-line.
IF sy-subrc NE 0.
EXIT.
ENDIF.
APPEND lt_content.
ENDDO.
CLOSE DATASET lv_file_name.
* DELETE DATASET lv_file_name.
CLEAR: lv_file_name.
MOVE '\computerTestB2.xls' TO lv_file_name.
OPEN DATASET lv_file_name FOR OUTPUT IN BINARY MODE.
IF sy-subrc NE 0.
EXIT.
ENDIF.
LOOP AT lt_content.
TRANSFER lt_content-line TO lv_file_name.
ENDLOOP.
CLOSE DATASET lv_file_name.
THanks in advance.
Regards.
Message was edited by:
David FrydaHi,
I solve the problem.
In fact, when I try to write the last line of lt_content, it does write all the line even if this line is not full of data.
Solution :
DATA: lv_file_name(100),
lt_content LIKE sdokcntbin OCCURS 0 WITH HEADER LINE,
alen TYPE i,
pos TYPE i.
MOVE '\mr0221TestA1.xls' TO lv_file_name.
OPEN DATASET lv_file_name FOR INPUT IN BINARY MODE.
IF sy-subrc NE 0.
EXIT.
ENDIF.
SET DATASET lv_file_name POSITION END OF FILE.
GET DATASET lv_file_name POSITION pos.
SET DATASET lv_file_name POSITION 0.
DO.
CLEAR lt_content.
READ DATASET lv_file_name INTO lt_content-line ACTUAL LENGTH alen .
IF sy-subrc NE 0.
APPEND lt_content.
EXIT.
ENDIF.
APPEND lt_content.
ENDDO.
CLOSE DATASET lv_file_name.
* DELETE DATASET lv_file_name.
CLEAR: lv_file_name.
MOVE '\mr0221TestB2.xls' TO lv_file_name.
OPEN DATASET lv_file_name FOR OUTPUT IN BINARY MODE.
IF sy-subrc NE 0.
EXIT.
ENDIF.
LOOP AT lt_content.
AT LAST.
TRANSFER lt_content-line TO lv_file_name LENGTH alen.
EXIT.
ENDAT.
TRANSFER lt_content-line TO lv_file_name.
ENDLOOP.
CLOSE DATASET lv_file_name.
Thanks. -
Open data set for reading excel file on application server in back ground
open data set for reading excel file on application server in back ground
hi Vijay,
I am afraid you won't be able to read from Excel file on Appl. Server.
ec -
Difference between SXPG_COMMAND_EXECUTE and Open data set mechanism
Can you please help me to know the difference between moving a file using FM "SXPG_COMMAND_EXECUTE" and moving file using "open data set - transfer file- close data set" mechanism?
Through 'SXPG_COMMAND_EXECUTE' u can execute a External command (ie.. UNIX /Windows/OS/400) In ABAP programming..
for Conversion Of Aplication server File/Move the file from one directory to Other...
The Command must be present in SM69.
Using this function module'SXPG_COMMAND_EXECUTE' , you can check the authorization of a user to execute a particular external command and run the command:
With the arguments specified in ADDITIONAL_PARAMETERS
On the target host system defined by OPERATINGSYSTEM and TARGETSYSTEM
If an SAP profile parameter is inserted in the portion of the command stored in the database, then the value of this parameter is substituted into the command. If an SAP application server is active on the target system (TARGETSYSTEM), then the profile parameter values are read from the profile that is active on that system. No parameter substitution is made in ADDITIONAL_PARAMETERS.
After substitution, the command is checked for the presence of "dangerous" characters such as the semicolon ( ; ) on UNIX systems.
If an additional "security function module" is specified in the command definition, this function module is also called in the course of processingebenfalls. This function module can prevent execution of the command.
If the authorization checks complete successfully, the command is run on the target host system.
Through Open Data Set u can read and write the file in the same directory...
Thnaks,
SD
Moderator message: copy/paste without credit, points removed, please do not repeat!
http://www.google.de/search?hl=de&q=%22youcanchecktheauthorizationofauserto+execute%22&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=
http://www.google.de/search?hl=de&q=%22Aftersubstitution%2Cthecommandischeckedforthepresence%22&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=
Edited by: Thomas Zloch on Aug 17, 2010 12:47 PM
Maybe you are looking for
-
SSO issue with BI 4.0 BW and ECC
We currently have SAP BW 7.3 BOBJ 4.0 ECC and SAP portals. We have configured SAP BW, BOBJ and SAP Portal with SSO and that works perfectly fine. The issue is that i have Crystal Reports running on ECC that have also to be published to the Portal. Al
-
How can i distinguish between set or tuples from incoming filters in a calculation
How can i distinguish between set or tuples from incoming filters in a calculation. i am using descendants function with the leaves option to calculate some project revenue cause there is different calcuation method on sub projects the sum on the mai
-
Not able to connect remotely via TNS entry
Hello, I need to do clone, so wanted to have remote connectivity to my test database. I brought the test database in nomount. Put the right entries in tnsnames.ora file of the same, yet when i login directly it shows it is in NOMOUNT but when remotel
-
Child creation Error on vms HELP
Hi, Iam trying to execute a file from withing a java program on VMS This is my code public class BAMBOE { public static void main(String[] args) { BamboeRunner boe = new BamboeRunner(); boe.start(); import java.io.*; public class BamboeRun
-
File extension with httpUploadForm
Can someone tell me if it is possible to limit file upload to files with, for example, .doc extension using httpUploadForm? Is there is some userguide on this topic? I have looked into the help section of jdeveloper but it didn't help much. What are