Splitting Large internal tables
Hi All,
How to split large internal table into smaller ones of fixed number of lines.
The total number of lines are not known and is subjected to vary.
Regards,
Naba
I am not sure about your requirements, you try with the below solution
Itab : contains all entries let us say 3000
Itab1
itab2
itab3
No.of entries to be split based on 3000/n ( 3000/3) = 1000
split_val = 1000
N_split_from = 1
N_split_to = 1000
APPEND LINES OF ITAB1 FROM N_split_from TO N_split TO ITAB1.
N_split_from = 1 + split_val
N_split_to = 1000 + split_val
APPEND LINES OF ITAB1 FROM N_split_from TO N_split TO ITAB2.
N_split_from = 1 + split_val
N_split_to = 1000 + split_val
APPEND LINES OF ITAB1 FROM N_split_from TO N_split TO ITAB3.
Regards
Sasi
Similar Messages
-
Splitting a large internal table.......
Hi all,
i want to split an internal table of say 1,00,000 entries into 10 internal tables having 10,000 each....
is there a way to move say first 20,000 entries from one internal table to another...based on index...
Thanks in advance,,,
Best Regards,
Sushil.for example <itab>this holds 100 records.
itab1[] = itab[]
delete itab1 from 10 to 100.
itab2[] = itab[]
delete itab2 from 20 to 100
delete itab2 from 1 to 10
itab3[] = itab[]
goes on
itab4[] = itab[]
itab5[] = itab[]
itab6[] = itab[]
itab7[] = itab[]
itab9[] = itab[]
Edited by: Anbu B on Jun 6, 2008 1:56 PM
Edited by: Anbu B on Jun 6, 2008 2:12 PM
this will help u lot...........
Reward IF.................
Regards
Anbu
Edited by: Anbu B on Jun 6, 2008 2:12 PM -
Splitting the internal table values
I have a internal table with say 10000 lines i want to split it as 5000 and 5000 lines.How to code it?
Moderator message: please try solving this yourself before asking, e.g. by studying the options of the LOOP statement.
Edited by: Thomas Zloch on Nov 24, 2010 4:20 PMe.g.:
loop at itab.
add 1 to count.
if count <= 500.
move-corresponding itab to itab2.
collec titab2.
else.
move-corresponding itab to itab3.
collec titab3.
endloop. -
How to process very large internal tables and stop time limit
Hello Experts,
I am currently having a problem on how to fix a certain report where we process more than 500 thousand
records in the internal table. I can't think of any solution that can make the below code any faster.
I just checked in our prod server and the error time limit exceeded stops in the loop statement. Anyway,
Below is the code. Any input will be appreciated. Thanks guys and take care!
Get sales document and corresponding line item
SELECT avbeln bposnr a~auart
avkorg avtweg a~kunnr
bmatnr bpstyv b~spart
FROM vbak AS a
INNER JOIN vbap AS b
ON avbeln = bvbeln
APPENDING TABLE lt_vbap
WHERE a~auart IN lr_auart
AND a~vbeln IN s_vbeln
AND a~vbeln IN s_vbill
AND a~vbtyp EQ p_vbtyp.
LOOP AT lt_vbap ASSIGNING <wa_vbap>.
IF <wa_vbap>-auart EQ 'ZUCI' OR
<wa_vbap>-auart EQ 'ZURV' OR
<wa_vbap>-auart EQ 'ZUPR'.
Check ifa delivery document has been created
CLEAR wa_vbill.
SELECT SINGLE vbeln
FROM vbfa
INTO wa_vbill
WHERE vbelv = <wa_vbap>-vbeln
AND ( ( vbtyp_n EQ 'J' AND vbtyp_v = 'C' )
OR ( vbtyp_n EQ 'T' AND vbtyp_v = 'H' ) ).
IF sy-subrc <> 0.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ELSE.
Check if within selection parameters
CLEAR wa_likp.
READ TABLE lt_likp INTO wa_likp WITH KEY vbeln = wa_vbill.
IF sy-subrc <> 0.
SELECT SINGLE *
FROM likp
INTO wa_likp
WHERE vbeln = wa_vbill.
APPEND wa_likp TO lt_likp.
ENDIF.
IF NOT wa_likp-wadat_ist IN s_erdat.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ENDIF.
ELSE.
Check if this has already been billed
CLEAR wa_vbill.
SELECT SINGLE vbeln
FROM vbfa
INTO wa_vbill
WHERE vbelv = <wa_vbap>-vbeln
AND ( ( vbtyp_n EQ 'M' AND vbtyp_v = 'C' )
OR ( vbtyp_n EQ 'O' AND vbtyp_v = 'H' ) ).
IF sy-subrc <> 0.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ELSE.
Check if within selection parameters
CLEAR wa_vbrk.
READ TABLE lt_vbrk INTO wa_vbrk WITH KEY vbeln = wa_vbill.
IF sy-subrc <> 0.
SELECT SINGLE vbeln fkdat
FROM vbrk
INTO wa_vbrk
WHERE vbeln = wa_vbill.
APPEND wa_vbrk TO lt_vbrk.
ENDIF.
IF NOT wa_vbrk-fkdat IN s_erdat.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ENDIF.
ENDIF.
Get Material Type and Division
IF <wa_vbap>-spart IS NOT INITIAL.
SELECT SINGLE mtart
FROM mara
INTO lv_mtart
WHERE matnr = <wa_vbap>-matnr.
ELSE.
SELECT SINGLE mtart spart
FROM mara
INTO (lv_mtart,<wa_vbap>-spart)
WHERE matnr = <wa_vbap>-matnr.
ENDIF.
If material division is same as parameter division
IF <wa_vbap>-spart = p_spart.
If material is subsidiary-owned
IF <wa_vbap>-spart in lr_spart.
If customer is the same as that of parameter division
IF <wa_vbap>-kunnr NE lr_kunnr OR <wa_vbap>-auart EQ 'ZUDO' OR <wa_vbap>-auart EQ 'ZUS3'.
If item is a free good, tag order type as 'ZUPR' to treat
the item the same way as 'ZUPR'
IF <wa_vbap>-pstyv = 'TANN' OR
<wa_vbap>-pstyv = 'ZKNF' OR
<wa_vbap>-pstyv = 'ZKNN' OR
<wa_vbap>-pstyv = 'ZFLO' OR
<wa_vbap>-pstyv = 'ZKBF' OR
<wa_vbap>-pstyv = 'ZKLN' OR
<wa_vbap>-pstyv = 'ZREN'.
lv_auart = <wa_vbap>-auart.
IF lv_auart EQ 'ZUPR'.
CLEAR <wa_vbap>-pstyv.
ENDIF.
<wa_vbap>-auart = 'ZUPR'.
CLEAR: lv_mtart.
ENDIF.
Set Cost of Goods Sold Account
<wa_vbap>-cogshkont = '0050000010'.
CASE <wa_vbap>-auart.
WHEN 'ZUPR'.
CASE lv_mtart.
WHEN 'ZUL4'.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
WHEN OTHERS.
Check if division is defined in mapping table
READ TABLE lt_ulsub INTO wa_ulsub
WITH KEY spart = <wa_vbap>-spart.
IF sy-subrc = 0.
<wa_vbap>-kostl = wa_ulsub-kostlp.
<wa_vbap>-bukrs = wa_ulsub-bukrsp.
<wa_vbap>-type = 'TP'.
Set Cost of Goods Sold Account
IF lv_auart = 'ZUPR'.
<wa_vbap>-cogshkont = '0050000006'.
ENDIF.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ENDCASE.
WHEN 'ZUCI' OR 'ZUDO' OR 'ZURD' OR 'ZUS3'.
Get cost center from header text
PERFORM get_cost_center USING <wa_vbap>-vbeln
CHANGING <wa_vbap>-kostl.
* Change by LGTE 11-02-2006
Check if Medvale sales
IF <wa_vbap>-auart EQ 'ZUCI' AND <wa_vbap>-kostl IS INITIAL.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
Check if UL Cost Center
ELSEIF <wa_vbap>-kostl NE gv_ul_kostl.
IF <wa_vbap>-kostl NE gv_ul_kostl.
* End change.
Get material division and check if subsidiary product
SELECT SINGLE spart FROM mara INTO <wa_vbap>-spart
WHERE matnr = <wa_vbap>-matnr.
READ TABLE lt_ulsub INTO wa_ulsub
WITH KEY spart = <wa_vbap>-spart.
IF sy-subrc = 0.
Get requestor's company code from cost center data
SELECT SINGLE bukrs
FROM csks
INTO <wa_vbap>-bukrs
WHERE kokrs = lc_kokrs
AND kostl = <wa_vbap>-kostl
AND datbi GE sy-datum
AND datab LE sy-datum.
IF sy-subrc = 0.
For donations, only include if a subsidiary company is donating
IF <wa_vbap>-auart EQ 'ZUDO' OR <wa_vbap>-auart EQ 'ZUS3'.
IF NOT <wa_vbap>-kunnr IN lr_kunnrnt.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
CHECK <wa_vbap>-kunnr IN lr_kunnrnt.
ENDIF.
For ZUCI, if the company code of the costcenter is UL, do not include
IF <wa_vbap>-bukrs EQ gc_ul_bukrs.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
IF <wa_vbap>-bukrs = wa_ulsub-bukrsp.
<wa_vbap>-type = 'RV'.
ELSE.
<wa_vbap>-type = 'RV'.
ENDIF.
ELSE.
Check if customer defined in table ZFI_DONATIONS
SELECT SINGLE kunnr FROM zfi_donations INTO <wa_vbap>-kostl
WHERE kunnr = <wa_vbap>-kostl.
IF sy-subrc <> 0.
lv_error = 'X'.
CONCATENATE 'Cost center/Customer' <wa_vbap>-kostl
'does not exist. Please check Sales Order'
<wa_vbap>-vbeln
INTO lt_disp-message SEPARATED BY space.
lt_disp-type = 'E'.
<wa_vbap>-del_ind = 'X'.
APPEND lt_disp.
CONTINUE.
ELSE.
<wa_vbap>-type = 'RV'.
ENDIF.
ENDIF.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
WHEN OTHERS.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDCASE.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
Get company code description
SELECT SINGLE butxt FROM t001 INTO <wa_vbap>-butxt
WHERE bukrs = <wa_vbap>-bukrs.
IF sy-subrc <> 0.
SELECT SINGLE name1 FROM kna1 INTO <wa_vbap>-butxt
WHERE kunnr = <wa_vbap>-kostl.
ENDIF.
Change by LGTE on 11-02-2006
Get Transaction Type
CASE <wa_vbap>-auart.
WHEN 'ZUPR'. "UL Promo/Samples
IF <wa_vbap>-pstyv = 'TANN' OR
<wa_vbap>-pstyv = 'ZKNF' OR
<wa_vbap>-pstyv = 'ZKNN' OR
<wa_vbap>-pstyv = 'ZFLO' OR
<wa_vbap>-pstyv = 'ZKBF' OR
<wa_vbap>-pstyv = 'ZKLN' OR
<wa_vbap>-pstyv = 'ZREN'.
<wa_vbap>-ltext = 'Free Goods'.
ELSE.
<wa_vbap>-ltext = 'Product Samples'.
ENDIF.
WHEN 'ZUDO'. "Donations - R/3
<wa_vbap>-ltext = 'Donations - R/3'.
WHEN 'ZUCI'. "Donations - ZUCI
<wa_vbap>-ltext = 'Donations - ZUCI'.
WHEN 'ZURD' OR 'ZUS3'. "UL Returns - Donation
<wa_vbap>-ltext = 'UL Returns - Donation'.
ENDCASE.
Get material description
SELECT SINGLE maktx
FROM makt
INTO <wa_vbap>-maktx
WHERE matnr = <wa_vbap>-matnr
AND spras = sy-langu.
Get division from material master
SELECT SINGLE spart FROM mara INTO <wa_vbap>-spart
WHERE matnr = <wa_vbap>-matnr.
Get division description
SELECT SINGLE vtext
FROM tspat
INTO <wa_vbap>-vtext
WHERE spras = sy-langu
AND spart = <wa_vbap>-spart.
Get Valuation Class
SELECT SINGLE bklas
FROM mbew
INTO lv_bklas
WHERE matnr = <wa_vbap>-matnr.
Determine G/L of FG Based on Valuation Class
READ TABLE lt_val_cls INTO wa_val_cls WITH TABLE KEY bklas = lv_bklas.
<wa_vbap>-fghkont = wa_val_cls-hkont.
Determine Cost Center of Cogs Account
READ TABLE lt_ulsub INTO wa_ulsub WITH TABLE KEY spart = <wa_vbap>-spart.
<wa_vbap>-cogskostl = wa_ulsub-kostlp.Hi!
First of all, don't use SELECT SINGLE inside of LOOP,
instead SELECT all relevated rows before LOOP in intertal tables (using FOR ALL ENTRIES) and then use
READ TABLE WITH KEY BINARY SEARCH.
it will match faster.
for example:
IF NOT lt_vbap[] IS INITIAL.
SELECT vbeln
FROM vbfa
INTO lt_vbill
FOR ALL ENTRIES IN lt_vbap
WHERE vbelv = lt_vbap-vbeln.
ENDIF.
SORT lt_vbap BY vbeln.
READ TABLE lt_vbill WITH KEY vbeln = <wa_vbap>-vbeln
BINARY SEARCH. -
Hi,
Good day guys
hope every one doing well.. i have problem with smart form.. I developed the smart form.. Data will be pulling from zprogramme.
in the final internal table is having top 20 customers by branch wise which is 17 branches..
Its like One-by-ne branch data....
In the form level.. i need to desing the data.. Every page should come two branches..
now iam getting the problem.. first page getting Two branches.. but rest of the pages will get the 2 and half branches data like
so... can any one advice me..
regardsHi,
So you can do one thing. Store data for 2 brnaches in one internal table and pass that to fisrt page. then for second page take data for next 2 branches in another internal table and display it.
I think it should solve your problem.
Thanks,
Archana -
Need to Process Large Internal Tables Efficiently
I have two internal tables, T_EKKO(for PO Header data) and T_EKPO(for PO Item data). These tables carry data for 10 PO's with at least 1 line item in each one.
The requirement is to write the following fields on the result screen:
Line 1: PO Number.-
Line 2:PO Item, Article Number.
What is the most efficient way to do this?Hi,
You can use parallel processing techinque..
Ex.
SORT T_EKPO BY EBELN.
DATA: V_TABIX TYPE SYTABIX.
LOOP AT T_EKKO.
WRITE: / 'PO Number - ', T_EKKO-EBELN.
READ TABLE T_EKPO TRANSPORTING NO FIELDS
WITH KEY EBELN = T_EKKO-EBELN
BINARY SEARCH.
IF SY-SUBRC = 0.
Store the row number.
V_TABIX = SY-TABIX.
LOOP AT T_EKPO FROM V_TABIX.
Exit condition.
IF T_EKPO-EBELN <> T_EKKO-EBELN.
EXIT.
ENDIF.
WRITE: / 'PO item', T_EKPO-EBELP.
ENDLOOP.
ENDIF.
ENDLOOP.
Thanks,
Naren -
APDs with large internal tables
Hi Everyone!
I have a problem with APDs where we use several ABAP routine within. When exploding the data to the lowest level we get 10 million lines and there is not enough space to transfer the data between the different ABAP routine. There isn't space enough to extend the internal tables.
We have tried to have several APDs and several transactional ODSs but it will still not work.
Does anyone has an idea how we could solve this issue ?
Thanks a lot in advance.
BjörnHi Ronen!
Sounds like you run out of physical memory and swapping started. If parameters are still the same (allowed memory per session...), then higher system resource requirements of the new release might be the reason of less space for the sessions.
Check the memory situation (ST02?), maybe a serialization of the big programs can give them enough memory to perform in the old way.
Regards,
Christian -
Hi experts,
I have intenal table like...
aa 10 20
bb 11 21
cc 13 30
aa 22 33
bb 45 22
cc 12 22
here i want to add the same record in one line like...
aa 10 20 22 33
bb 11 21 45 22
cc 13 30 12 22
Plese help me........jst copy paste n execute.......
types : begin of ty_tab,
f1 type char2,
f2 type char2,
f3 type char2,
f4 type char2,
f5 type char2,
End of ty_tab.
data : itab type ty_tab occurs 0 with header line.
data : itab1 type ty_tab occurs 0 with header line.
data : var1 type char2.
itab-f1 = 'aa'.
itab-f3 = '10'.
itab-f2 = '20'.
append itab.
itab-f1 = 'bb'.
itab-f3 = '11'.
itab-f2 = '21'.
append itab.
itab-f1 = 'cc'.
itab-f3 = '12'.
itab-f2 = '22'.
append itab.
itab-f1 = 'bb'.
itab-f3 = '11'.
itab-f2 = '21'.
append itab.
itab-f1 = 'aa'.
itab-f3 = '30'.
itab-f2 = '40'.
append itab.
itab-f1 = 'bb'.
itab-f3 = '31'.
itab-f2 = '41'.
append itab.
itab-f1 = 'bb'.
itab-f3 = '32'.
itab-f2 = '42'.
append itab.
sort itab by f1.
loop at itab .
if var1 is initial.
var1 = itab-F1.
itab1-F1 = itab-F1.
itab1-F2 = itab-F2.
itab1-F3 = itab-F3.
Elseif var1 <> itab-F1.
append itab1.
var1 = itab-F1.
itab1-F1 = itab-F1.
itab1-F2 = itab-F2.
itab1-F3 = itab-F3.
Elseif var1 = itab-F1.
itab1-F4 = itab-F2.
itab1-F5 = itab-F3.
endif.
Endloop. -
How to send Internal table records to Idoc Inbound posting FM to create Ido
Hello Experts,
I have all the data necessary to create shipments in one internal table inside my ABAP program.
I can use BAPI_SHIPMENT_CREATE to create shipments. But associated with this BAPi there is one ALE message type SHIPMENT_CREATEFROMDATA. Now my requirement is to use this message type to cretae my shipments via idocs for one scenario for some of the records in the internal table.
For this message type, I got the inbound function module IDOC_INPUT_SHIPMENT_CREATEFROM from TBDBE table.
Can anybody please let me know how to send the data from the internal table to this inbound function module?
Becasue it has mandatory parameters INPUT_METHOD, MASS_PROCESSING. What values should be passed to these parameters if the data has to be sent to this function module?
Regards.Hi Ravikanth,
Thankyou very much for your quick reply.
So If I split my internal table data and populate IDOC_DATA and IDOC_CONTROL and pass to the inbound function module directly in my ABAP program, will that be going to create idocs and post shipments?
I mean is it enough to call the Inbound posting function module directly in my ABAP program or any other FMs to be called to take care of ALE settings and shipment creation?
Please confirm.
REgards. -
Bdc upload file data into internal table problem with gui_upload fm
Hello experts,
my coding is like this ..
data : begin of itab occurs 0 .
field1 like mara-matnr,
field2......
etc,
end of itab.
data: file1 type string.
parameter :file like rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
mask = space
field_name = 'FILE'
CHANGING
file_name = file.
START-OF-SELECTION.
FILE1 = FILE . "HERE I AM PASSING INTO STRING
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FILE1
FILETYPE = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
file structure is same as the internal table.
I stored the file as .txt( ie in notepad).
my file is like this..
10000 200 323 sunndarrr.......
i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
when i am using the ws_upload it is working fine.
please guide me where i have done the mistake.
thank you so much for all the replies.Hi,
Have a look on the following code.
TABLES: kna1.
DATA: BEGIN OF itab1 OCCURS 0,
str(255),
END OF itab1.
DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'D:\ABAP EVE\ffile1.txt'
filetype = 'ASC'
TABLES
data_tab = itab1
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11.
IF sy-subrc <> 0.
WRITE:/ 'sorry'.
ELSE.
LOOP AT itab1.
SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
APPEND itab2.
ENDLOOP.
IF sy-subrc = 0.
LOOP AT itab2.
WRITE:/ itab2-kunnr,itab2-name1.
INSERT INTO kna1 VALUES itab2.
ENDLOOP.
IF sy-subrc = 0.
WRITE:/ 'inserted'.
ELSE.
WRITE:/ 'not inserted'.
ENDIF.
ELSE.
WRITE:/ 'fail'.
ENDIF.
ENDIF.
Flat file:
10001,Sadney
10003,Yogesh
20005,Madan
1.U need to define internal table with one field of max size
2.upload the flat file data into that internal table
3.split that internal table data into another internal table(having fields)
<REMOVED BY MODERATOR>
thanks,
Chandu
Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM -
Steps for: Internal table - convert to PDF - Sotre PDF files on UNIX Server
Hi Experts,
My requirement is to Split an internal table into multiple tables and generate a PDF for each of them.Then I have to place these files on a unix server directory. How can I achieve this?
This seems like a very high level requirement description .Please let me know if the solution needs some more details.
Thanks In Advance
Abhishek
Edited by: Yatin Vishwas Parab on Oct 23, 2009 1:53 PMHi,
1) The logic for splitting a internal table into multiple tables should lie with you .
2) write each of the split internal table to spool and convert them to PDF using the FM 'CONVERT_ABAPSPOOLJOB_2_PDF'. This has been discussed many times and you can find relevant threads by searching.
3) For storing the PDF in application server, use OPEN DATASET statement in binary mode and transfer the data. Even this has been discussed quite a few times before and you can search for relevant threads
Vikranth -
Internal Table Reaches Maximum Line Count (or memory?)
I have an internal table that is filled in a Function Module READ_OTF_FROM_MEMORY. It was originally definesd as:
DATA: T_OTFDATA_TAB LIKE ITCOO OCCURS 1 WITH HEADER LINE,
I made it:
DATA: T_OTFDATA_TAB LIKE ITCOO OCCURS 10000 WITH HEADER LINE,
However, All of the data is not being returned (truncates about 4/5 thru file)
Is their any other way I can define a large internal table?
Thank-you.Hi,
First of all use of OCCUR statement is not advisable.
Also, increasing the size of occurs will not increase the size of table.
An internal tabe can store upto 2GB of data under standard scenario.
Regards,
Amit -
How internal tables are physicaly located in memory?
Array, chained list, or else? Plese provide any opinion or documentation.
Sincerely yours, Long Nguyen.A data model is an abstraction of a part of the real world which is represented using formal structures. A relational database basically uses one formal structure known as a table.
A table can be defined as a two-dimensional matrix made of rows and columns. It can also be described as a group of records of the same type.Records are groups of fields based on existing data types. These data types are previously defined in the datadictionary. A table is a similar concept to a conventional indexed file; the difference is that in the relational model the main index is known as the primary key, which is made of one or more fields of the record. A record is also known as tuple or simply a row. The most significant feature of the primary key is that it identifies univocally one and only one record of the table: a table does not permit records with duplicated primary keys.
Structures. The object structure refers to the definition of a compound object that does not have any content. It's like a table or a view, but it never has entries: it's only a structure. These types of objects are used in programs for defining data structures or for defining data in the interfaces from the module pools and the screens. The basic difference between structures and tables (or views) is that the
structure does not exist at the underlying database system level; however, both tables and views do exist in the database. Structures only exist as definitions in the dictionary. As a result, structures do not need to be activated.
Table. As previously explained, a table is a two-dimensional data matrix. A table can contain zero or many rows, corresponding to the predefined table structure (entity type). This is, at the same time, a complex structure, which can be made up of one or several fields (attributes). Every row that makes up the database table has the same structure and properties. The fields that make up the structure of the table records, as well as its attributes, permitted value range, and so on, are set when defining the table.
Some general recommendations for internal tables:
As long as all that you need from an internal table is to append lines to it and perhaps to sort it after filling it, standard tables are still the best choice. The other table kinds are too expen-sive for these simple tasks. Keep in mind that when inserting or deleting lines in index tables containing many lines, the administration of the logical index that manages the lines of the ta-ble internally can become expensive, with regard to performance and additional memory space. Only for standard tables that are filled with APPEND only, and where no lines are de-leted except for the last line, is there no need for a logical index, and hence
no additional costs are incurred.
If memory space is an issue, for very large internal tables (> 500000 lines) with a
small line size, sorted tables might be preferable to hashed tables, since for internal administration, they need only 6 bytes per line compared to 18 bytes for hashed tables.
When declaring internal tables, use the addition INITIAL SIZE only for inner tables in nested tables. For outer tables, the automatic allocation of initial memory size is appropriate. For inner tables, though, it may result in saving a large amount of memory.
When reading internal tables with READ TABLE or LOOP AT, choose the appropriate output behavior. Writing into a work area wa with the addition INTO wa is only necessary if you want to change the work area without influencing the internal table. For pure reading purposes or for modifying the contents of the internal table, the additions ASSIGNING <fs> for assigning internal table lines to a field symbol <fs> and REFERENCE INTO dref for setting a refer-ence in a data reference variable dref to internal table lines are the better choices by far.
Use CLEAR instead of REFRESH for internal tables. The reason is that for internal tables with-out header lines, the general statement CLEAR does exactly the same as the special state-ment REFRESH. Since internal tables with header lines should no longer be used, the state-ment REFRESH is effectively obsolete. In order to free more memory, you can consider the use of FREE.
The statement COLLECT should no longer be used for standard tables use COLLECT mainly for hashed tables. The reason is that COLLECT is based on a hash algorithm. While the hash administration of a hashed table is always available and robust, for standard tables a temporary hash administration must be created when the COLLECT statement is used. This temporary hash administration is invalidated when the table is accessed for changing. If fur-ther COLLECT statements are entered after an invalidation, a linear search of all table rows must be performed. Furthermore, COLLECT only works properly on internal tables with unique lines, while a unique table key is guaranteed for hashed tables only. Therefore, for standard tables it cannot be guaranteed that the contents will always be suitable for editing using COLLECT.
Dont use APPEND SORTED BY use SORT instead. The reason is that creating a ranked list with APPEND SORTED BY is based on several assumptions about the internal table and how it is filled. Using SORT is the general method that can be applied to all kinds of table and inde-pendent from the mode of filling.
Chk these links for more information about internal tables
internal tables
Regards,
Balaji Reddy G
**Rewards for helpful answers -
Large line to internal tables from tab delimited file
Dear All
I am trying to upload the large file of tab delimited data into a SAP internal table. I am basically stuck with the fact that there are multiple lines and multiple columns in tab delimited file. There are around 300 columns which are tab delimited and separated
For e.g (* indicates tab)
1material*****************1**9888**********5**********34*********3*********346************************-->upto 5000 columns
1material*****************1**99338************4***********************************6************7************-->upto 5000 columns
1material*****************1**22888********************5*********7*********************6*****7**************-->upto 5000 columns
1material*****************1**44844************************5***5*********************************************-->upto 5000 columns
1material***********34****1**54*******33********33*****33**************************************************-->upto 5000 columns
1material*****************1**99888*****************************************************************************-->upto 5000 columns
below upto 500 rows or more
I want to read this file into a columner internal table.
I am trying several ways . I have file on APP server. However Line breaks after 1024 characters or comes on another line.
Currently I am not able to load it in single line of internal table. The structure of file is dynamic .. not static
AmolHi Amolsonaikar,
you may try like this:
TYPES:
begin of line,
t_field type table of string,
end of line,
t_line type table of line.
DATA:
lt_line type t_line,
lv_line type string,
lt_field type table of string.
open dataset 'XYZ' for input in text mode encoding default.
while sy-subrc = 0.
read dataset into lv_line.
split lv_line at '|' into lt_field.
append lt_field to lt_line.
endwhile.
Regards,
Clemens -
How to split all the fields of output ls-l from an internal table
Hi all,
Using ls-l command i have brought the file attributes of a file like its read and write permissions,creation date ,path etc in a internal table.
Now how to split all these fields from the internal table or what should be the splitting criteria.
The field contents of internal table are like this:
-rw-rw---- 1 devadm sapsys 18360 apr 29......so on
I want to split this into different fields.
Kindly suggest.
Thank You.Hi,
I think the delimiter will be space. For date alone (Apr 29) you need to concatenate after the string has been split.
Thanks and regards,
S. Chandramouli
Maybe you are looking for
-
MS-SQL Server 2008 Update Statistics
Hi, We have SAP running on MS-SQL 2008. Can we use the command 'sp_updatestats' to update stats on all tables in the schema or is there any option we can schedule a job from DBACOCKPIT? Thanks, Kris
-
Possible problems with Check out and Open Component and delayed publishing
Hi, I've experienced some seemingly wrong behaviors of the checkout and open component and also with the delayed publishing feature, I've listed it down : 1) The all important one: We know we've delayed publishing features for content, if we set the
-
I cant add music or restore my 5th generation
it says the required folder cannot be found and doesnt allow me to do anything with it
-
trying to share/send a project to another person, but when they try and open, all the usual missing files etc... all pop up. just enqiring how do i eliminate this, as all the files seem to be there (from what i know/see) so say my project is in: exa
-
So Time Capsule is now 'shareable' over the internet with the latest Airport firmware upgrade and MobileMe. Does anybody know if it's possible to do something similar with Airport Express, an external HD and MobileMe? Thanks Sean