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,
Krishnau2026
Hi 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.
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 -
How to use open Row set in sql server 2014
Hello All,
How to open the row set using sql server 2014 using link server connection.Hi denyy,
Are you referring to the OPENROWSET function in SQL Server 2014?
The OPENROWSET method is an alternative to accessing tables in a linked server and is a one-time, ad hoc method of connecting and accessing remote data by using OLE DB. The examples below demonstrate how to use the OPENROWSET function:
A. Using OPENROWSET with SELECT and the SQL Server Native Client OLE DB Provider
SELECT a.*
FROM OPENROWSET('SQLNCLI', 'Server=Seattle1;Trusted_Connection=yes;',
'SELECT GroupName, Name, DepartmentID
FROM AdventureWorks2012.HumanResources.Department
ORDER BY GroupName, Name') AS a;
B. Using the Microsoft OLE DB Provider for Jet
SELECT CustomerID, CompanyName
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'C:\Program Files\Microsoft Office\OFFICE11\SAMPLES\Northwind.mdb';
'admin';'',Customers);
GO
C. Using OPENROWSET to bulk insert file data into a varbinary(max) column
USE AdventureWorks2012;
GO
CREATE TABLE myTable(FileName nvarchar(60),
FileType nvarchar(60), Document varbinary(max));
GO
INSERT INTO myTable(FileName, FileType, Document)
SELECT 'Text1.txt' AS FileName,
'.txt' AS FileType,
* FROM OPENROWSET(BULK N'C:\Text1.txt', SINGLE_BLOB) AS Document;
GO
D. Using the OPENROWSET BULK provider with a format file to retrieve rows from a text file
SELECT a.* FROM OPENROWSET( BULK 'c:\test\values.txt',
FORMATFILE = 'c:\test\values.fmt') AS a;
Reference:
OPENROWSET (Transact-SQL)
Using the OPENROWSET function in SQL Server
Thanks,
Lydia Zhang
If you have any feedback on our support, please click
here. -
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 -
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 -
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. -
Hi experts, how to use open sql to read data from one " maintenance view"?
i want to use this part of data within report ,so how to use open sql statement to read data from one " maintenance view"?
Hi
You can't use OPEN SQl statements to fetch data from maintenance view
You have to use only Database views
see the different types of views and the difference
The followings are different types of views:
- Database View (SE11)
Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
- Help View ( SE54)
Help views are used to output additional information when the online help system is called.
When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
- Projection View
Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
- Maintenance View ( SE54 )
Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
Please have a look at below link. It will help you.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
for more detailed info look on:
http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
Reward points for useful Answers
Regards
Anji -
Info needed on how to design xcelsius dashboards using SAS data sets.
Is it possible to design a xcelsius dashboard using SAS data sets? Any info on this subject is highly appreciated. Thanks.
Hi,
I am not much aware of the SAS datasets, but i can definitely provide some pointers on what data Xcelsius could consume.
Assuming you use Xcelsius 2008 - you can have static data within the embedded excel sheet..
You can recieve dynamic data using
1. QAAWS
2. Web Services
3. XML data
4.Live Office
and more....I am sure some of the Gurus could provide better pointers. -
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 -
Answer the following question regarding GUI_UPLOAD and Open Data Set
1. whats the connection or relationship of S_GUI to GUI_UPLOAD?
2. GUI_UPLOAD saves files to local directory of a use while OPEN DATA SET saves/archives files in the server directory. Where is the risk directed towards consuming disk space? Server disk or workstation disk space?
3. how will this work for multiple files?
4. Regarding Open Data Set - How the files will be put in AL11?The GUI_DOWNLOAD only download the file to local PC...so any abap code running in other pc will not able to use the file.
BUt if you use open dataset to load the file APPLICATION server any ABAP pogram can access the file.
Following code explains how you load file using open data setto appl server,
you can check in t-code <b>AL11</b> for files/dir in applicatin server.
you to change the value of <b>myfile</b> variable in my code..
you have to give the full path of the dirctory.
<b><b>plz reward points if it hlps you.</b></b>
Report ZANID_TEST2 message-id ZM.
data begin of itab occurs 0. "your internal table
include structure MARA.
data end of itab.
*--file upload purpose--
DATA: BEGIN OF it_file OCCURS 0,
buffer(200),
END OF it_file.
DATA: myfile(128) type c value 'E:\usr\sap\put\sample1xx.txt',
start-of-selection.
*--populating itab--
select * from mara into corresponding fields of table itab
up to 100 rows.
perform UPLOAD_FILE_TO_APPL.
*--form definitin--
form UPLOAD_FILE_TO_APPL.
OPEN DATASET myfile FOR OUTPUT IN TEXT MODE.
IF sy-subrc NE 0.
MESSAGE e999(zm) WITH 'File could not be opened'.
ENDIF.
*-- creating the file data table
loop at itab.
*-- i am only taking two fields
concatenate itab-matnr itab-matkl into it_file-buffer
separated by space.
append it_file.
endloop.
LOOP AT it_file.
TRANSFER it_file-buffer TO myfile.
CLEAR IT_FILE-BUFFER.
ENDLOOP.
CLOSE DATASET myfile.
IF sy-subrc NE 0.
MESSAGE e999(zm) WITH 'File could not be closed'.
ENDIF.
endform. " DUPLOAD_FILE_TO_APPL -
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. -
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 -
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 .. 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.
Maybe you are looking for
-
Question on the value of an Upload item
Hi all, I have an upload item (:P100_UPLOAD) with a Submit button. When I click on Submit I notice that the value of the upload item is different if access it from javascript or from PL/SQL process. From javascript (using html_GetElement('P100_UPLOAD
-
DS 6.0 Proxy Configuration
I am having some problems configuring the DSEE 6.0 Proxy Server. It seems like it should be fairly straightforward and maybe I am missing something obvious. I create the Proxy Server instance, then created a data source to my Directory Instance, thro
-
I made a slide show using iMovie then created a dvd using iDVD. When watching the dvd using a dvd player after sevral minutes of playing properly it starts to show glitches, noise, momentarily stops and the music hesitates then it continues normally
-
Received message left in inbox get purged after restarting thunderbird
Sometimes when I leave received message in my inbox, rather than disposing of them in some other way, graand then close Thunderbird, the message get purged the next time I restart the program. How I make sure that any messages in the inbox will stay
-
Systemd logind.service reports an error: Failed to start login service
Hello, I found this error in /var/log/errors.log and /var/log/daemon.log although my system functions normally. It's been written there every 90 seconds!!!!: Dec 19 23:52:59 localhost systemd[1]: Failed to start Login Service. Dec 19 23:54:29 localho