Internal table overflow
Hi All,
In an enhancement, I have to look-up a R/3 table.
For this I wrote select query and getting data into internal table.
Here, when executing select query, a runtime error occurred saying that internal table overflow is happening...because of huge data...
How to overcome, this overflow.. with out increasing the size of internal table ?
Hi,
make also sure to define and select only the fields you need in your internal table.
Don't use
DATA: it_mat TYPE TABLE OF mara.
if you need only MATNR, MTART and MATKL (just for example).
Regards,
Klaus
Similar Messages
-
Internal Table data is not overflowing into Next Page - Adobeforms
Hi,
I have an issue if the internal table consits of more than 20 records that data is not overflowing into next page.
Here am using Header only on first page & Table will follows...
Regards,
PraVeen..
Edited by: praveenreddys on Feb 15, 2012 10:51 PMHi praveenreddys ,
I had the same requirement, I did as follows:
LEFT HAND SIDE SELECT "TABLE": check below right hand side properties for this object
1. table tab: select the check box allow page breaks within content.
2. pagination tab: place: Following previous
after:continue filling parent
overflow: none.
LEFT HAND SIDE SELECT "HEADER": check below right hand side properties for this object
3. row tab: select the check box allow page breaks within content.
4. pagination tab: place: Following previous
after:continue filling parent
overflow: none.
select the check boxes: Include header row in initial page
include header row in subsequent pages
Binding tab property:
5.select check box: Repeat row for each data item
LEFT HAND SIDE SELECT "ROW": check below right hand side properties for this object
6. Row tab: DON'T select the chek box allow page breaks with in content
4. pagination tab: place: Following previous
after:continue filling parent
overflow: none.
Binding tab property:
5.select check box: Repeat row for each data item
Then test..it would work for you...ALL THE BEST!!!
If this helps please reward points.
Reards,
Naresh. -
Data overflow in the internal table
Hi Friends,
I am hitting table CDHDR and getting a huge data based on date range and the problem is the internal table is not able to hold the entire data selected and hence it is going for run time error. Could you please suggest an idea to overcome this?
Thanks in advance,
RamHi,
here is the code i have written...
Get all changes to materials in the given date range
SELECT objectclas " Object Class
objectid " Object Value
changenr " Change Document Number
udate " Changed Date
utime " Changed Time
FROM cdhdr
INTO TABLE gt_cdhdr
WHERE objectclas EQ c_clas_material
AND udate IN s_date.
Regards,
Ram -
Error Passing an internal table between BSP pages
Any time there is data in the internal table and I try to pass it from one BSP page to the next I get an Web error. I've heard that it is possible to pass an internal table from one page to the next. can anyone point me in the right direction here?
You can do this with the navigation object only if the table is very small. Overwise it overflows 2+KB limitation of URLs.
Alternative ideas is to use server side cookies (search forum for many examples).
If stateful, just hang stuff of your application class. -
Internal table one page to another?
Hi, shall we transfer internal table data of one page into another page?
I am passing the variables, but interal table data is not shown? Is there any procedure to send data from obe page to another page?
Thanks & Regards,
DhanunjayIts not good idea to pass the table via Navigation object.
You can do this with the navigation object only if the table is very small. Overwise your URL will overflow
Alternative ideas is to use server side cookies.
cl_bsp_server_side_cookie=>set_server_cookie
cl_bsp_server_side_cookie=>get_server_cookie
If your BSP application is stateful & if you are using Application class then store the data in Application class so that it will be available to entire BSP Application.
<b>*Reward each useful answer</b>
Raja T -
Short Dump to extending internal table memory
Hi All,
I have an internal table with 10 million records . While appending records to this internal table iam getting dump as "No storage space available for extending the internal table." .I declared internal table with "OCCURS 0 "How can i avoid this dump ?Hi,
The problem seems to be related to overflow of the internal table allocation size which will be set by BASIS people. Like if the internal table size restricted to say 1024KB and if we are trying to push data more than this it will throw such error.
Please try to split them into more smaller but several internal tables. Also try to restrict the number of records selected, if they are not really required to be selected.
Regards,
Ferry Lianto -
ALV reprot With four internal tables
Hi all,
Could any one please tell what is function module we have to use for displaying four internal tables in a single ALV REPORT.
Thanks & regards
VardhanThis is the code for displaying ALV using containers.. u need to create 4 containers in one screen and need to display data...
I would suggest you to get all the data into one internal table and display.. for more clarity u can give diff colors for diff table data using field catalog..
*& Report ZTRPSD110 *
* TITLE: Statement of Export Report for Tata Tetley *
* PURPOSE:Statement of Export Report for Tata Tetley *
* A. Start-of-selection: *
* 1. In get_billing_data using the selection screen parameters get the *
* billing data from billing header(VBAK) and Item (VBAP) *
* 2. Get the SHIP-TO partner data from VBPA using Customer number as *
* one condition and store in it_vbpa_sh
* 9. Popultae the ALV display table
* B. End-of-selection:
* Call screen 9000 and display data in ALV
REPORT ztrps110 MESSAGE-ID zttl LINE-SIZE 130.
TABLES: vbrk.
* CONSTANTS
CONSTANTS :
c_x(1) TYPE c VALUE 'X',
c_zxto TYPE vbak-auart VALUE 'ZXTO',
c_e TYPE spras VALUE 'E',
c_000000 TYPE posnr VALUE '000000',
c_ship_to TYPE parvw VALUE 'WE'. "Ship To Party
* Table Types
TYPES: BEGIN OF ty_vbrk_vbrp,
vbeln TYPE vbrk-vbeln, "Billing doc
posnr TYPE vbrp-posnr, "Billing item
aubel TYPE vbrp-aubel, "Sales order
waerk TYPE vbrk-waerk, "Doc currency
mvgr1 TYPE vbrp-mvgr1, "Material group 1
mvgr3 TYPE vbrp-mvgr3, "Material group 3
mvgr4 TYPE vbrp-mvgr4, "Material group 4
matnr TYPE vbrp-matnr, "Material no
ntgew TYPE vbrp-ntgew, "Net wt
gewei TYPE vbrp-gewei, "Wt unit
kzwi1 TYPE vbrp-kzwi1, "Subtotal 1
kursk TYPE vbrp-kursk, "Exchange rate
END OF ty_vbrk_vbrp.
TYPES: BEGIN OF ty_data,
land1 TYPE vbpa-land1,
landx TYPE t005t-landx,
mvgr3 TYPE vbrp-mvgr3,
mvgr4 TYPE vbrp-mvgr4,
bezei3 TYPE tvm3t-bezei,
bezei4 TYPE tvm4t-bezei,
ntgew_tea_bag TYPE vbrp-ntgew,
ntgew_pkt_tea TYPE vbrp-ntgew,
ntgew_bulk_tea TYPE vbrp-ntgew,
kzwi1_tea_bag TYPE vbrp-kzwi1, "Subtotal 1 Tea Bag
kzwi1_pkt_tea TYPE vbrp-kzwi1, "Subtotal 1 Pkt Tea
kzwi1_bulk_tea TYPE vbrp-kzwi1, "Subtotal 1 Bulk Tea
ntgew_tot TYPE vbrp-ntgew,
kzwi1_tot TYPE vbrp-kzwi1,
line_color(4) TYPE c, "For line color
END OF ty_data.
TYPES: BEGIN OF ty_vbpa,
vbeln TYPE vbpa-vbeln,
land1 TYPE vbpa-land1,
END OF ty_vbpa.
TYPES: BEGIN OF ty_t005t,
land1 TYPE t005t-land1,
landx TYPE t005t-landx,
END OF ty_t005t.
TYPES: BEGIN OF ty_tvm3t,
mvgr3 TYPE tvm3-mvgr3,
bezei TYPE tvm3t-bezei,
END OF ty_tvm3t.
TYPES: BEGIN OF ty_tvm4t,
mvgr4 TYPE tvm4-mvgr4,
bezei TYPE tvm4t-bezei,
END OF ty_tvm4t.
DATA: it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp,
wa_vbrk_vbrp TYPE ty_vbrk_vbrp,
it_vbpa TYPE STANDARD TABLE OF ty_vbpa,
wa_vbpa TYPE ty_vbpa,
it_data TYPE STANDARD TABLE OF ty_data,
wa_data TYPE ty_data,
it_t005t TYPE STANDARD TABLE OF ty_t005t,
wa_t005t TYPE ty_t005t,
it_tvm3t TYPE STANDARD TABLE OF ty_tvm3t,
wa_tvm3t TYPE ty_tvm3t,
it_tvm4t TYPE STANDARD TABLE OF ty_tvm4t,
wa_tvm4t TYPE ty_tvm4t.
* Global data for grand total
DATA:
w_tot_ntgew_tea_bag TYPE vbrp-ntgew,
w_tot_ntgew_pkt_tea TYPE vbrp-ntgew,
w_tot_ntgew_bulk_tea TYPE vbrp-ntgew,
w_tot_ntgew_tot TYPE vbrp-ntgew,
w_tot_kzwi1_tea_bag TYPE vbrp-kzwi1,
w_tot_kzwi1_pkt_tea TYPE vbrp-kzwi1,
w_tot_kzwi1_bulk_tea TYPE vbrp-kzwi1,
w_tot_kzwi1_tot TYPE vbrp-kzwi1.
* Global data definitions for ALV
DATA :
* ALV Grid container
w_alv_container TYPE REF TO cl_gui_custom_container,
* ALV Grid
w_alv_grid TYPE REF TO cl_gui_alv_grid,
w_layo TYPE lvc_s_layo, "For layout
wt_fieldcat TYPE lvc_t_fcat, "For field catalog
okcode TYPE okcode, "OK Code
w_to(2) TYPE c,
w_title TYPE string.
*-------------- START OF SELECTION SCREEN ----------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
* Billing Date
SELECT-OPTIONS: s_fkdat FOR vbrk-fkdat MEMORY ID vf OBLIGATORY NO-EXTENSION.
SELECTION-SCREEN:SKIP 1.
SELECTION-SCREEN: END OF BLOCK b1.
*-------------- END OF SELECTION SCREEN ------------------------------*
*------------- EVENT START-OF-SELECTION -------------------------------*
START-OF-SELECTION.
* Get billing data from Delivery header(VBRK) and item (VBRP)
PERFORM get_billing_data.
* Get ship-to country
PERFORM get_ship_to_data.
* Get material group description 3
PERFORM get_material_group_3.
* Get material group description 4
PERFORM get_material_group_4.
* Form the ALV Grid title
PERFORM form_title.
* Process data
PERFORM process_data.
* Populate text descriptions
PERFORM populate_description.
*------------- EVENT END-OF-SELECTION -------------------------------*
END-OF-SELECTION.
* Set the text to when date high is there
IF NOT s_fkdat-high IS INITIAL.
w_to = 'to'(c16).
ENDIF.
* Call the scren 9000 for ALV Display
CALL SCREEN 9000.
*& Form get_billing_data
* Get billing data from Delivery header(VBRK) and item (VBRP)
* & store in internal table it_vbrk_vbrp
FORM get_billing_data .
REFRESH: it_vbrk_vbrp.
* Select Billing data by joining VBRK & VBRP and store in it_vbrk_vbrp
SELECT a~vbeln
b~posnr
b~aubel
a~waerk
b~mvgr1
b~mvgr3
b~mvgr4
b~matnr
b~ntgew
b~gewei
b~kzwi1
b~kursk
FROM vbrk AS a INNER JOIN vbrp AS b
ON a~vbeln = b~vbeln
INTO TABLE it_vbrk_vbrp
WHERE a~fkdat IN s_fkdat
* Consider only non-deleted document
AND fksto = space
* Billing doc type should be ZXTB
AND fkart = 'ZXTB'
AND pstyv = c_zxto.
IF sy-subrc <> 0.
MESSAGE i999(zttl) WITH 'No data is there'(m06).
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " get_billing_data
*& Form get_ship_to_data
* Get Ship-To party data
FORM get_ship_to_data .
DATA: l_it_vbpa TYPE STANDARD TABLE OF ty_vbpa.
REFRESH: it_vbpa, it_t005t.
IF NOT it_vbrk_vbrp[] IS INITIAL.
SELECT vbeln
land1
FROM vbpa
INTO TABLE it_vbpa
FOR ALL ENTRIES IN it_vbrk_vbrp
WHERE vbeln = it_vbrk_vbrp-aubel
AND posnr = c_000000
AND parvw = c_ship_to.
IF sy-subrc <> 0.
MESSAGE i999(zttl) WITH 'Exporter country not maintained'(m02).
LEAVE LIST-PROCESSING.
ELSE.
SORT it_vbpa BY vbeln.
* Create an unique and sorted driver table
l_it_vbpa[] = it_vbpa[].
SORT l_it_vbpa BY land1.
DELETE ADJACENT DUPLICATES FROM l_it_vbpa COMPARING land1.
IF NOT l_it_vbpa[] IS INITIAL.
* Get the country description from T005t table
SELECT land1
landx
FROM t005t
INTO TABLE it_t005t
FOR ALL ENTRIES IN l_it_vbpa
WHERE spras = c_e
AND land1 = l_it_vbpa-land1.
IF sy-subrc = 0.
SORT it_t005t BY land1.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " get_ship_to_data
*& Form get_material_group_3
* Get material group 3
FORM get_material_group_3 .
DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
REFRESH: it_tvm3t.
* Create an unique and sorted driver table
l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
SORT l_it_vbrk_vbrp BY mvgr3.
DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr3.
IF NOT l_it_vbrk_vbrp[] IS INITIAL.
SELECT mvgr3
bezei
FROM tvm3t
INTO TABLE it_tvm3t
FOR ALL ENTRIES IN l_it_vbrk_vbrp
WHERE mvgr3 = l_it_vbrk_vbrp-mvgr3.
IF sy-subrc = 0.
SORT it_tvm3t BY mvgr3.
ENDIF.
ENDIF.
ENDFORM. " get_material_group_3
*& Form get_material_group_4
* Get material group 4
FORM get_material_group_4 .
DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
REFRESH: it_tvm4t.
* Create an unique and sorted driver table
l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
SORT l_it_vbrk_vbrp BY mvgr4.
DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr4.
IF NOT l_it_vbrk_vbrp[] IS INITIAL.
SELECT mvgr4
bezei
FROM tvm4t
INTO TABLE it_tvm4t
FOR ALL ENTRIES IN l_it_vbrk_vbrp
WHERE mvgr4 = l_it_vbrk_vbrp-mvgr4.
IF sy-subrc = 0.
SORT it_tvm4t BY mvgr4.
ENDIF.
ENDIF.
ENDFORM. " get_material_group_4
*& Form process_data
* Process the data and do summation and populate final display table
FORM process_data .
LOOP AT it_vbrk_vbrp INTO wa_vbrk_vbrp.
CLEAR: wa_data, wa_vbpa.
READ TABLE it_vbpa INTO wa_vbpa WITH KEY
vbeln = wa_vbrk_vbrp-aubel
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-land1 = wa_vbpa-land1.
ENDIF.
wa_data-mvgr3 = wa_vbrk_vbrp-mvgr3.
wa_data-mvgr4 = wa_vbrk_vbrp-mvgr4.
* Do an unit conversion of the quamtity
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = wa_vbrk_vbrp-ntgew
* NO_TYPE_CHECK = 'X'
* ROUND_SIGN = ' '
unit_in = wa_vbrk_vbrp-gewei
unit_out = 'TO' "Metric tonn
IMPORTING
output = wa_vbrk_vbrp-ntgew
EXCEPTIONS
conversion_not_found = 1
division_by_zero = 2
input_invalid = 3
output_invalid = 4
overflow = 5
type_invalid = 6
units_missing = 7
unit_in_not_found = 8
unit_out_not_found = 9
OTHERS = 10.
IF sy-subrc <> 0.
wa_vbrk_vbrp-ntgew = wa_vbrk_vbrp-ntgew.
ENDIF.
* Convert the currency from Customer currency to local
* currency by multiplying with kursk
wa_vbrk_vbrp-kzwi1 = wa_vbrk_vbrp-kzwi1 * wa_vbrk_vbrp-kursk.
* Convert the amount to Lacks by dividing with 100000
wa_vbrk_vbrp-kzwi1 = wa_vbrk_vbrp-kzwi1 / 100000. "DV1K905028
* When MVGR1 is between A to F use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 BETWEEN 'A' AND 'F'.
wa_data-ntgew_tea_bag = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_tea_bag = wa_vbrk_vbrp-kzwi1.
ENDIF.
* When MVGR1 is between G to L use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 BETWEEN 'G' AND 'L'.
wa_data-ntgew_pkt_tea = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_pkt_tea = wa_vbrk_vbrp-kzwi1.
ENDIF.
* When MVGR1 is between G to L use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 = 'M'.
wa_data-ntgew_bulk_tea = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_bulk_tea = wa_vbrk_vbrp-kzwi1.
ENDIF.
COLLECT wa_data INTO it_data.
ENDLOOP.
ENDFORM. " process_data
*& Form populate_description
* Populate the description fields
FORM populate_description .
LOOP AT it_data INTO wa_data.
CLEAR: wa_t005t.
READ TABLE it_t005t INTO wa_t005t WITH KEY land1 = wa_data-land1
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-landx = wa_t005t-landx.
ENDIF.
* Read description of Material group 3
CLEAR wa_tvm3t.
READ TABLE it_tvm3t INTO wa_tvm3t WITH KEY
mvgr3 = wa_data-mvgr3
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-bezei3 = wa_tvm3t-bezei.
ENDIF.
* Read description of Material group 4
CLEAR wa_tvm4t.
READ TABLE it_tvm4t INTO wa_tvm4t WITH KEY
mvgr4 = wa_data-mvgr4
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-bezei4 = wa_tvm4t-bezei.
ENDIF.
* Get the grand totals
wa_data-ntgew_tot = wa_data-ntgew_tea_bag
+ wa_data-ntgew_pkt_tea
+ wa_data-ntgew_bulk_tea.
wa_data-kzwi1_tot = wa_data-kzwi1_tea_bag
+ wa_data-kzwi1_pkt_tea
+ wa_data-kzwi1_bulk_tea.
MODIFY it_data FROM wa_data TRANSPORTING landx
bezei3
bezei4
ntgew_tot
kzwi1_tot.
* Summattion of grand totals
w_tot_ntgew_tea_bag = w_tot_ntgew_tea_bag + wa_data-ntgew_tea_bag.
w_tot_ntgew_pkt_tea = w_tot_ntgew_pkt_tea + wa_data-ntgew_pkt_tea.
w_tot_ntgew_bulk_tea = w_tot_ntgew_bulk_tea + wa_data-ntgew_bulk_tea.
w_tot_ntgew_tot = w_tot_ntgew_tot + wa_data-ntgew_tot.
w_tot_kzwi1_tea_bag = w_tot_kzwi1_tea_bag + wa_data-kzwi1_tea_bag.
w_tot_kzwi1_pkt_tea = w_tot_kzwi1_pkt_tea + wa_data-kzwi1_pkt_tea.
w_tot_kzwi1_bulk_tea = w_tot_kzwi1_bulk_tea + wa_data-kzwi1_bulk_tea.
w_tot_kzwi1_tot = w_tot_kzwi1_tot + wa_data-kzwi1_tot.
ENDLOOP.
* Append a grand Total row at the end
CLEAR wa_data.
wa_data-landx = 'Grand Total:'.
wa_data-ntgew_tea_bag = w_tot_ntgew_tea_bag.
wa_data-ntgew_pkt_tea = w_tot_ntgew_pkt_tea.
wa_data-ntgew_bulk_tea = w_tot_ntgew_bulk_tea.
wa_data-ntgew_tot = w_tot_ntgew_tot.
wa_data-kzwi1_tea_bag = w_tot_kzwi1_tea_bag.
wa_data-kzwi1_pkt_tea = w_tot_kzwi1_pkt_tea.
wa_data-kzwi1_bulk_tea = w_tot_kzwi1_bulk_tea.
wa_data-kzwi1_tot = w_tot_kzwi1_tot.
wa_data-line_color = 'C310'.
APPEND wa_data TO it_data.
ENDFORM. " populate_description
*& Module STATUS_9000 OUTPUT
* Initialise PF-STATUS and title
MODULE status_9000 OUTPUT.
SET PF-STATUS 'MAIN9000'.
SET TITLEBAR 'TITLE_9000'.
ENDMODULE. " STATUS_9000 OUTPUT
*& Module initialize_9000 OUTPUT
* text
MODULE initialize_9000 OUTPUT.
* Call the ALV grid to display data
PERFORM display_alv_grid.
ENDMODULE. " initialize_9000 OUTPUT
*& Module USER_COMMAND_9000 INPUT
* Module to handle User Command
MODULE user_command_9000 INPUT.
CASE okcode.
WHEN 'BACK'.
SET SCREEN 0.
CLEAR okcode.
LEAVE SCREEN.
WHEN 'CANCEL'.
SET SCREEN 0.
CLEAR okcode.
LEAVE SCREEN.
WHEN 'EXIT'.
CLEAR okcode.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Form display_alv_grid
* Display the data in ALV Grid
FORM display_alv_grid .
IF w_alv_container IS INITIAL.
* Create the alv container object
CREATE OBJECT w_alv_container
EXPORTING
container_name = 'ALV_GRID'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH 'Problem in ALV display'(t04).
ENDIF.
* Create the ALV grid object. The parent is the ALV container
CREATE OBJECT w_alv_grid
EXPORTING
i_parent = w_alv_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH 'Problem in ALV display'(t04).
ENDIF.
* This subrotine creates the field catalog and
* store in internal table lt_fieldcat
PERFORM prepare_fieldcat CHANGING wt_fieldcat.
* Layout design
w_layo-no_toolbar = ''.
* Not to allow totaling feature
w_layo-no_totline = c_x.
* Report title
* w_layo-grid_title = text-004.
w_layo-grid_title = w_title.
w_layo-zebra = c_x. "Alternating line color (striped)
w_layo-cwidth_opt = c_x. "Optimize column width
w_layo-sel_mode = 'A'. "Selection Mode
* Name of the color field
w_layo-info_fname = 'LINE_COLOR'."For row color
* Call the method to display the data in ALV grid
CALL METHOD w_alv_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = w_layo
CHANGING
it_outtab = it_data[]
it_fieldcatalog = wt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH text-t04.
ENDIF.
ELSE.
* If the container & grid object is alreadt there reuse them
CALL METHOD w_alv_grid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH text-t04.
ENDIF.
ENDIF.
IF okcode = 'CANCEL'.
EXIT.
ENDIF.
ENDFORM. " display_alv_grid
*& Form prepare_fieldcat
-
Hi everyone,
I got a FM with a table parameter and i want to perform some "group by" operation(like sql group by) on it. Any suggestion??
Regards,
KitCOLLECT
Syntax
COLLECT wa INTO itab [result].
Effect
This statement inserts the contents of a work area wa either as single row into an internal table itab or <b>adds the values of its numeric components to the corresponding values of existing rows with the same key</b>. As of Release 6.10, you can use result to set a reference to the inserted or changed row in the form of a field symbol or data reference.
<b>Prerequisite for the use of this statement is that wa is compatible with the row type of itab and all components that are not part of the table key must have a numeric data type (i, p, f).</b>
In standard tables that are only filled using COLLECT, the entry is determined by a temporarily created hash administration. The workload is independent of the number of entries in the table. The hash administration is temporary and is generally invalidated when the table is accessed for changing. If further COLLECT statements are entered after an invalidation, a linear search of all table rows is performed. The workload for this search increases in a linear fashion in relation to the number of entries.
In sorted tables, the entry is determined using a binary search. The workload has a logarithmic relationship to the number of entries in the table.
In hashed tables, the entry is determined using the hash administration of the table and is always independent of the number of table entries.
If no line is found with an identical key, a row is inserted as described below, and filled with the content of wa:
In standard tables the line is appended.
In sorted tables, the new line is inserted in the sort sequence of the internal table according to its key values, and the table index of subsequent rows is increased by 1.
In hashed tables, the new row is inserted into the internal table by the hash administration, according to its key values.
If the internal table already contains one or more rows with an identical key, those values of the components of work area wa that are not part of the key, are added to the corresponding components of the uppermost existing row (in the case of index tables, this is the row with the lowest table index).
The COLLECT statement sets sy-tabix to the table index of the inserted or existing row, in the case of standard tables and sorted tables, and to the value 0 in the case of hashed tables.
Outside of classes, you can omit wa INTO if the internal table has an identically-named header line itab. The statement then implicitly uses the header line as the work area.
COLLECT should only be used if you want to create an internal table that is genuinely unique or compressed. In this case, COLLECT can greatly benefit performance. If uniqueness or compression are not required, or the uniqueness is guaranteed for other reasons, the INSERT statement should be used instead.
The use of COLLECT for standard tables is obsolete. COLLECT should primarily be used for hashed tables, as these have a unique table key and a stable hash administration.
If a standard table is filled using COLLECT, it should not be edited using any other statement with the exception of MODIFY. If the latter is used with the addition TRANSPORTING, you must ensure that no key fields are changed. This is the only way to guarantee that the table entries are always unique and compressed, and that the COLLECT statement functions correctly and benefits performance. The function module ABL_TABLE_HASH_STATE can be used to check whether a standard table is suitable for editing using COLLECT.
Example
Compressed insertion of data from the database table sflight into the internal table seats_tab. The rows in which the key components carrid and connid are identical are compressed by adding the number of occupied seats to the numeric component seatsocc.
DATA: BEGIN OF seats,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
seatsocc TYPE sflight-seatsocc,
END OF seats.
DATA seats_tab LIKE HASHED TABLE OF seats
WITH UNIQUE KEY carrid connid.
SELECT carrid connid seatsocc
FROM sflight
INTO seats.
COLLECT seats INTO seats_tab.
ENDSELECT.
Exceptions
Catchable Exceptions
CX_SY_ARITHMETIC_OVERFLOW
Cause: Overflow in integer field during totals formation
Runtime Error: COLLECT_OVERFLOW
Cause: Overflow in type p field during totals formation
Runtime Error: COLLECT_OVERFLOW_TYPE_P
Non-Catchable Exceptions
Cause: COLLECT used for non-numeric fields
Runtime Error: TABLE_COLLECT_CHAR_IN_FUNCTION -
Adobe Print Form: Printing Nested Internal Tables
Hi All,
We are developing an Adobe print form
We are getting data in 3 internal tables (say ITAB1, ITAB2, ITAB3)
Now we need to print the data as follows (data can overflow into multiple pages)
Record of ITAB1.........
Record of ITAB2
Record of ITAB2
Record of ITAB3
Record of ITAB3
So for 1 record of ITAB1 there can be >1 records in ITAB2 and ITAB3. We have the data in the correct format and all internal tables have a common key field to link. But we don't know how to render this onto a form
Please advise
Thanks and Regards,
AdityaIt is possible, in the context itself you have to define them nested
parent
-> childtable "here you can specify the where condition also
-> subchildtable
The Crucial part is design , in the design you have to take care of Binding , Postioned, Flowed parts and Repeat Row option(make sure for all the tables forms Repeat row option marked). -
Char data into internal table.
Hi all,
I will get data from the FTP (.TXT file) through FTP_SERVER_TO_R3.
in chardata with separater Tab delimited.
here i took one field symbol and assigning the data into internal table.
till here every thing is ok.
My problem is one data type is 13 char, if that field is more than 13 char in the file
it is giving DUMP. (DUMP is OVERFLOW Field 999976767878.22)
TYPES : BEGIN OF X_STRING,
LINE(150) TYPE STRING,
END OF X_STRING.
data : IT_STRING TYPE STANDARD TABLE OF X_STRING,
WA_STRING TYPE X_STRING.
FIELD-SYMBOLS : <fs> TYPE ANY.
LOOP AT chardata INTO wa_chardata.
REFRESH it_string.
SPLIT wa_chardataline AT cl_abap_char_utilities=>horizontal_tab INTO TABLE it_string.
LOOP AT it_string INTO wa_string FROM 1 TO 29.
ASSIGN COMPONENT sy-tabix OF STRUCTURE wa_data TO <fs>.
<fs> = wa_string-field1.
UNASSIGN <fs>.
ENDLOOP.
APPEND wa_data TO it_data.
CLEAR wa_data.
ENDLOOP.
Please give me solution to over come this.
Regards,
SriIn Statement ASSIGN COMPONENT sy-tabix OF STRUCTURE wa_data TO <fs>.
insted of using SY-TABIX use the actual field name of the structre wa_data .
Use a RTTS Method to get all the fields of the structre WA_DATA and then loop at all the fields and then manuplate teh that which has been splitted...!
Hope it helps it will not cause any over flow..and ...( Try to condence the The splitted dat use condence addition while moveing the data to wa_data it will avoide the leading and trailing spaces.... )
Edited by: Anup Deshmukh on Jun 17, 2010 8:31 AM -
Sy-tabix for internal table in smartform
Hi friends,
How to capture the sy-tabix value for the entries in an internal table which has been looped into the loop of table node of a smartform?? I need to print something immedaitely after the end of the table
For every record the value of sy-tabix is showing 1 !!
Advance Thanks
AadarshHi Aadarsh,
Give ur sy-tabix at the end of the loop.
loop at itab.
//table node populations.
endloop.
give a seperate loop for this.
loop at itab.
sy-tabix.
endloop
get the total no and print it after the table.
If u r using do loop then give sy-index.
Hope tihs helps u,
Regards,
Nagarajan.
Message was edited by: Nagarajan Kumarappan -
Regarding Exporting and Importing internal table
Hello Experts,
I have two programs:
1) Main program: It create batch jobs through open_job,submit and close job.Giving sub program as SUBMIT.
I am using Export IT to memory id 'MID' to export internal table data to sap memory in the subprogram.
The data will be processed in the subprogram and exporting data to sap memory.I need this data in the main program(And using import to get the data,but it is not working).
Importing IT1 from memory id 'MID' to import the table data in the main program after completing the job(SUBMIT SUBPROGRAM AND RETURN).
Importing is not getting data to internal table.
Can you please suggest something to solve this issue.
Thank you.
Regards,
Anand.Hi,
This is the code i am using.
DO g_f_packets TIMES.
* Start Immediately
IF NOT p_imm IS INITIAL .
g_flg_start = 'X'.
ENDIF.
g_f_jobname = 'KZDO_INHERIT'.
g_f_jobno = g_f_jobno + '001'.
CONCATENATE g_f_jobname g_f_strtdate g_f_jobno INTO g_f_jobname
SEPARATED BY '_'.
CONDENSE g_f_jobname NO-GAPS.
p_psize1 = p_psize1 + p_psize.
p_psize2 = p_psize1 - p_psize + 1.
IF p_psize2 IS INITIAL.
p_psize2 = 1.
ENDIF.
g_f_spname = 'MID'.
g_f_spid = g_f_spid + '001'.
CONDENSE g_f_spid NO-GAPS.
CONCATENATE g_f_spname g_f_spid INTO g_f_spname.
CONDENSE g_f_spname NO-GAPS.
* ... (1) Job creating...
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = g_f_jobname
IMPORTING
jobcount = g_f_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e469(9j) WITH g_f_jobname.
ENDIF.
* (2)Report start under job name
SUBMIT (g_c_prog_kzdo)
WITH p_lgreg EQ p_lgreg
WITH s_grvsy IN s_grvsy
WITH s_prvsy IN s_prvsy
WITH s_prdat IN s_prdat
WITH s_datab IN s_datab
WITH p1 EQ p1
WITH p3 EQ p3
WITH p4 EQ p4
WITH p_mailid EQ g_f_mailid
WITH p_psize EQ p_psize
WITH p_psize1 EQ p_psize1
WITH p_psize2 EQ p_psize2
WITH spid EQ g_f_spid
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
VIA JOB g_f_jobname NUMBER g_f_jobcount AND RETURN.
*(3)Job closed when starts Immediately
IF NOT p_imm IS INITIAL.
IF sy-index LE g_f_nojob.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = g_f_jobcount
jobname = g_f_jobname
strtimmed = g_flg_start
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
gs_jobsts-jobcount = g_f_jobcount.
gs_jobsts-jobname = g_f_jobname.
gs_jobsts-spname = g_f_spname.
APPEND gs_jobsts to gt_jobsts.
ELSEIF sy-index GT g_f_nojob.
CLEAR g_f_flg.
DO. " Wiating untill any job completion
LOOP AT gt_jobsts into gs_jobsts.
CLEAR g_f_status.
CALL FUNCTION 'BP_JOB_STATUS_GET'
EXPORTING
JOBCOUNT = gs_jobsts-jobcount
JOBNAME = gs_jobsts-jobname
IMPORTING
STATUS = g_f_status
* HAS_CHILD =
* EXCEPTIONS
* JOB_DOESNT_EXIST = 1
* UNKNOWN_ERROR = 2
* PARENT_CHILD_INCONSISTENCY = 3
* OTHERS = 4
g_f_mid = gs_jobsts-spname.
IF g_f_status = 'F'.
IMPORT gt_final FROM MEMORY ID g_f_mid .
FREE MEMORY ID gs_jobsts-spname.
APPEND LINES OF gt_final to gt_final1.
REFRESH gt_prlist.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = g_f_jobcount
jobname = g_f_jobname
strtimmed = g_flg_start
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc = 0.
g_f_flg = 'X'.
gs_jobsts1-jobcount = g_f_jobcount.
gs_jobsts1-jobname = g_f_jobname.
gs_jobsts1-spname = g_f_spname.
APPEND gs_jobsts1 TO gt_jobsts.
DELETE TABLE gt_jobsts FROM gs_jobsts.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
IF g_f_flg = 'X'.
CLEAR g_f_flg.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDIF.
IF sy-subrc <> 0.
MESSAGE e539(scpr) WITH g_f_jobname.
ENDIF.
COMMIT WORK .
ENDDO. -
How to select the data from a Maintainance View into an internal table
Hi All,
Can anybody tell me how to select the data from a Maintainance View into an internal table.
Thanks,
srinivas.HI,
You can not retrieve data from A mentenance view.
For detail check this link,
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
Regards,
Anirban -
Creating XML file from ABAP internal table data....
Hello,
I am fethcing data froma custom table and I have to write data in XMl format. Following is the XML format in which I want data. Is there any function module iN SAP which will help me in writing data from internal table to XML file ?
<batch>
<invoice>
<StatusCode>10</StatusCode>
<paymentamount>122.00</paymentamount>
<ReferenceNumber>70980934</ReferenceNumber>
</invoice>
<invoice>
<StatusCode>90</StatusCode>
<paymentamount>122.00</paymentamount>
<ReferenceNumber>70980934</ReferenceNumber>
</invoice>
<control>
<InvoiceCount>2</InvoiceCount>
</control>
</batch>
Please help.
Regards,
Jainam.I suggest you look into "simple transformations". That's SAP's most recent technology for such purposes, as far as I know.
http://help.sap.com/abapdocu_70/en/ABENABAP_ST.htm
Thomas -
Need suggestion in uploading dynamic excel file to corresponding columns of internal table
Hi Friends,
I have an excel file which doesn't have standard template. Just the users will key in their header (in row1 ) and followed by item details in excel and upload to internal table. Now by doing some internal developments in program I need to place the values in corresponding fields.
Let me explain with some examples.
1. I have an internal table
data : begin of itab occurs 0,
f1,
f2,
f3,
f4,
f5,
end of itab.
2. I have excel file as below
3 . Now i need to fill my internal table itab as below
Need to be placed in corresponding fields.
4. When I used GUI_UPLOAD FM it updates internal table as
Please give me suggestion on how to achieve it.
Thanks in advance.Hi Kumar,
use a temporary table to get excel values and then parse them to a second table with the format you want.
This is pretty basic.
regards,
Edgar
Maybe you are looking for
-
Error message regarding a spry menu bar
Hello there, i'm fairly new at Dreamweaver and have been creating my own site. I have created a template and within this i have formed a spry menu bar. Now it is reporting that there is an error and can not implement updates to my child pages and i m
-
In design CS2 has it been dumped completely by this awful company
My problem is that Indesign CS2 wont open any longer. I bought it as a bundle and paid a huge sum for the full Creative suite. I was told at the time that I could run a separate copy on my laptop at the time. Later when I tried to do that I found tha
-
Passing parameter from transaction iview
Hi, We have a case of invoking a transaction iView from a WebDynpro application. I need to pass the parameter from transaction ivew to webdynpro application. Any pointer to this will be really helpful. thanks....
-
How many clients can connect to Topic?
I've just read through the jms tutorial and it seems to be ment to losely couple parts of a big systems. (delivery -> factory -> order) I'm in the process of beginning a application which has the following structure: One client sends a message to the
-
Is there any way to generate an RTMT alert as soon as the PRI goes down in cisco voice gateway (MGCP). I have almost 20 gateways and all have multiple T1 circuits and need to setup on all.