Skip to Content
0
Mar 12, 2013 at 04:33 AM

Issue with fetching data from s031

47 Views

Hi,

i have following code but in that code select statement of s031 is taking long time. what should i do. please help me.

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,

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,

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.

IF t_m[] IS NOT INITIAL.

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.

ENDIF.