Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ERROR : COLLECT_OVERFLOW_TYPE_P

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.

Former Member
Former Member replied

declare your amount fields as type WERTV13 ..

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question