Error TSV_TNEW_BLOCKS_NO_ROLL_MEMORY when reading into internal table
Hello guys,
below are snippets of my code and when its goes into the select statement, i get this error TSV_TNEW_BLOCKS_NO_ROLL_MEMORY. Do you have any idea what went wrong? here are the table declaration and select statement.
BEGIN OF ty_instfact,
ucinstalla TYPE
/bi0/oiucinstalla,
ucoperand TYPE
/bi0/oiucoperand,
ucop_str1 TYPE /bi0/oiucop_str1,
END OF ty_instfact
DATA : i_instfact TYPE STANDARD TABLE OF ty_instfact.
SELECT ucinstalla ucoperand ucop_str1
FROM /bic/azinf_d0100
INTO TABLE i_instfact
FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE ucinstalla EQ RESULT_PACKAGE-ucinstalla
AND ucinstalla > 0
AND ucoperand = 'E-NSRD'
OR ucoperand = 'G-NSRD'.
Hello All,
SAP came back to me regarding this issue. There are only way to eliminate this error is to:
- use InfoSet rather than JOIN
- increase Extended Memory or Heap Memory for Background WP.
We have doubled the memory per process (4-->8GB) and it works fine now.
Kind regards,
Roman
Similar Messages
-
Performance Issue When Read from Internal Table
In my form, I have 6 windows which contain all the header information, which are kept in my gt_header internal table. Since all windows required data from the same internal table, reading the internal table at Initialization for once or, creating the LOOP at each window, which one will be a better choice in terms of performance?
Hi,
you cannot create 6 windows under loop.You can only have loop under a window only.
So create a big window which covers whole area of 6 windows.Create templete under that and write only one loo with text in all those boxes of that templete.
Regards,
Rock. -
Error converting CSV file into internal table
Hi,
I have to convert a large CSV file (>20.000 entries) into an internal table. I used FM GUI_UPLOAD to get a raw data table then convert this table using FM TEXT_CONVERT_CSV_TO_SAP.
But this does not seem to work properly: after 16.000 or so, the FM seems stuck as if in an endless loop.
Note that if I split the CSV file in several parts, the conversion runs successfully.
Is there any memory limit with this FM ?
Thanks,
FlorianFlorian Labrouche,
Instead of using two function modules, you can use 'TEXT_CONVERT_XLS_TO_SAP' function module once by specifying file name in that function module itself. It does not take much time.
Check the sample program.
report zvenkat-upload-xl no standard page heading.
"Declarations.
"types
types:
begin of t_bank_det,
pernr(8) type c,
bnksa(4) type c,
zlsch(1) type c,
bkplz(10) type c,
bkort(25) type c,
bankn(18) type c,
end of t_bank_det.
"work areas
data:
w_bank_det type t_bank_det.
"internal tables
data:
i_bank_det type table of t_bank_det.
" selection-screen
selection-screen begin of block b1 with frame title text_001.
parameters p_file type localfile.
selection-screen end of block b1.
"At selection-screen on value-request for p_file.
at selection-screen on value-request for p_file.
perform f4_help.
"Start-of-selection.
start-of-selection.
perform upload_data.
"End-of-selection.
end-of-selection.
perform display_data.
"Form f4_help
form f4_help .
data:
l_file_name like ibipparms-path .
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
importing
file_name = l_file_name.
p_file = l_file_name.
endform. " f4_help
"Form upload_data
form upload_data .
type-pools:truxs.
data:li_tab_raw_data type truxs_t_text_data.
data:l_filename like rlgrap-filename.
l_filename = p_file.
call function 'TEXT_CONVERT_XLS_TO_SAP'
exporting
i_tab_raw_data = li_tab_raw_data
i_filename = l_filename
tables
i_tab_converted_data = i_bank_det
exceptions
conversion_failed = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " upload_data
" Form display_data
form display_data .
data: char100 type char100.
loop at i_bank_det into w_bank_det .
if sy-tabix = 1.
write w_bank_det.
write / '------------------------------------------------------------'.
else.
write / w_bank_det.
endif.
endloop.
endform. " display_data
Regards,
Venkat.O -
How to merge All text fiels into 1 text file to read into internal table
Hi dudes,
I have 3 text files in workstation. I need to everytime download these files in my internal table .
But it takes long processing time .ie everytime it opens file read and close.
Do u suggest for better performance for this? Like how i can meage all txt files in 1 txt file and then read once ito internal table.
Hope i m clear to explain u my requirement.
Gain PointsIt actually depends on your requirement(a standard answer from any SAP guy).
Coming back to the question at hand:
a) Can we merge these files ? My question to you :
i) Are you downloading these to your presentation server from application server using WS_DOWNLOAD(I am using 4.5B) or CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD ?
ii) What holds you back ?
b) How do we parse multiple files contained in a single file ?
Keep a delimiter which is unique only for file endings. That should do the trick.
Regards,
Subramanian V. -
Read info about files in specific folder into internal table
Hi Experts
I need to have last modified date and filename information read into an internal table. I need to read in the information of all files in a specific (UNIX) folder (I do not know the name of the single files).
I really hope someone can help.
Thanks a lot
Kind regards,
TorbenHi Guys
Thanks a lot for you input.
I managed to get my program to works as follows:
REPORT ZDELETE_ARCHIVING_FILES.
*Step 1: Get the list of files in the directory into internal table :
DATA: DLIST LIKE EPSFILI OCCURS 0 WITH HEADER LINE,
DPATH LIKE EPSF-EPSDIRNAM,
MDATE LIKE SY-DATUM,
MTIME LIKE SY-UZEIT.
DATA: BEGIN OF FATTR OCCURS 0,
FILE_NAME LIKE EPSF-EPSFILNAM,
FILE_SIZE LIKE EPSF-EPSFILSIZ,
FILE_OWNER LIKE EPSF-EPSFILOWN,
FILE_MODE LIKE EPSF-EPSFILMOD,
FILE_TYPE LIKE EPSF-EPSFILTYP,
FILE_MTIME(12),
END OF FATTR.
DATA: P_PATH(50) TYPE C.
CONCATENATE '/ARCHIVE/' sy-sysid '/archive' INTO P_PATH.
* WRITE: / P_PATH.
DPATH = P_PATH.
*Get files in folder - read into internal table DLIST
*if filenames are longer than 40 characters
*then use FM SUBST_GET_FILE_LIST.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
DIR_NAME = DPATH
TABLES
DIR_LIST = DLIST
EXCEPTIONS
INVALID_EPS_SUBDIR = 1
SAPGPARAM_FAILED = 2
BUILD_DIRECTORY_FAILED = 3
NO_AUTHORIZATION = 4
READ_DIRECTORY_FAILED = 5
TOO_MANY_READ_ERRORS = 6
EMPTY_DIRECTORY_LIST = 7
OTHERS = 8.
IF SY-SUBRC EQ 0.
*Step 2: Read the file attributes into an internal table
*Read info about the files (attributes) into the internal table FATTR
*as we need info about the last time it was changed (MTIME)
LOOP AT DLIST.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
FILE_NAME = DLIST-NAME
DIR_NAME = DPATH
IMPORTING
FILE_SIZE = FATTR-FILE_SIZE
FILE_OWNER = FATTR-FILE_OWNER
FILE_MODE = FATTR-FILE_MODE
FILE_TYPE = FATTR-FILE_TYPE
FILE_MTIME = FATTR-FILE_MTIME
EXCEPTIONS
READ_DIRECTORY_FAILED = 1
READ_ATTRIBUTES_FAILED = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
FATTR-FILE_NAME = DLIST-NAME.
APPEND FATTR.
ENDIF.
ENDLOOP.
SORT FATTR BY FILE_NAME.
DATA: time(10), date LIKE sy-datum.
DATA: months TYPE i.
DATA: e_file TYPE string.
LOOP AT FATTR.
CLEAR: time, months, e_file.
IF FATTR-FILE_NAME(10) = 'archive_BW'.
*Convert the unix time into readable time
PERFORM p6_to_date_time_tz(rstr0400) USING FATTR-FILE_MTIME
time
date.
*Calculate the number of months between date (MTIME) and current day
*ex 31.03.2009 - 01.04.2009 = 1 month
*ex 01.02.2009 - 01.04.2009 = 2 month
CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_von = date
i_datum_bis = sy-datum
IMPORTING
e_monate = months.
CONCATENATE DPATH '/' FATTR-FILE_NAME INTO e_file.
* WRITE: / FATTR-FILE_NAME,
* FATTR-FILE_SIZE,
* date,
* time,
* sy-datum,
* months,
* e_file.
*Step 3: Delete files where months > 1
IF months > 1.
OPEN dataset e_file for output in text mode encoding default.
DELETE dataset e_file.
CLOSE dataset e_file.
ENDIF. "months > 1
ENDIF.
ENDLOOP.
ENDIF. -
Error while reading excel file from application server into internal table.
Hi experts,
My requirement is to read an excel file from application server into internal table.
Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).
Now in my program I have used :
OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
DO.
READ DATASET v_filename INTO wa_tab.
The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.
Error details:
A character set conversion is not possible.
At the conversion of a text from codepage '4110' to codepage '4103':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 445. If this number is 0, the second error case, as
mentioned above, has occurred.
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
caught and
therefore caused a runtime error.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4103' is not known to the system.
If the conversion error occurred at read or write of screen, the file
name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about
the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")
Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .
Regards,
KarthikHi,
Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
As I think you are uploading the file in BIN format to Application server and trying to open text file.
Regards,
Umang Mehta -
Error while downloading data from internal table into XML file
hi all,
i developed a program to download data from into internal table to xml file like this.
tables: mara.
parameters: p_matnr like mara-matnr.
data: begin of itab_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
aenam like mara-aenam,
vpsta like mara-vpsta,
end of itab_mara.
data: lv_field_seperator type c, " value 'X',
lv_xml_doc_name(30) type c, " string value my xml file,
lv_result type i.
lv_field_seperator = 'x'.
lv_xml_doc_name = 'my xml file'.
types: begin of truxs_xml_line,
data(256) type x,
end of truxs_xml_line.
types:truxs_xml_table type table of truxs_xml_line.
data:lv_tab_converted_data type truxs_xml_line,
lt_tab_converted_data type truxs_xml_table.
data: lv_xml_file type rlgrap-filename value 'c:\simp.xml'.
select matnr ernam aenam vpsta from mara into table itab_mara up to 5
rows where matnr = p_matnr.
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = lv_field_seperator
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
I_XML_DOC_NAME = lv_xml_doc_name
IMPORTING
PE_BIN_FILESIZE = lv_result
TABLES
I_TAB_SAP_DATA = itab_mara
CHANGING
I_TAB_CONVERTED_DATA = lt_tab_converted_data
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
open dataset lv_xml_file for output in binary mode.
loop at lt_tab_converted_data into lv_tab_converted_data.
transfer lv_tab_converted_data to lv_xml_file.
endloop.
close dataset lv_xml_file.
this program is syntactically correct and getting executed, but when i open the target xml file it is showing the following error.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
XML document must have a top level element. Error processing resource 'file:///C:/simp.xml'.
will anyone show me the possible solution to rectify this error
thanks and regards,
anil.Hi,
Here is a small sample program to convert data in an internal table into XML format and display it.
DATA: itab TYPE TABLE OF spfli,
l_xml TYPE REF TO cl_xml_document.
* Read data into a ITAB
SELECT * FROM spfli INTO TABLE itab.
* Create the XML Object
CREATE OBJECT l_xml.
* Convert data in ITAB to XML
CALL METHOD l_xml->create_with_data( name = 'Test1'
dataobject = t_goal[] ).
* Display XML Document
CALL METHOD l_xml->display.
Here are some other sample SAP programs to handle XML in ABAP:
BCCIIXMLT1, BCCIIXMLT2, and BCCIIXMLT3.
Hope this helps,
Sumant. -
Error in uploading excel sheet data into internal table
Dear all,
i am facing problem when uploading data from excel. i used KD_GET_FILENAME_ON_F4.i select the file and pass on to ALSM_EXCEL_INTO_INTERNAL_TABLE.and i get the ERROR....
Illegal type when transferring an internal table to a FORM. this is my code .
types : begin of ty_mm01,
matnr like rmmg1-matnr,
mbrsh like rmmg1-mbrsh,
mtart like rmmg1-mtart,
maktx like makt-maktx,
meins like mara-meins,
matkl like mara-matkl,
bismt like mara-bismt,
spart like mara-spart,
mtpos like mara-mtpos_mara,
end of ty_mm01.
data : tt_mm01 type standard table of ty_mm01,
wa_mm01 like TT_MM01.
data : t_bdcdata like standard table of bdcdata,
t_bdcmsgcoll like standard table of bdcmsgcoll.
constants: begcol TYPE i value 1 ,
begrow TYPE i value 1,
endcol TYPE i value 100,
endrow TYPE i value 32000.
selection-screen : begin of block bdc with frame.
parameter : tfile like rlgrap-filename obligatory.
selection-screen : end of block bdc.
at selection-screen on value-request for tfile.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = 'ZMM_MAT_MAS_BASIC_DATA'
DYNPRO_NUMBER = '1000'
FIELD_NAME = 'TFILE'
STATIC = 'X'
MASK = ',*.xls,'
CHANGING
FILE_NAME = tfile
start-of-selection.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = tfile
I_BEGIN_COL = begcol
I_BEGIN_ROW = begrow
I_END_COL = endcol
I_END_ROW = endrow
TABLES
INTERN = tt_mm01
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks in advanceHi,
Check these FM : KCD_EXCEL_OLE_TO_INT_CONVERT
Report ZPSP_TEST.
data: bdc_DATA like bdcdata occurs 0 with header line,
mess_tab like bdcmsgcoll occurs 0 with header line.
DATA: BEGIN OF ITAB OCCURS 0 ,
tcnt TYPE i, "Table Counter &H0D
WERKS LIKE T001W-WERKS,
BNFPO LIKE EBAN-BNFPO,
MATNR LIKE MARA-MATNR,
MENGE LIKE EBAN-MENGE,
END OF ITAB.
start-of-selection.
PERFORM upload_data.
loop at itab.
perform bdc_dynpro using 'SAPMM06B' '0100'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-BSART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-BSART'
'NB'.
perform bdc_field using 'RM06B-LPEIN'
'T'.
perform bdc_field using 'EBAN-WERKS'
ITAB-WERKS.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RM06B-EKGRP'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RM06B-BNFPO'
ITAB-BNFPO.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-MATNR(01)'
ITAB-MATNR.
perform bdc_field using 'EBAN-MENGE(01)'
ITAB-MENGE.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'RM06B-EEIND'
record-EEIND_010.
*perform bdc_field using 'RM06B-LPEIN'
record-LPEIN_011.
*perform bdc_field using 'EBAN-EKGRP'
record-EKGRP_012.
*perform bdc_field using 'EBAN-BADAT'
record-BADAT_013.
*perform bdc_field using 'EBAN-FRGDT'
record-FRGDT_014.
*perform bdc_field using 'EBAN-PREIS'
record-PREIS_015.
*perform bdc_field using 'EBAN-WAERS'
record-WAERS_016.
*perform bdc_field using 'EBAN-PEINH'
record-PEINH_017.
*perform bdc_field using 'EBAN-REPOS'
record-REPOS_018.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'RM06B-BNFPO'
record-BNFPO_019.
*perform bdc_field using 'EBAN-MATNR(02)'
record-MATNR_02_020.
*perform bdc_field using 'EBAN-MENGE(02)'
record-MENGE_02_021.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'EBAN-MENGE'
ITAB-MENGE_023.
*perform bdc_field using 'RM06B-EEIND'
record-EEIND_024.
*perform bdc_field using 'RM06B-LPEIN'
record-LPEIN_025.
*perform bdc_field using 'EBAN-EKGRP'
record-EKGRP_026.
*perform bdc_field using 'EBAN-BADAT'
record-BADAT_027.
*perform bdc_field using 'EBAN-FRGDT'
record-FRGDT_028.
*perform bdc_field using 'EBAN-PREIS'
record-PREIS_029.
*perform bdc_field using 'EBAN-WAERS'
record-WAERS_030.
*perform bdc_field using 'EBAN-PEINH'
record-PEINH_031.
*perform bdc_field using 'EBAN-REPOS'
record-REPOS_032.
perform bdc_field using 'EBAN-TXZ01'
'BEARING 2"X2"'.
perform bdc_field using 'EBAN-MENGE'
'65'.
perform bdc_field using 'RM06B-EEIND'
'2005/01/03'.
perform bdc_field using 'RM06B-LPEIN'
'D'.
perform bdc_field using 'EBAN-EKGRP'
'M11'.
perform bdc_field using 'EBAN-BADAT'
'2005/01/03'.
perform bdc_field using 'EBAN-FRGDT'
'2005/01/03'.
perform bdc_field using 'EBAN-PREIS'
' 1,120.00'.
perform bdc_field using 'EBAN-WAERS'
'EUR'.
perform bdc_field using 'EBAN-PEINH'
'1'.
perform bdc_field using 'EBAN-REPOS'
'X'.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-TXZ01'
'DRILLING PIPE 10"'.
perform bdc_field using 'EBAN-MENGE'
'75'.
perform bdc_field using 'RM06B-EEIND'
'2005/01/03'.
perform bdc_field using 'RM06B-LPEIN'
'D'.
perform bdc_field using 'EBAN-EKGRP'
'M11'.
perform bdc_field using 'EBAN-BADAT'
'2005/01/03'.
perform bdc_field using 'EBAN-FRGDT'
'2005/01/03'.
perform bdc_field using 'EBAN-PREIS'
' 0.53'.
perform bdc_field using 'EBAN-WAERS'
'EUR'.
perform bdc_field using 'EBAN-PEINH'
'1'.
perform bdc_field using 'EBAN-REPOS'
'X'.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RM06B-BNFPO'
perform bdc_field using 'BDC_OKCODE'
'&H3DBU'.
*perform bdc_field using 'RM06B-BNFPO'
CALL TRANSACTION 'ME51' USING BDC_DATA MODE 'A'.
endLOOP.
FORM upload_data.
*local variable declaration
DATA : lv_index TYPE i,
l_count TYPE i.
*local constants declaration
CONSTANTS:
lc_start_col TYPE i VALUE '1' ,
lc_start_row TYPE i VALUE '2' ,
lc_end_col TYPE i VALUE '256' ,
lc_end_row TYPE i VALUE '65536'.
*local field symbol declaration
FIELD-SYMBOLS : <lf_s>.
*loacal internal table declaration
DATA : li_intern TYPE kcde_cells OCCURS 0 WITH HEADER LINE.
*refresh internal table for each loop
CLEAR: li_intern,
l_count .
REFRESH li_intern.
to upload the data in excel on the presentation server this function
module converts the data from excel file into an internal table
containing row no col no and value
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename &H3D 'Give file location here'
i_begin_col &H3D lc_start_col
i_begin_row &H3D lc_start_row
i_end_col &H3D lc_end_col
i_end_row &H3D lc_end_row
TABLES
intern &H3D li_intern
EXCEPTIONS
inconsistent_parameters &H3D 1
upload_ole &H3D 2.
checking for data in internal table
CHECK NOT li_intern[] IS INITIAL.
sorting internal table
SORT li_intern BY row col.
collecting data into an internal table
LOOP AT li_intern.
MOVE: li_intern-col TO lv_index.
lv_index &H3D lv_index + 1.
ASSIGN COMPONENT lv_index OF STRUCTURE itab TO <lf_s>.
MOVE : li_intern-value TO <lf_s>.
AT END OF row.
l_count &H3D l_count + 1.
itab &H3D l_count.
APPEND itab.
ENDAT. " at end of row
ENDLOOP. " loop at li_intern
Reg,
Siva
Edited by: Siva Prasad on Jun 1, 2009 8:41 AM
Edited by: Siva Prasad on Jun 1, 2009 4:25 PM -
Error "Error in ABAP statement when processing an internal table. table."
Hello,
I am facing the error when tried for GR from SRM portal for my shopping cart and for others created shopping cart. The error is
"Error in ABAP statement when processing an internal table. table."
I have the central receipient role. Couold any body assist me?
Thanks,
PijushHi Harish,
Execute the query in RSRT and check whether you have any short dump is in ST22. This would give a clear idea at what might have gone wrong.
Another thing is to check whether the code for the variable is fine in the user exit.
Hope this helps.
Bye
Dinesh -
Question about reading csv file into internal table
Some one (thanks those nice guys!) in this forum have suggested me to use FM KCD_CSV_FILE_TO_INTERN_CONVERT to read csv file into internal table. However, it can be used to read a local file only.
I would like to ask how can I read a CSV file into internal table from files in application server?
I can't simply use SPLIT as there may be comma in the content. e.g.
"abc","aaa,ab",10,"bbc"
My expected output:
abc
aaa,ab
10
bbb
Thanks again for your help.Hi Gundam,
Try this code. I have made a custom parser to read the details in the record and split them accordingly. I have also tested them with your provided test cases and it work fine.
OPEN DATASET dsn FOR input IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET dsn INTO record.
PERFORM parser USING record.
ENDDO.
*DATA str(32) VALUE '"abc",10,"aaa,ab","bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"bbc"'.
*DATA str(32) VALUE '"a,bc","aaaab",10,"bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"b,bc"'.
*DATA str(32) VALUE '"abc","aaaab",10,"bbc"'.
FORM parser USING str.
DATA field(12).
DATA field1(12).
DATA field2(12).
DATA field3(12).
DATA field4(12).
DATA cnt TYPE i.
DATA len TYPE i.
DATA temp TYPE i.
DATA start TYPE i.
DATA quote TYPE i.
DATA rec_cnt TYPE i.
len = strlen( str ).
cnt = 0.
temp = 0.
rec_cnt = 0.
DO.
* Start at the beginning
IF start EQ 0.
"string just ENDED start new one.
start = 1.
quote = 0.
CLEAR field.
ENDIF.
IF str+cnt(1) EQ '"'. "Check for qoutes
"CHECK IF quotes is already set
IF quote = 1.
"Already quotes set
"Start new field
start = 0.
quote = 0.
CONCATENATE field '"' INTO field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
CONDENSE field.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
* WRITE field.
ELSE.
"This is the start of quotes
quote = 1.
ENDIF.
ENDIF.
IF str+cnt(1) EQ ','. "Check end of field
IF quote EQ 0. "This is not inside quote end of field
start = 0.
quote = 0.
CONDENSE field.
* WRITE field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CONCATENATE field str+cnt(1) INTO field.
cnt = cnt + 1.
IF cnt GE len.
EXIT.
ENDIF.
ENDDO.
WRITE: field1, field2, field3, field4.
ENDFORM.
Regards,
Wenceslaus. -
Read DMS document into internal table
Hi,
I have a requirement to read DMS document in binary format into internal table.
and i want to print the data in internal table through SAP spool.
Please let me know how to handle this requirement.
Thanks
SriniHi,
Check scms pakage, FG - SCMS_CONV for conversions..
Regards
Surjit -
Read Application server file and upload into internal table
Another help needed guys,
My file in the application server is of format
Name Marks 1 Marks 2 Marks 3............
A 10 15 20
The only thing separating the columns is space.
Actually this file was downloaded from an internal table into the app server.
Now I want to load it back into the internal table.
How do I load this into internal table so that each column goes in separate internal table field.
Currently am using cl_abap_char_utilities=>HORIZONTAL_TAB but I can get only the first column name in my field1 of the internal table.
How should I applroach this?
Points will be awarded for useful answers.
Regards
AnkitHi ankit,
i think u have uploaded the tab delimited file in the application sever.
then suppose see if u r file is in the format of name#marks1#marks2#marks3.
then in the program u do like this..
first declare one internal table with one filed.
data:
c_hextab(1) TYPE x VALUE '09'.
data:
begin of t_data occurs 0,
line(256) type c,
endof t_data.
and declare one more intternal table
data:
begin of t_itab occurs 0,
name(15) type c,
marks1(4) type c,
marks2(4) type c,
marks3(4) type c,
endof t_itab.
then
open the file with
OPEN DATASET p_file FOR INPUT IN TEXT MODE.
then between do and endo do like this..
DO.
clear t_data.
READ DATASET p_file INTO t_data.
if sy-subrc ne 0.
exit.
else.
split t_data at c_hextab
into t_itab-name
t_itab-marks1
t_itab-marks2
t_itab-marks3.
append t_itab.
endif.
enddo.
i think it will be helpful to u
Please let me know wht type of file has been uploaded into application server.(tab deleimted, comma separated or something else).
Regards,
Sunil Kumar Mutyala. -
Read local folder, return filenames into internal table
Assume I have 3 files in c:\abc folder:
a1.xls
a2.xls
a6.xls
Is there a fm or code sample to pass in folder name (ie c:\abc) and returns a1.xls, a2.xls and a6.xls into internal table?Use Class CL_GUI_FRONTEND_SERVICES Method DIRECTORY_LIST_FILES to get list of file in a folder . FILE_TABLE will give the table with list of files
data: begin of itab ,
file(26) type c,
end of itab.
data: tab type table of itab.
data : cnt type i.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = 'C:\temp'
* FILTER = '*.*'
* FILES_ONLY =
* DIRECTORIES_ONLY =
CHANGING
FILE_TABLE = tab
COUNT = cnt
* EXCEPTIONS
* CNTL_ERROR = 1
* DIRECTORY_LIST_FILES_FAILED = 2
* WRONG_PARAMETER = 3
* ERROR_NO_GUI = 4
* NOT_SUPPORTED_BY_GUI = 5
* others = 6
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Issue with uploading XML file from application server into internal table
i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module SMUM_XML_PARSE and the error message is "line 1 col 1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?
TYPES: BEGIN OF T_XML,
raw(2000) TYPE C,
END OF T_XML.
DATA:GW_XML_TAB TYPE T_XML.
DATA: GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
DATA:GI_STR TYPE STRING.
data: GV_XML_STRING TYPE XSTRING.
DATA: GI_XML_DATA TYPE TABLE OF SMUM_XMLTB INITIAL SIZE 0.
data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'File does not exist' TYPE 'E'.
ELSE.
DO.
* Transfer the contents from the file to the work area of the internal table
READ DATASET LV_FILE1 INTO GW_XML_TAB.
IF SY-SUBRC EQ 0.
CONDENSE GW_XML_TAB.
* Append the contents of the work area to the internal table
APPEND GW_XML_TAB TO GI_XML_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
* Close the file after reading the data
CLOSE DATASET LV_FILE1.
IF NOT GI_XML_TAB IS INITIAL.
CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
ENDIF.
* The function module is used to convert string to xstring
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = GI_STR
IMPORTING
BUFFER = GV_XML_STRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE 'Error in the XML file' TYPE 'E'.
ENDIF.
ENDIF.
IF GV_SUBRC = 0.
* Convert XML to internal table
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
XML_INPUT = GV_XML_STRING
TABLES
XML_TABLE = GI_XML_DATA
RETURN = GI_RETURN.
ENDIF.
READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
IF SY-SUBRC EQ 0.
MESSAGE 'Error converting the input XML file' TYPE 'E'.
ELSE.
DELETE GI_XML_DATA WHERE TYPE <> 'V'.
REFRESH GI_RETURN.
ENDIF.Could you please tel me why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
Becuase there will be lot of XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?> ??????
Is there any other way we can do with out removing the lines? -
Error in xml to abap internal table transformation using xslt_tool
Hi friends,
When i am trying to convert xml data into internal table it is going to dump because of empty elements. Can any body help to delete the empty tags from xml before processing through xslt_tool.
example
<Activity>
<ID>add12095</ID>
<Start>09/01/2014 12:01</Start>
<Type>3</Type>
<Code>99202</Code>
<Quantity>1</Quantity>
<Net>244</Net>
<Clinician>GD16130</Clinician>
<PriorAuthorizationID/> "empty tag
<Gross>294</Gross>
<PatientShare>50</PatientShare>
<PaymentAmount>244</PaymentAmount>
</Activity>
the empty element some times will come in the xml and some times not. so i made a check in xslt. when this empty element tag processed through that condition i am getting the dump. either i need to remove the condition or we should delete the empty tags before processing. Removing of if condition is not possible because that element may or may not come all the time.
Regards,
Rajesh.You can replace all empty tags using regular expression.
REPLACE ALL OCCURRENCES OF REGEX '<\w+/>' IN lv_xml WITH ''.
Maybe you are looking for
-
Mail forgets passwords, possibly due to error in the Keychain
Hello, I just sent my MBP with Leopard to service, now I am sticking around with my old 12" PB and Tiger. I did a complete sync via MobileMe, including passwords on both devices. Unfortunately, Mail in Tiger does not seem to have access to the Passwo
-
Reinstall app from creative cloud
How can I reinstall app from creative cloud if I removed this app by accident? I've tried all options that are suggested on the official site, but still no good.
-
Help with syncing iPhone to new computer
I have a PC and it crashed a month ago. I have an external hardrive that I saved my data too, but it hadn't been updated since I got the iPhone. If I plug my iPhone into the new PC and sync it will I lose all the date or will it all transfer from the
-
how come my contacts only show up on icloud.com and not in my back up?
-
Im using Win98, j2ee 1.3.1 and jdk1.3. I modified the .bat files to work also under Win98, but i still had an error when i execute "j2ee -verbose": after the server has binded to the local port 1050 i get this error in the logs file system.err: java.