Skip to Content
-3

Code is Causing report time out

Mar 29, 2017 at 07:10 AM

40

avatar image
TYPES :  BEGIN OF  a1,
    wrbtr TYPE bseg-wrbtr,
    belnr TYPE bseg-belnr,
    bukrs TYPE bseg-bukrs,
    blart TYPE bkpf-blart,
*    zfbdt TYPE bldat,
    bldat  TYPE bldat," DATS  8 0 DOCUMENT DATE IN DOCUMENT
*    des(50) TYPE c,
    shkzg  TYPE shkzg,
*    sgtxt   TYPE  sgtxt,
*    kunnr TYPE kunnr,
    END OF a1.

  DATA tbl  TYPE STANDARD TABLE OF a1 WITH HEADER LINE.
  CLEAR tbl[].
  DATA vzuonr TYPE  bseg-zuonr.
  CLEAR vzuonr.
  DATA   var1  TYPE c LENGTH 11.
  vzuonr = dt_tab2-vbeln.
  SHIFT    vzuonr   LEFT DELETING LEADING '0'.
  SELECT * FROM bseg
    CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE tbl
    WHERE zuonr  EQ vzuonr
       AND koart EQ 'D' AND umskz NE 'Q' "" change on 18/8/2016
*     and bukrs eq vbukrs
*     and kunnr eq vkunnr
     AND kokrs EQ 'BM01'.

  LOOP AT tbl.
    CLEAR  var1.
    CONCATENATE  tbl-belnr '%' INTO  var1.
*    tbl-belnr = var1.
    CLEAR tbl-blart.
    SELECT SINGLE  blart  bldat
       INTO  (tbl-blart , tbl-bldat   )
       FROM bkpf   CLIENT SPECIFIED
*    WHERE  awkey LIKE  var1  AND bukrs EQ vbukrs.
*       AND  bukrs  EQ  vbukrs.
      WHERE  belnr EQ  var1 AND bukrs EQ dt_tab2-bukrs_vf.
    MODIFY   tbl.
  ENDLOOP.
  "--------------Now  get  values for Open and Bank
  CLEAR :
    openr ,bankr, atrans, atranss,atransh ,openc , bankp , bankri,openz ,opend .
  LOOP AT tbl.
    IF tbl-blart EQ 'ZC'.
      IF tbl-shkzg EQ 'S'.
        openz =  openz -  tbl-wrbtr.
      ELSEIF tbl-shkzg EQ 'H'.
      ENDIF.
      openr =  openr +  tbl-wrbtr.
*      t_rcpt-posting_date = tbl-zfbdt .
*      t_rcpt-posting_number =   tbl-belnr.
*      t_rcpt-p_net_amount =    tbl-wrbtr.
*      t_rcpt-des =   'Cheque'.
*      t_rcpt-sgtxt = tbl-sgtxt.
*      append  t_rcpt.
    ELSEIF  tbl-blart EQ 'DZ'.
      bankr =  bankr +  tbl-wrbtr.
*      t_rcpt-posting_date = tbl-zfbdt .
*      t_rcpt-posting_number =   tbl-belnr.
*      t_rcpt-p_net_amount =    tbl-wrbtr.
*      t_rcpt-des =   'Bank'.
*      t_rcpt-sgtxt = tbl-sgtxt.
*      append  t_rcpt.
    ELSEIF  tbl-blart EQ 'BP'.
      bankp =  bankp +  tbl-wrbtr.
*      t_rcpt-posting_date = tbl-zfbdt . "tbl-bldat
*      t_rcpt-posting_number =   tbl-belnr.
*      t_rcpt-p_net_amount =    tbl-wrbtr.
*      t_rcpt-des =   'Bank Payment'.
*      t_rcpt-sgtxt = tbl-sgtxt.
*      append  t_rcpt.
    ELSEIF  tbl-blart EQ 'BR'.
      bankri =  bankri +  tbl-wrbtr.
*      t_rcpt-posting_date = tbl-zfbdt .
*      t_rcpt-posting_number =   tbl-belnr.
*      t_rcpt-p_net_amount =    tbl-wrbtr.
*      t_rcpt-des =   'Bank Receipt'.
*      t_rcpt-sgtxt = tbl-sgtxt.
*      append  t_rcpt.
    ELSEIF tbl-blart EQ 'XR'.
      revrsl =  revrsl +  tbl-wrbtr.
*      t_rcpt-posting_date = tbl-zfbdt .
*      t_rcpt-posting_number =   tbl-belnr .
*      t_rcpt-p_net_amount =  - tbl-wrbtr .
*      t_rcpt-des =   'Reversal Doc'.
*      t_rcpt-sgtxt = tbl-sgtxt.
*      append  t_rcpt.
    ELSEIF tbl-blart EQ 'OC'.
      IF tbl-shkzg EQ 'S'.

        opend =  opend -  tbl-wrbtr.
      ELSEIF tbl-shkzg EQ 'H'.
        openc =  openc +  tbl-wrbtr.
      ENDIF.
*      t_rcpt-posting_date = tbl-zfbdt .
*      t_rcpt-posting_number =   tbl-belnr.
*      t_rcpt-p_net_amount =    tbl-wrbtr.
*      t_rcpt-des =   'Oc Document '.
*      t_rcpt-sgtxt = tbl-sgtxt.
*      append  t_rcpt.

    ELSEIF  tbl-blart EQ 'DA'.

      IF tbl-shkzg EQ 'H'.

        atransh =  atransh -  tbl-wrbtr.

      ELSEIF tbl-shkzg EQ 'S'.
*        atrans =  atrans +  tbl-wrbtr.
        atranss =  atranss -  tbl-wrbtr.
      ENDIF.
*      t_rcpt-posting_date = tbl-zfbdt .
*      t_rcpt-posting_number =   tbl-belnr.
*      t_rcpt-p_net_amount =    tbl-wrbtr.
*      t_rcpt-des =   'TR / TC '.
*      t_rcpt-sgtxt = tbl-sgtxt.
*      append  t_rcpt.
    ENDIF.
  ENDLOOP.
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Horst Keller
Mar 29, 2017 at 07:19 AM
3

Nice, but you can do it shorter:

DO.
ENDDO.
Show 1 Share
10 |10000 characters needed characters left characters exceeded

I'm pretty sure that answer can't be improved on, so I'm going to close the question now.

1
Further commenting has been locked.