Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR : COLLECT_OVERFLOW_TYPE_P

former_member1284402
Participant
0 Kudos

hi all,

i made a report in which i take data from Ztable but problem is that when there are less amount of data in Ztable then its coming correctly but if there are many number of data then its giving run time error

'COLLECT_OVERFLOW_TYPE_P'. can anyone please help me?

codes:

REPORT zsr2_cpc.

********

TYPE-POOLS : slis.

TABLES : mast, stpo, makt,mard, marc,ekpo,ekko,lfa1,mara,eket,stas,zstas_stpo,t001.

***********

**DATA : BEGIN OF input_data OCCURS 0,

    • material LIKE stpo-idnrk,

    • requiredqty LIKE stpo-menge,

    • END OF input_data.

DATA : BEGIN OF input_data OCCURS 0,

matnr LIKE zsimu-matnr,

zmenge LIKE zsimu-zmenge,

END OF input_data.

***********

DATA : BEGIN OF break_data OCCURS 0,

material LIKE stpo-idnrk,

requiredqty(16) TYPE p DECIMALS 3,"like stpo-menge,

balanceqty(16) TYPE p DECIMALS 3," like stpo-menge,

  • alpos LIKE stpo-alpos, "alternate item flag

END OF break_data.

DATA : BEGIN OF itab2 OCCURS 0,

material LIKE stpo-idnrk,

requiredqty(16) TYPE p DECIMALS 3," like stpo-menge,

  • ALPOS like stpo-ALPOS, "alternate item flag

END OF itab2.

DATA : BEGIN OF itab OCCURS 0,

material LIKE stpo-idnrk,

requiredqty LIKE stpo-menge,

balanceqty LIKE stpo-menge,

str_stk LIKE stpo-menge,

prd_loc_stk LIKE stpo-menge,

menge LIKE ekpo-menge,

meins LIKE mara-meins,

maktx LIKE makt-maktx,

labst LIKE mard-labst,

insme LIKE mard-insme,

beskz LIKE marc-beskz ,

leadtime LIKE marc-dzeit,

ebeln LIKE ekpo-ebeln,

poqty LIKE ekpo-menge,

bedat LIKE ekko-bedat,

ekgrp LIKE ekko-ekgrp,

name1 LIKE lfa1-name1,

sobsl LIKE marc-sobsl,

lgpro LIKE marc-lgpro,

  • alpos LIKE stpo-alpos, "alternate item flag

lblab LIKE mslbh-lblab,

END OF itab.

DATA : BEGIN OF itab_n OCCURS 0,

material LIKE stpo-idnrk,

requiredqty LIKE stpo-menge,

balanceqty LIKE stpo-menge,

str_stk LIKE stpo-menge,

prd_loc_stk LIKE stpo-menge,

menge LIKE ekpo-menge,

meins LIKE mara-meins,

maktx LIKE makt-maktx,

labst LIKE mard-labst,

insme LIKE mard-insme,

beskz LIKE marc-beskz ,

leadtime LIKE marc-dzeit,

ebeln LIKE ekpo-ebeln,

poqty LIKE ekpo-menge,

bedat LIKE ekko-bedat,

ekgrp LIKE ekko-ekgrp,

name1 LIKE lfa1-name1,

sobsl LIKE marc-sobsl,

lgpro LIKE marc-lgpro,

  • alpos LIKE stpo-alpos, "alternate item flag

lblab LIKE mslbh-lblab,

END OF itab_n.

DATA : qpa TYPE p DECIMALS 3.

DATA count TYPE i.

DATA : count2 TYPE i,

count3 TYPE i,

count4 TYPE i,

qty_labst LIKE mard-labst,

qty_labst1 LIKE mard-labst,

qty_insme LIKE mard-insme.

DATA: BEGIN OF bet OCCURS 50.

INCLUDE STRUCTURE ekbe.

DATA: END OF bet.

*

DATA: BEGIN OF bzt OCCURS 50.

INCLUDE STRUCTURE ekbz.

DATA: END OF bzt.

DATA: BEGIN OF betz OCCURS 50.

INCLUDE STRUCTURE ekbez.

DATA: END OF betz.

DATA: BEGIN OF bets OCCURS 50.

INCLUDE STRUCTURE ekbes.

DATA: END OF bets.

DATA: BEGIN OF xekbnk OCCURS 10.

INCLUDE STRUCTURE ekbnk.

DATA: END OF xekbnk.

**********************************************************************

DATA : w_container TYPE scrfname VALUE 'CL_GRID',

w_cprog TYPE lvc_s_layo,

g_repid LIKE sy-repid,

w_save TYPE c,

w_exit TYPE c,

cl_grid TYPE REF TO cl_gui_alv_grid,

cl_custom_container TYPE REF TO cl_gui_custom_container,

it_fld_catalog TYPE slis_t_fieldcat_alv,

wa_fld_catalog TYPE slis_t_fieldcat_alv WITH HEADER LINE ,

layout TYPE slis_layout_alv,

col_pos LIKE sy-cucol ,

alvfc TYPE slis_t_fieldcat_alv.

***************************************************************************************

*SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

*SELECT-OPTIONS : matnr FOR mast-matnr. " NO INTERVALS NO-EXTENSION.

*SELECT-OPTIONS : menge FOR stpo-menge NO INTERVALS NO-EXTENSION.

*SELECTION-SCREEN : END OF BLOCK b1.

**********************************************************************

PERFORM fill_catalog1 USING:

'MATERIAL' 'ITAB' 'Material' ,

'MAKTX' 'ITAB' 'Description' ,

'MEINS' 'ITAB' 'Unit',

'REQUIREDQTY' 'ITAB' 'Required Qty',

'BALANCEQTY' 'ITAB' 'Short Qty',

'LABST' 'ITAB' 'Total Stock',

'STR_STK' 'ITAB' 'Store Stock',

'PRD_LOC_STK' 'ITAB' 'Production loc Stock',

'POQTY' 'ITAB' 'PO Qty',

'BEDAT' 'ITAB' 'PO Date',

'NAME1' 'ITAB' 'Vendor Name',

'LEADTIME' 'ITAB' 'Lead Time',

'BESKZ' 'ITAB' 'P Type',

'EKGRP' 'ITAB' 'P Group'.

***********************************************************************

SELECT matnr zmenge INTO TABLE input_data FROM zsimupp .

LOOP AT input_data.

SELECT SINGLE * FROM mast WHERE matnr = input_data-matnr AND stlan = '3'.

  • IF sy-subrc <> 0.

  • MESSAGE 'DATA NOT FOUND.' TYPE 'I'.

  • ENDIF.

SELECT * FROM zstas_stpo WHERE stlnr = mast-stlnr.

  • qpa = zstas_stpo-menge.

break_data-material = zstas_stpo-idnrk.

break_data-requiredqty = input_data-zmenge .

SELECT SINGLE * FROM mara WHERE matnr = zstas_stpo-idnrk.

IF ( zstas_stpo-meins = 'G' AND mara-meins = 'KG' ) OR

( zstas_stpo-meins = 'MM' AND mara-meins = 'M' ).

break_data-requiredqty = break_data-requiredqty / 1000.

ENDIF.

APPEND break_data.

CLEAR break_data.

CLEAR qpa.

ENDSELECT.

LOOP AT break_data.

itab-material = break_data-material.

SELECT SINGLE maktx FROM makt INTO itab-maktx WHERE matnr = itab-material.

SELECT SINGLE meins FROM mara INTO itab-meins WHERE matnr = itab-material.

itab-requiredqty = break_data-requiredqty.

SELECT labst INTO qty_labst FROM mard WHERE matnr = break_data-material AND ( lgort <> 'REJS' OR lgort <> 'SCRP' ).

qty_labst1 = qty_labst1 + qty_labst.

ENDSELECT.

itab-labst = qty_labst1.

IF itab-requiredqty < itab-labst.

itab-balanceqty = 0.

ELSE.

itab-balanceqty = itab-labst - break_data-requiredqty.

ENDIF.

  • itab-balanceqty = qty_labst1 - break_data-requiredqty.

IF itab-balanceqty < 0.

itab-balanceqty = itab-balanceqty * ( -1 ).

ENDIF.

SELECT SUM( labst ) INTO itab-str_stk FROM mard WHERE matnr = break_data-material

AND ( lgort = 'RECP' OR lgort = 'MAIN' OR lgort = 'COMP' OR lgort = 'EBSS' OR lgort = 'EDSS' OR lgort = 'ELEC' OR lgort = 'GDNS'

OR lgort = 'SFNS' OR lgort = 'FNGS' OR lgort = 'SPQA' OR lgort = 'COQA' ).

itab-prd_loc_stk = itab-labst - itab-str_stk.

************for PO, lead time and P group

SELECT SINGLE * FROM marc WHERE matnr = itab-material.

IF sy-subrc = 0.

MOVE marc-beskz TO itab-beskz.

MOVE marc-sobsl TO itab-sobsl.

MOVE marc-lgpro TO itab-lgpro.

IF marc-beskz = 'E'.

MOVE marc-dzeit TO itab-leadtime.

ENDIF.

IF marc-beskz = 'F'.

MOVE marc-plifz TO itab-leadtime.

MOVE marc-ekgrp TO itab-ekgrp.

ENDIF.

ENDIF.

***************

IF itab-balanceqty <> 0 AND itab-beskz = 'F'.

SELECT * FROM ekpo WHERE matnr = itab-material

AND elikz <> 'X'

AND loekz = ' '.

CALL FUNCTION 'ME_READ_HISTORY'

EXPORTING

ebeln = ekpo-ebeln

ebelp = ekpo-ebelp

webre = 'X'

TABLES

xekbe = bet

xekbz = bzt

xekbes = bets

xekbez = betz

xekbnk = xekbnk.

SELECT SINGLE * FROM eket WHERE ebeln = ekpo-ebeln

AND ebelp = ekpo-ebelp.

itab-poqty = itab-poqty + ( eket-menge - eket-wemng -

bets-wesbs ).

ENDSELECT.

SELECT SINGLE * FROM ekko WHERE ebeln = ekpo-ebeln.

IF sy-subrc = 0.

SELECT SINGLE * FROM lfa1 WHERE lifnr = ekko-lifnr.

IF sy-subrc = 0.

MOVE ekpo-ebeln TO itab-ebeln.

MOVE ekko-bedat TO itab-bedat.

MOVE lfa1-name1 TO itab-name1.

ENDIF.

ENDIF.

ENDIF.

******************

APPEND itab.

CLEAR itab.

qty_labst1 = 0.

DELETE break_data.

CLEAR break_data.

CLEAR ekpo.

CLEAR ekko.

ENDLOOP.

*endselect.

  • delete input_data.

  • clear input_data.

ENDLOOP.

SORT itab BY material.

LOOP AT itab.

COLLECT itab INTO itab_n.

*append itab_n.

ENDLOOP.

**********************************************************************

layout-zebra = 'X' .

layout-colwidth_optimize(1) = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZSR2_CPC'

is_layout = layout

it_fieldcat = it_fld_catalog

i_default = 'X'

i_save = 'A'

TABLES

t_outtab = itab_n

EXCEPTIONS

program_error = 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.

&----


*& Form FILL_CATALOG1

&----


  • text

----


  • -->P_FIELDNAME text

  • -->P_REF_TABLE text

  • -->P_SCRTEXT text

----


FORM fill_catalog1 USING p_fieldname TYPE any

p_ref_table TYPE any

p_scrtext TYPE any.

CLEAR : wa_fld_catalog.

wa_fld_catalog-fieldname = p_fieldname.

wa_fld_catalog-tabname = p_ref_table.

wa_fld_catalog-seltext_s = p_scrtext.

wa_fld_catalog-seltext_m = p_scrtext.

wa_fld_catalog-seltext_l = p_scrtext.

wa_fld_catalog-outputlen = 15.

  • wa_fld_catalog-do_sum = 'X'.

APPEND wa_fld_catalog TO it_fld_catalog.

ENDFORM. " fill_catalog1

regards saurabh.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

declare your amount fields as type WERTV13 ..

10 REPLIES 10

Former Member
0 Kudos

declare your amount fields as type WERTV13 ..

0 Kudos

hi thanx for reply,

there is no amount field in itab. that error is saying that 'An internal table field has been defined too small'.

can anyone please help me?

regards saurabh.

Edited by: saurabh srivastava on Mar 4, 2009 6:52 AM

0 Kudos

Thank You Sir. It helps me to solve my current issue.

Former Member
0 Kudos

U need to change the Quantity fields MENGE , LABST , INSME ..

I think these cause dump ..

0 Kudos

hi all,

thanx for reply, i changed itab but still i m getting same error. can anyone please correct this error?

changed itab:

DATA : BEGIN OF itab OCCURS 0,

material LIKE stpo-idnrk,

requiredqty type p decimals 2, "LIKE stpo-menge,

balanceqty type p decimals 2, "LIKE stpo-menge,

str_stk type p decimals 2, "LIKE stpo-menge,

prd_loc_stk type p decimals 2, "LIKE stpo-menge,

menge type p decimals 2, " LIKE ekpo-menge,

meins LIKE mara-meins,

maktx LIKE makt-maktx,

labst type p decimals 2, "LIKE mard-labst,

insme type p decimals 2, "LIKE mard-insme,

beskz LIKE marc-beskz ,

leadtime LIKE marc-dzeit,

ebeln LIKE ekpo-ebeln,

poqty LIKE ekpo-menge,

bedat LIKE ekko-bedat,

ekgrp LIKE ekko-ekgrp,

name1 LIKE lfa1-name1,

sobsl LIKE marc-sobsl,

lgpro LIKE marc-lgpro,

  • alpos LIKE stpo-alpos, "alternate item flag

lblab LIKE mslbh-lblab,

END OF itab.

DATA : BEGIN OF itab_n OCCURS 0,

material LIKE stpo-idnrk,

requiredqty type p decimals 2, "LIKE stpo-menge,

balanceqty type p decimals 2, "LIKE stpo-menge,

str_stk type p decimals 2, "LIKE stpo-menge,

prd_loc_stk type p decimals 2, "LIKE stpo-menge,

menge type p decimals 2, " LIKE ekpo-menge,

meins LIKE mara-meins,

maktx LIKE makt-maktx,

labst type p decimals 2, "LIKE mard-labst,

insme type p decimals 2, "LIKE mard-insme,

beskz LIKE marc-beskz ,

leadtime LIKE marc-dzeit,

ebeln LIKE ekpo-ebeln,

poqty LIKE ekpo-menge,

bedat LIKE ekko-bedat,

ekgrp LIKE ekko-ekgrp,

name1 LIKE lfa1-name1,

sobsl LIKE marc-sobsl,

lgpro LIKE marc-lgpro,

  • alpos LIKE stpo-alpos, "alternate item flag

lblab LIKE mslbh-lblab,

END OF itab_n.

can anyone please help me?

regards saurabh.

Edited by: saurabh srivastava on Mar 4, 2009 8:32 AM

Former Member
0 Kudos

hi,

please cherk this link,

it will give solution based on this error

http://help.sap.com/abapdocu/en/ABAPCOLLECT.htm

Thanks and regards

Durga.K

Former Member
0 Kudos

Hi,

Check the ABAP Dump where it is terminated .

If that internal table field is difined individually then increas that field else increase the field in the Ztable itself.

Please put u r full ABAP dump here for immediate solutions.

Regards,

Nandha

0 Kudos

hi this is the dump error :

Runtime Errors COLLECT_OVERFLOW_TYPE_P

Exception CX_SY_ARITHMETIC_OVERFLOW

Date and Time 04.03.2009 12:57:26

Short text

An internal table field has been defined too small.

What happened?

Error in the ABAP Application Program

The current ABAP program "ZTEST" had to be terminated because it has

come across a statement that unfortunately cannot be executed.

What can you do?

Note down which actions and inputs caused the error.

To process the problem further, contact you SAP system

administrator.

Using Transaction ST22 for ABAP Dump Analysis, you can look

at and manage termination messages, and you can also

keep them for a long time.

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_ARITHMETIC_OVERFLOW', was not

caught and

therefore caused a runtime error.

The reason for the exception is:

The COLLECT statement stores totals in the internal table

"\PROGRAM=ZTEST\DATA=ITAB_N[]",

but the values are too large for the type P field intended to store

them.

The name of the field is "LEADTIME".

How to correct the error

You should define the field "LEADTIME" larger in program "ZTEST".

The maximum size allowed for fields of type P is 16 (31 digits).

A temporary solution could be to break the process down into smaller

processes so that fewer large sums occur.

Error arrow :

LOOP AT itab.

>>>>> COLLECT itab INTO itab_n.

ENDLOOP.

regards saurabh

former_member212835
Participant
0 Kudos

Hey Saurabh,

How did you resolve this error?

I am getting this error in data extraction in standard Extractor: 0HR_PY_1

-Bhushan.

Former Member
0 Kudos

same error i too got. I have mentioned length of the variables explicitly.