Application Development and Automation 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: 
Read only

how long time take for executing following code

Former Member
0 Likes
501

hi all

thanks

how long time take for executing following code

what possibilities for it plz tell me

SELECT lk~mblnr "material doc number

lk~budat "mat posting date

lp~zeile "item in material document

lp~bwart "movement type

lp~matnr "material no.

lp~werks "plant

lp~prctr "profit center

lp~xauto "item automatically created

lp~menge "quantity

lp~dmbtr "amount

ma~mtart "material group

ma~matkl "material type

INTO CORRESPONDING FIELDs OF TABLE i_mseg

FROM MKPF AS lk INNER JOIN MSEG AS lp

ON lkmblnr EQ lpmblnr

INNER JOIN mara AS ma

ON mamatnr EQ lpmatnr

FOR ALL ENTRIES IN i_faglflexa

WHERE lp~prctr eq i_faglflexa-prctr

AND lp~matnr IN s_matnr

AND lp~xauto ne 'X'

AND lk~budat le s_budat-high

AND ma~mtart IN s_mtart

AND ma~matkl IN s_matkl.

plz guide me

thanks

3 REPLIES 3
Read only

Former Member
0 Likes
457

Hi!

In the ON condition for the JOIN between MKPF and MSEG, try adding MJAHR. Also, donot use MARA in the join. The MSEG table itself is very huge, if you join MARA with it, it will definitely take a long time. Once you have retrieved data from MKPF and MSEG, create a new internal table with all the material numbers and SORT and delete adjacent duplicates. Using this table then access MARA to fetch the required fields using FOR ALL ENTRIES. Now looping at the MKPF_MSEG table, READ the MARA internal table to populate the required fields.

Cheers!

Read only

Former Member
0 Likes
457

hi ,

the tcode se30 which is for the performance analysis

for the program or for the tcode ...

reward points if useful,

venkat.

Read only

Former Member
0 Likes
457
SELECT MBLNR
         MJAHR
         BUDAT
         FROM MKPF
         INTO TABLE IT_MKPF
         WHERE BUDAT IN S_BUDAT.

*--Read Records from MSEG for all entries in IT_MKPF
  IF NOT IT_MKPF[] IS INITIAL.
    SELECT MBLNR
            MJAHR
            ZEILE
            BWART
            MATNR
            WERKS
            MEINS
            ERFMG
            FROM MSEG
            INTO TABLE IT_MSMK
            FOR ALL ENTRIES IN IT_MKPF
            WHERE MBLNR = IT_MKPF-MBLNR AND
                  MJAHR = IT_MKPF-MJAHR AND
                 ( BWART = '131' OR BWART = '132' ) AND
                 MATNR IN S_MATNR AND
                 WERKS IN S_WERKS.
  ENDIF.

Now use Matnr of it_msmk to look into MARA tabel.

Generally, JOINS take much time. Please never use JOIN statements to fetch records.

Use for all entries, and let ur fields fetching be in an order and use INDEXes.

Regards,

Naveena.