Skip to Content
0
Jun 05, 2009 at 08:28 AM

Hi CPU usage in ABAP coding

45 Views

Hello,

I have a custom program (programmed by somebody else) which is churning away all day long and consuming between 50% and 70% CPU as seen in the 'top' command. I'm on HP-UX with 8 CPUs installed. The CPU usage is consistently at this level. (I matched the PID from SM50 with the PID in 'top')

I ran abap traces in ST12 which found that between 60% and 70% of the time was spent in the following coding:

773 IF SY-SUBRC <> 0.

774 LOOP AT GIT_ZTABLEA TRANSPORTING NO FIELDS

775 WHERE KUNNR = PC_KUNNR "CUSTOMER CODE゙

776 AND ZZVCGRTNFG IN P_DRTNFG "FLAG゙(SELECTION CRITEREA)

777 AND ZZVCGSTPFG IN P_DSPDFG . "QUIT FLAG゙(SELECTION CRITEREA)

778 EXIT.

779 ENDLOOP .

780

781 *

782 PI_SUBRC = SY-SUBRC .

783 RETURN .

784

785 *

786 ELSE.

787 LOOP AT GIT_ZTABLEA TRANSPORTING NO FIELDS

788 WHERE ZZVCGGRPID = GFC_TABLEB-ZZVCGGRPID "GROUP ID

789 AND ZZVCGRTNFG IN P_DRTNFG "FLAG゙(SELECTION CRITEREA)

790 AND ZZVCGSTPFG IN P_DSPDFG. "STOP FLAG゙(SELECTION CRITEREA)

791 EXIT.

792 ENDLOOP .

I guess the idea here is to just find the number of rows in GIT_ZTABLEA for certain conditions.

Is there a simple and less intensive way of achieving this?

(apologies in advance for foreseen dumb questions. I'm very new to coding).

Peter