Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Getting data from pcl4 in optimize way and optimization of code

$
0
0

Hi all,

 

Acutally I have two problems, first the report that I have assigned to make it better in performance, was actually created back in 2000.

In this there is lot of select endselect statemtns which makes the report slower then usual, and second thing which I felt it getting data from pcl4 cluster which make it more slow, I want to ask you guys, is there any  other way to read data from pcl4 which improve the performance of report, and plz do suggest me to alternative of way select and end select statement so I can use in my report, I thought to get data from database and save it into ITb then append the field, Is this the  better way of doing things compare to select end select statement. I am pasting the small part of code which i feel it slower the program, please suggest me the way, as I am tired to searched this solution in Google but not find any satisfactory solution.

 

WELL lcl4 is internal table.

 

 

select client
          relid
          srtfd
          srtf2
          histo
          aedtm
          uname
          pgmid
          versn
          clustr into
          (pcl4-client,
           pcl4-relid,
           pcl4-srtfd,
           pcl4-srtf2,
           pcl4-histo,
           pcl4-aedtm,
           pcl4-uname,
           pcl4-pgmid,
           pcl4-versn,
           pcl4-clustr)

        from pcl4
        where   relid eq 'SA'
and srtfd between
'A000000000000000000000000000000000000000000000000000000000000000000000'
  and
'A99999999FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'
         and     srtf2 eq '00'
         and     aedtm in aedtm
         and     uname in uname

         and     srtfd like itab_perno-pernr.



     move pcl4-srtfd to sh-key.


     check sh-key-infty in infty.

***********************************************
     check sh-key-bdate in aedtm"confirm this
*    check sh-key-pernr in perno.
***********************************************


     move: sh-key-tclas to lcl4-tclas,
           sh-key-bdate to lcl4-bdate,
           sh-key-btime to lcl4-btime,
           sh-key-seqnr to lcl4-seqnr,
           sh-key-pernr to lcl4-pernr,
           sh-key-infty to lcl4-infty.

     move: pcl4-relid to lcl4-relid,
           pcl4-uname to lcl4-uname.


     if aedtm-low is initial.
       select kostl plans from pa0001 into (lcl4-kostl, lcl4-plans)

         where pernr eq lcl4-pernr
          and werks eq werks
          and btrtl eq btrtl
          and kostl in kostl.
       endselect.


       select trfgr from pa0008 into lcl4-persk
         where pernr eq lcl4-pernr.
       endselect.

     elseif aedtm-high is initial.
       select kostl plans from pa0001 into (lcl4-kostl, lcl4-plans)
                   where pernr eq lcl4-pernr
                    and werks eq werks
                    and btrtl eq btrtl
                    and kostl in kostl
                    and begda le aedtm-low
                    and endda ge aedtm-low.

       endselect.

       select trfgr from pa0008 into lcl4-persk
         where pernr eq lcl4-pernr
          and begda le aedtm-low
          and endda ge aedtm-low.
       endselect.

     else.
       select kostl plans from pa0001 into (lcl4-kostl, lcl4-plans)
   where pernr eq lcl4-pernr
    and werks eq werks
    and btrtl eq btrtl
    and kostl in kostl
    and begda le aedtm-high
    and endda ge aedtm-high.

       endselect.

       select trfgr from pa0008 into lcl4-persk
         where pernr eq lcl4-pernr
          and begda le aedtm-high
          and endda ge aedtm-high.
       endselect.

     endif.
     select single kfzkz from pa0032
                     into lcl4-kfzkz
                     where pernr eq lcl4-pernr and
                           endda eq '99991231'.
     append lcl4.
   endselect.

endform.


Viewing all articles
Browse latest Browse all 8332

Trending Articles