Skip to Content
0
Former Member
Mar 12, 2013 at 05:52 AM

Issue with table s031 and with for all entries.

52 Views

Hi,

I have following code in which select statement on s031 is
taking long time and after that it shows a dump. What should I do instead of
exceeding the time limit of execution of an abap program.

TYPES:

BEGIN OF TY_MTL, " Material Master

MATNR TYPE MATNR, " Material Code

MTART TYPE MTART, " Material Type

MATKL TYPE MATKL, " Material Group

MEINS TYPE MEINS, " Base unit of Measure

WERKS TYPE WERKS_D, " Plant

MAKTX TYPE MAKTX, " Material description (Short Text)

LIFNR TYPE LIFNR, " vendor code

NAME1 TYPE NAME1_GP, " vendor name

CITY TYPE ORT01_GP, " City of Vendor

Y_RPT TYPE P DECIMALS 3, "Yearly receipt

Y_ISS TYPE P DECIMALS 3, "Yearly Consumption

M_OPG TYPE P DECIMALS 3, "Month opg

M_OPG1 TYPE P DECIMALS 3,

M_RPT TYPE P DECIMALS 3, "Month receipt

M_ISS TYPE P DECIMALS 3, "Month issue

M_CLG TYPE P DECIMALS 3, "Month Closing

D_BLK TYPE P DECIMALS 3, "Block Stock,

D_RPT TYPE P DECIMALS 3, "Today receipt

D_ISS TYPE P DECIMALS 3, "Day issues

TL_FL(2) TYPE C,

STATUS(4) TYPE C,

END OF TY_MTL,
BEGIN OF TY_OPG , " Opening File

SPMON TYPE SPMON, " Period to analyze - month

WERKS TYPE WERKS_D, " Plant

MATNR TYPE MATNR, " Material No

BASME TYPE MEINS,

MZUBB TYPE MZUBB, " Receipt Quantity

WZUBB TYPE WZUBB,

MAGBB TYPE MAGBB, " Issues Quantity

WAGBB TYPE WAGBB,
END OF TY_OPG,

DATA :

T_M TYPE STANDARD TABLE OF TY_MTL INITIAL SIZE 0,

WA_M TYPE TY_MTL,

T_O TYPE STANDARD TABLE OF TY_OPG INITIAL SIZE 0,

WA_O TYPE TY_OPG.

DATA: smonth1 TYPE spmon.

SELECT

a~matnr

a~mtart

a~matkl

a~meins

b~werks

INTO TABLE t_m FROM mara AS a

INNER JOIN marc AS b

ON a~matnr = b~matnr
* WHERE a~mtart EQ s_mtart

WHERE a~matkl IN s_matkl

AND b~werks IN s_werks

AND b~matnr IN s_matnr .

endif.

SELECT spmon

werks

matnr

basme

mzubb

WZUBB

magbb

wagbb

FROM s031 INTO TABLE t_o

FOR ALL ENTRIES IN t_m

WHERE matnr = t_m-matnr

AND werks IN s_werks

AND spmon le smonth1

AND basme = t_m-meins.