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: 

Optimise PCL4

Former Member
0 Kudos
389

Please help me optimise this piece of code as it runs into a time out dump

SELECT client relid srtfd srtf2 histo aedtm uname pgmid versn

clustr

FROM pcl4

INTO (pcl4-client,pcl4-relid,pcl4-srtfd,pcl4-srtf2, pcl4-histo,

pcl4-aedtm,pcl4-uname,pcl4-pgmid,pcl4-versn,pcl4-clustr)

WHERE relid EQ relid

AND srtfd LIKE ra_pernrange-low "Represents PCL4 key ra_pernrrange-low EQ 'A<pernr>%'

AND srtf2 EQ '00'

AND aedtm IN so_datum

AND uname IN so_uname.

      • end of new select

CHECK pcl4-srtfd IN srtfd_select_range_tab.

"GG470

PERFORM add_pcl4 USING '000000' CHANGING dummy.

ENDSELECT.

It is similar to d code used in standard report RPUAUd00

5 REPLIES 5

Former Member
0 Kudos
110

use Perform outside the Select statement as It takes long time Depending upon the records...

Former Member
0 Kudos
110

But the perform statement needs to move the contents of pcl4 into lcl4 can u tell me how 2 do it!??

Former Member
0 Kudos
110

Hi,

SELECT.. ENDSELECT often result into serious performance issues. So according to me change your as specified below:

Declare an internal with fields of pcl4 table which are used in select query.

 SELECT client relid srtfd srtf2 histo aedtm uname pgmid versn
clustr
FROM pcl4
INTO TABLE lt_pcl4
WHERE relid EQ relid
AND srtfd IN srtfd_select_range_tab " this also needs to be changed
AND srtf2 EQ '00'
AND aedtm IN so_datum
AND uname IN so_uname.

IF sy-subrc EQ 0.
  LOOP AT lt_pcl4.
     PERFORM add_pcl4 USING '000000' CHANGING dummy.
  ENDLOOP.
ENDIF.

This will enhance the performance.

Hope this solves your problem.

Regards,

Brajvir

Former Member
0 Kudos
110

I have implemented the suggested solution however in the dev system it doesnt take time but when i migrate my code to test system the code hangs and gives a run time error ... is der any function dat can help me out to read from cluster pcl4... plz help!

0 Kudos
110

Hi,

To further optimise performance of PCL4 cluster table, fetch data using IMPORT .... FROM DATABASE statment. For IMPORT statment background refer help

[http://help.sap.com/saphelp_46c/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/frameset.htm]

Now for reference on HR cluster table:

Cluster Definition

- The data definition of a work area for PCLn is specified in separate programs which comply with fixed naming conventions.

- They are defined as INCLUDE programs (RPCnxxy0). The following naming convention applies:

n = 1 or 2 (PCL1 or PCL2)

xx = Relation ID (e.g. RX)

y = 0 for international clusters or country indicator (T500L) for different country cluster

Code has to modified in the manner specified below:

TABLES: PCLn.

INCLUDE RPCnxxy0. "Cluster definition

* Fill cluster Key
xy-key = <value>.

* Import record

IMPORT table1 FROM DATABASE PCLn(xy) ID xy-KEY.

IF SY-SUBRC EQ 0.
   READ TABLE table1 INTO wa WITH KEY conditions here
   DO further manipulation.
ENDIF.

Inculde RPC4PR00 can be called in the program.

Hope this solves your problem.

Regards,

Brajvir