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: 

Performance issue fetching data from REGUP table

Former Member
0 Kudos

Hi All,

I am fetching data from table REGUP for field laufd (Date on Which the Program Is to Be Run) using BELNR, GJAHR, BUKRS,BUZEI.

Apart from these fields I have LIFNR,AUGBL and also AUGDT in my source table.

Below is my select statement which is taking long time to execute some times may short dump(time exceeds).

   SELECT belnr
             gjahr
             bukrs
             buzei
             laufd
      FROM regup
      INTO TABLE lt_regup

     FOR ALL ENTRIES IN LT_DATA

WHERE bukrs = lt_data-bukrs

      and  belnr  = lt_data-belnr

      and  gjahr = lt_data-gjahr

      and buzei = lt_data-buzei.

Please help in to fetch the data for field laufd (Date on Which the Program Is to Be Run) field.

Thanks,

Jwala

3 REPLIES 3

Former Member
0 Kudos

Hi,

Since REGUP has got a different key only option I could think of is to take records from REGUP into an internal table based on certain condirions then sort internal table on bukrs,belnr,gjahr. Then read this int table based on key bukrs,belnr,gjahr.

Regards

Raju Chitale

0 Kudos

The problem is that REGUP is a cluster table and you cannot create an index for it.

The fields that you provide, are not included in the key of the table cluster REGUC:

MANDT          CLNT       3

LAUFD          DATS       8

LAUFI          CHAR       6

XVORL          CHAR       1

ZBUKR          CHAR       4

LIFNR          CHAR      10

KUNNR          CHAR      10

EMPFG          CHAR      16

VBLNR          CHAR      10

PAGENO         INT2       5

But you mentioned, that you have LIFNR field in your structure.

This one may help the system to restrict the number of entries read from REGUC. Please try to pass it over and see if the performance improves (although I do not expect a huge improvement):

   SELECT belnr
             gjahr
             bukrs
             buzei
             laufd
      FROM regup
      INTO TABLE lt_regup

     FOR ALL ENTRIES IN LT_DATA

WHERE bukrs = lt_data-bukrs

      and  belnr  = lt_data-belnr

      and  gjahr = lt_data-gjahr

      and buzei = lt_data-buzei

      and lifnr = lt_data-lifnr.

former_member182010
Active Participant
0 Kudos

Hello Jwaladeepa,

Have you received an answer to your question yet?  What you can do is go to BSAK and extract the paid document similar to below.

    

SELECT BUKRS   BELNR GJAHR BUZEI
                AUGBL
AUGGJ

      FROM BSAK
      INTO TABLE lt_BSAK
 

     FOR ALL ENTRIES IN LT_DATA

WHERE bukrs = lt_data-bukrs

      and  belnr  = lt_data-belnr

      and  gjahr = lt_data-gjahr

      and buzei = lt_data-buzei.

AUGBL and AUGGJ are the Paying document number and corresponding fiscal year.

Then do the following on BKPF.

SELECT BUKRS BELNR GJAHR BKTXT            

      FROM BKPF
      INTO TABLE lt_BKPF
 

     FOR ALL ENTRIES IN lt_BSAK

WHERE bukrs = LT_BSAK-bukrs  "Use the company code from payment document.

      and  belnr  = LT_BSAK-belnr

      and  gjahr = LT_BSAK-gjahr. 

I am currently working on a retail system (ECC 6.0).  Field BKTXT for the clearing document consist Run date (LAUFD) and Identification (LAUFI) separated by a hyphen.  You can split the value in BKTXT as follows.

CONSTANTS:  LC_HYPHEN TYPE CHAR01 VALUE '-'.

DATA:  LV_LAUFD TYPE REGUP-LAUFD,

              LV_LAUFI   TYPE REGUP-LAUFI.

SPLIT LW_BKPF-BKTXT AT LC_HYPHEN INTO LV_LAUFD LV_LAUFI.

There you have it.  The run date of paid document.