Appending or Replacing data sets in DIAdem
I was wondering if there was an easy way to take new data points and append them to old data points already loaded into DIAdem. Similarly I would be interested in just replacing the old data with the new
I have a data set I have uploaded from an excel file into DIAdem. Within DIAdem I have manipulated data and made several graphs for presentations. Since that first upload of data I now have acquired new data. That new data is in the same format as the old data, it's simply that there are more data points now. So it would be nice to know how to either append or replace the old data while keeping all the formatting.
Right now the easiest way I've found is to copy and paste data into a new Excel file and upload it. DIAdem scripts have proven buggy and inefficient. I can't believe Excel would handle appending better than DIAdem. There must be an easy way to do this that I am missing. Any help would be appreciated.
Hi Stysley,
Unless you're talking about a huge amount of data, I'd say the easiest and cleanest way to do this would be to delete all your channels in DIAdem and reload them from the (now larger) data file. Then all you have to do in REPORT is hit the "Refresh" icon.
It sounds like you are loading your data files into Excel-- does that mean that you have ASCII data files to start with? The best approach in that case would be to create a DataPlugin for the ASCII data file format and avoid the intermediate Excel step. Then re-loading the data would be as easy as hitting the "Delete Internal Data" icon in the NAVIGATOR and then dragging the ASCII data file from the NAVIGATOR tree view into the Data Portal at the right of DIAdem.
If you'll post or email me ([email protected]) several of your ASCII files, I should be able to send you back a DataPlugin you can use.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
Similar Messages
-
Problem with a data set: DIAdem crashes
Hi,
I've got a problem with a data set. When I want to zoom in DIAdem-View, DIAdem crashes with the following message (translated from German ;-):
error type: FLOAT INEXACT RESULT or FLOAT INVALID OPERATION or FLOAT STACK CHECK
error address: 00016CB8
module name: gfsview.DLL
I've got some similar data set not showing such problems. Further on I scanned the data a bit, but in the 59000 points I didn't see anything special. I did try to delete "NOVALUE"s as well, but after that there still exist "NOVALUE"s.
Does anyone have an idea what to look for?
Thanks,
CarstenCarsten,
Could you please upload you Citadel database to the following FTP site:
ftp.ni.com/incoming
If you want to compress (ZIP) and/or put a password on the data, that's fine. Please send me a private email at [email protected] (with the file name and password if you put one on the file) once you have uploaded the file and I will check it out.
Otmar
Otmar D. Foehner
Business Development Manager
DIAdem and Test Data Management
National Instruments
Austin, TX - USA
"For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary." -
Diadem 9.1 - "Data set:Proper​ties" Query
Within the Data entry window of Diadem Version 8.1 there is a drop down menu from the "Edit" header titled "Dat set properties....".
Where is the equivalent feature within Diadem 9.1?Hi marine boy,
That information is in two places as of DIAdem 9.x. The scaler data set properties are in the property window at the bottom of the Data Portal, just highlight the Data Set/Root level of your Data Portal (it's the blue cylinder icon at the top), then glance down to the property window. You will see the "Title", "Description", "Author", "Storage Date", and "Storage Time" properties there that you used to see in the dialog you mention.
The remaining properties are the Data Set Comments, which you can now access by again right-clicing on the Data Set/Root level of your Data Portal (it's the blue cylinder icon at the top), then selecting "Data set comments..."-- this pops up a dialog to display/edit the Data Set Comments. These comments WILL be saved if you save the file as a TDM file.
Regards,
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
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. -
Disobey the user profile date setting in module pool
Hi all,
I am working on a module pool. I have a request to disobey the user profile date setting dd/mm/yyyy to user requested date format dd-mm-yyyy.
I understand that it can easily be done in SAPScript with command SET DATE MAST dd-mm-yyyy, but how to do it in module pool?
Thanks in advance.Hi, Wong.
Follow the Steps Bellow
--> Copy Search Help BU_DATE_CHAR to ZBU_DATE_CHAR using T-Code SE11
--> Copy FM BUS_TOOLS_DATE_CHAR_EXIT to Z_BUS_TOOLS_DATE_CHAR_EXIT using T-Code SE37
--> Open ZBU_DATE_CHAR in Change mode and add Z_ in the Start of Search help exit FM as we have copy new
--> Active ZBU_DATE_CHAR it will not give you any Error message may be one Warning message but Ignore this.
--> Active Z_BUS_TOOLS_DATE_CHAR_EXIT my will give you error message do the following Change
in Changing Tab SHIP type SHLP_DESCR " Change the Previous type with this one.
in Tables Tab SHLP_TAB type SHLP_DESCT " Change the Previous type with this one.-->
--> After doing above changes.
--> Add the following line of Code on line number 92 just before the line APPEND record_tab.
REPLACE ALL OCCURRENCES OF '.' in record_tab-string WITH '-'.
--> Activate both Search Help and FM
now in the Search help filed in Module Pool you where using BU_DATE_CHAR use ZBU_DATE_CHAR
I did the above way and it is working fine this way now When i Press F4 and select some date it show in the Field like 01-01-2009 Previously it was showing me 01.01.2009
Please Reply if any problem,
Best Regards,
Faisal -
Open data set and close data set
hi all,
i have some doubt in open/read/close data set
how to transfer data from internal table to sequential file, how we find sequential file.
thanks and regards
chaitanyaHi Chaitanya,
Refer Sample Code:
constants: c_split TYPE c
VALUE cl_abap_char_utilities=>horizontal_tab,
c_path TYPE char100
VALUE '/local/data/interface/A28/DM/OUT'.
Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : rb_pc RADIOBUTTON GROUP r1 DEFAULT 'X'
USER-COMMAND ucomm, "For Presentation
p_f1 LIKE rlgrap-filename
MODIF ID rb1, "Input File
rb_srv RADIOBUTTON GROUP r1, "For Application
p_f2 LIKE rlgrap-filename
MODIF ID rb2, "Input File
p_direct TYPE char128 MODIF ID abc DEFAULT c_path.
"File directory
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_f1.
*-- Browse Presentation Server
PERFORM f1000_browse_presentation_file.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_f2.
*-- Browse Application Server
PERFORM f1001_browse_appl_file.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF rb_pc = 'X' AND screen-group1 = 'RB2'.
screen-input = '0'.
MODIFY SCREEN.
ELSEIF rb_srv = 'X' AND screen-group1 = 'RB1'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ABC'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
*& Form f1000_browse_presentation_file
Pick up the filepath for the file in the presentation server
FORM f1000_browse_presentation_file .
CONSTANTS: lcl_path TYPE char20 VALUE 'C:'.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = lcl_path
mask = c_mask "',.,..'
mode = c_mode
title = text-006
IMPORTING
filename = p_f1
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
flg_pre = c_x.
ENDIF.
ENDFORM. " f1000_browse_presentation_file
*& Form f1001_browse_appl_file
Pick up the file path for the file in the application server
FORM f1001_browse_appl_file .
DATA: lcl_directory TYPE char128.
lcl_directory = p_direct.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = lcl_directory
filemask = c_mask
IMPORTING
serverfile = p_f2
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000(zmm) WITH text-039.
flg_app = 'X'.
ENDIF.
ENDFORM. " f1001_browse_appl_file
*& Form f1003_pre_file
Upload the file from the presentation server
FORM f1003_pre_file .
DATA: lcl_filename TYPE string.
lcl_filename = p_f1.
IF p_f1 IS NOT INITIAL.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lcl_filename
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = i_input
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 s000 WITH text-031.
EXIT.
ENDIF.
ELSE.
PERFORM populate_error_log USING space
text-023.
ENDIF.
ENDFORM. " f1003_pre_file
*& Form f1004_app_file
upload the file from the application server
FORM f1004_app_file .
REFRESH: i_input.
OPEN DATASET p_f2 IN TEXT MODE ENCODING DEFAULT FOR INPUT.
IF sy-subrc EQ 0.
DO.
READ DATASET p_f2 INTO wa_input_rec.
IF sy-subrc EQ 0.
*-- Split The CSV record into Work Area
PERFORM f0025_record_split.
*-- Populate internal table.
APPEND wa_input TO i_input.
CLEAR wa_input.
IF sy-subrc <> 0.
MESSAGE s000 WITH text-030.
EXIT.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDFORM. " f1004_app_file
Move the assembly layer file into the work area
FORM f0025_record_split .
CLEAR wa_input.
SPLIT wa_input_rec AT c_split INTO
wa_input-legacykey
wa_input-bu_partner
wa_input-anlage.
ENDFORM. " f0025_record_split
Reward points if this helps.
Manish -
Exception Handling for OPEN DATA SET and CLOSE DATA SET
Hi ppl,
Can you please let me know what are the exceptions that can be handled for open, read, transfer and close data set ?
Many Thanks.HI,
try this way....
DO.
TRY.
READ DATASET filename INTO datatab.
CATCH cx_sy_conversion_codepage cx_sy_codepage_converter_init
cx_sy_file_authority cx_sy_file_io cx_sy_file_open .
ENDTRY.
READ DATASET filename INTO datatab.
End of changes CHRK941728
IF sy-subrc NE 0.
EXIT.
ELSE.
APPEND datatab.
ENDIF.
ENDDO. -
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 -
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 -
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 -
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. -
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. -
Regarding Upload of data into SAP from Application server using DATA SETS
Hi all,
I have a problem when uploading data that is application server [.txt file] into SAP using OPEN DATA SET,READ DATA SET & CLOSE DATA SET it is now going to dump. The file is actually splits the fields by using Tab Delimiter.
During uploading some junk values are coming with '#' so it going to dump and giving follow type of error.
Runtime Errors CONVT_NO_NUMBER
Exception CX_SY_CONVERSION_NO_NUMBER
Unable to interpret "#0#0#0#0#0#0#0#" as a number.
Can any one solve the above issue as i need it urgently.
Thanks in advance.
Thanks & Regards,
Rayeezuddin.Hi Hielman,
Thnaks for that reply and for effort you are putting to solve my issue.
I had done the same thing what u have posted prior to your reply but still i am getting dump.
FORM f_get_legacy_data .
DATA: l_tab type xstring,
l_tab1(1) type c,
s type x.
move '23' to l_tab.
move l_tab to l_tab1.
OPEN DATASET v_pfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
OPEN DATASET v_pfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc <> 0.
MESSAGE text-207 TYPE c_e.
ELSE.
DO.
CLEAR wa_input1.
READ DATASET v_pfile INTO wa_input1.
READ DATASET v_pfile INTO wa_read.
IF sy-subrc EQ 0.
move wa_read to i_txt-txt.
append i_txt.
ELSE.
EXIT.
ENDIF.
ENDDO.
s = '09'.
loop at i_txt.
move i_txt-txt+10(1) to l_tab1.
move '#' to l_tab1.
split i_txt-txt at s into wa_input1-vbeln wa_input1-posnr
split i_txt-txt at '#' into wa_input1-vbeln wa_input1-posnr
wa_input1-per0bal wa_input1-per1val
wa_input1-per2val wa_input1-per3val
wa_input1-per4val wa_input1-per5val
wa_input1-per6val wa_input1-per7val
wa_input1-per8val wa_input1-per9val
wa_input1-per10val wa_input1-per11val
wa_input1-per12val.
APPEND wa_input1 TO i_input1.
CLEAR wa_input1.
endloop.
ENDIF.
CLOSE DATASET v_pfile.
IF i_input1[] IS INITIAL.
If there is no data in the legacy file or if the structure of the
legacy data does not match with that of internal table error message
need to be displayed.
MESSAGE text-211 TYPE c_e.
*&--begin of change--
ELSE.
CLEAR: wa_input, wa_input1.
LOOP AT i_input1 INTO wa_input1.
MOVE wa_input1 TO wa_input.
MOVE: wa_input1-vbeln TO wa_input-vbeln,
wa_input1-posnr TO wa_input-posnr,
wa_input1-per0bal TO wa_input-per0bal,
wa_input1-per1val TO wa_input-per1val,
wa_input1-per2val TO wa_input-per2val,
wa_input1-per3val TO wa_input-per3val,
wa_input1-per4val TO wa_input-per4val,
wa_input1-per5val TO wa_input-per5val,
wa_input1-per6val TO wa_input-per6val,
wa_input1-per7val TO wa_input-per7val,
wa_input1-per8val TO wa_input-per8val,
wa_input1-per9val TO wa_input-per9val,
wa_input1-per10val TO wa_input-per10val,
wa_input1-per11val TO wa_input-per11val,
wa_input1-per12val TO wa_input-per12val.
APPEND wa_input TO i_input.
CLEAR: wa_input, wa_input1.
ENDLOOP.
ENDIF.
ENDFORM. " GET_LEGACY_DATA
When i am giving input as
Directory /pw/data/erp/D5S/fi/up
Name: Backlog1616_D1S.txt
BKCOPO1 BKSOI1 1000.00 100.00 -200.00 0 0 0 0 0 0 0
BKSOPO2 BKSOI2 2222.22 0 300 0 0 0 0 0 0 0
BKSOPO3 BKSOI3 -3000 400 0 0 0 0 0 0 0 0
BKSOPO4 4000.55 500 600 0 0 0 0 0 0 0
0040000000 000010 -100 -110 -110 0 0 -600 0 0 0 0
0040000001 000010 -110 -110 0 0 0 -610 0 0 0 0
I am getting i_input internal table populated as follows at the end of that subroutine.
After appending [APPEND wa_input TO i_input].
BKCOPO1#BK|000000| 0.00 | 0.00 | 0.00 |
BKSOPO2#BK|000000| 0.00 | 0.00 | 0.00 |
BKCOPO3#BK|000000| 0.00 | 0.00 | 0.00 |
BKCOPO4##4|000000| 0.00 | 0.00 | 0.00 |
0040000000|000000| 0.00 | 0.00 | 0.00 |
0040000001|000000| 0.00 | 0.00 | 0.00 |
And output is showing erronious records: 6
No entries inserted.
Can you solve this issue. -
Help with Spry Detail Regions, XML Data Sets, for IMG gallery
Hello,
I'm working on a site for a friend of mine, a photo gallery. You can see the gallery here, it's a temporary one I'm working on
http://www.emiliajozefa.com/a_index.html
Here are some important parts of my code:
//initially load these data sets. the function will be called by the links to update components later<script type="text/javascript">
var intNumPhoto = 0;
dsGallery = new Spry.Data.XMLDataSet("photofile.xml", "galleries/ride/photo");
dsNav = new Spry.Data.XMLDataSet("photofile.xml", "galleries/ride");
function updateSpryComponents(galleryDir){
alert("updating spry components for " + galleryDir);
intNumPhoto = 0;
dsGallery = Spry.Data.XMLDataSet("photofile.xml", "galleries/" + galleryDir + "/photo");
dsNav = Spry.Data.XMLDataSet("photofile.xml", "galleries/" + galleryDir);
dsGallery.setCurrentRow(intNumPhoto);
//document.getElementById('nav').innerHTML='<H1>'+enlarge.inp.value+'</H1>';
document.getElementById('nav').innerHTML=
"<span spry:detailregion = 'dsGallery'>
<a href = 'javascript:' onclick = 'if(intNumPhoto > 0){intNumPhoto -= 1}; dsGallery.setCurrentRow(intNumPhoto);'><</a> {@id} / </span>
<span spry:detailregion = 'dsNav'>{@numPhotos}
<a href = 'javascript:' onclick = 'if(intNumPhoto < ({@numPhotos} - 1)){intNumPhoto += 1; }; dsGallery.setCurrentRow(intNumPhoto);'>></a>
</span>";
</script> <--- later ----><!-- SIDEBAR NAV. When link i clicked, set DataSet to the location of the new gallery -->
<div id = "sideBarNav">
<a href = "javascript:" onclick ='updateSpryComponents('ride');">Tannersville</a>
<br />
<a href = "javascript:" onclick = "updateSpryComponents('dive');">Dive</a>
<br />
<a href = "javascript:" onclick = "updateSpryComponents('poland');">Poland</a>
<br />
<a href = "javascript:" onclick = "updateSpryComponents('alaska');">Alaska</a>
</div>
</div>
<div id = "content2">
<!-- PHOTO CONTAINER I think I somehow need to refresh this section of the code to reload new data-->
<div id = "fotoContainer" spry:detailregion="dsGallery"><img src = "photos/{@path}" width = "{@width}" height = "{@height}"/></div>
<!-- IMAGE NAVIGATION -->
<div id = "nav">
<span spry:detailregion = "dsGallery" id = "galSpan">
<a href = "javascript:" onclick = "if(intNumPhoto > 0){intNumPhoto -= 1}; dsGallery.setCurrentRow(intNumPhoto);"><</a> {@id} / </span>
<span spry:detailregion = "dsNav" id = "navSpan">{@numPhotos}
<a href = "javascript:" onclick = "if(intNumPhoto < ({@numPhotos} - 1)){intNumPhoto += 1; }; dsGallery.setCurrentRow(intNumPhoto);">></a>
</span>
</div>
You could view source there to get the code. Here is what I believe is my problem
I'm trying to automate the site so that when you click on one of the links on the left, without refreshing the page, the paths to the galleries xml file changes, and the spry Detail Regions (1 for the images, 1 for the navigation - left and right arrows). I think the problem is that once the link changes the set and calls my updateSpryComponenets() function, the detail regions need to be refreshed. I'm currently trying to solve this by dynamically rewriting the HTML thru .innterHTML, everytime I call updateSpryComponents().There may also be a problem in the Javascript function updateSpryControllers because if I put the alert after the spry calls, I never get the alert
Thanks in advance for any help!Update:
Ok, the first query on the Recent tab doesnt work for me because it wont show unless its already voted, and since these are supposed to be new blurts, that kind of breaks the whole site:
"SELECT Blurt.Id_blurt, Blurt.Name, Blurt.Location, Blurt.Blurt,Blurt.`Date`,DATE_FORMAT(Blurt.`Date`, '%l:%i %p on %M %D, %Y') as Date, ratings.rating_id, Avg(ratings.rating_value) as average_r FROM ratings Left Join Blurt On ratings.rating_id = Blurt.Id_blurt Group By Id_blurt ORDER BY Blurt.`Date` DESC";
So I replaced it with what I originally had.
"SELECT Blurt.Id_blurt, Blurt.Name, Blurt.Location, Blurt.Blurt,Blurt.`Date`,DATE_FORMAT(Blurt.`Date`, '%l:%i %p on %M %D, %Y') as Date FROM Blurt ORDER BY Blurt.`Date` DESC";
But this doesn't provide me with the initial average rating:(
Maybe you are looking for
-
Someone knows about an example on splitting a message into several messages (multiline element), the target message type is of one type.
-
A complaint about Visonic (technical support in Spain)
Good morning. Last year, on December 21, I bought my Lenovo B560-M489MSP from a virtual store called TiendaTR. On April 16, my laptop stopped working. On April 18, I sent my Lenovo to Visonic technical service. On April 20, Visonic detected the mothe
-
Preview full screen mode/slideshow is great, except one thing
As an owner of a 13 inch screen Macbook Air, I love the full screen slideshow mode. It's especially cool to page through a PDF with the three-fingered side swipe motion. But one annoyance is that every time I go into full screen mode with a PDF, I ha
-
Is anyone experiencing framed edges around text and vector art work after creating a PDF of the Indesign work? It only show up on the PDF and not on the Indesign file. Im running CS3, MAC 10.4.11 Thanks, -Z
-
Sync ipod classic with itune library
Why won't my ipod classic sync with my entire library on my MacBook Pro?