Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Order printing month wise

Hi All,

I have a classical report, which shows order count based on the creation date range. I want the order count month wise. can some one please help me.

Thanks

veni.

FORM GET_DATA.
*********************
  SELECT VBELN KUNNR ERDAT ERNAM AUART FROM VBAK
         INTO TABLE ITAB_VBAK
         WHERE ERDAT IN SERDAT
               AND ( AUART = 'OR'
                OR  AUART = 'ZLAT'
                OR  AUART = 'ZCLO'
                OR  AUART = 'ZREN' )
         ORDER BY VBELN.
  IF SYST-DBCNT > 0.
    SELECT KUNNR NAME1 FROM KNA1
           INTO TABLE ITAB_KNA1
           FOR ALL ENTRIES IN ITAB_VBAK
           WHERE KUNNR = ITAB_VBAK-KUNNR.
  ENDIF.
  CLEAR: ITAB_VBAK, KNA1-NAME1.
  LOOP AT ITAB_VBAK.

    IF ITAB_VBAK-ERNAM = 'BATCHUSER'
        OR ITAB_VBAK-ERNAM = 'REDDYV'.
      NO_ORDER1 = NO_ORDER1 + 1.
    ELSE.
      NO_ORDER2 = NO_ORDER2 + 1.
    ENDIF.

    READ TABLE ITAB_KNA1
       WITH KEY KUNNR = ITAB_VBAK-KUNNR.

    IF SY-SUBRC EQ 0.
      MOVE:   ITAB_KNA1-NAME1      TO ITAB_OUTPUT-NAME1,
              NO_ORDER1            TO ITAB_OUTPUT-NO_ORDER1,
              NO_ORDER2            TO ITAB_OUTPUT-NO_ORDER2.
      APPEND ITAB_OUTPUT.
      CLEAR ITAB_OUTPUT.
    ENDIF.
  ENDLOOP.

ENDFORM.       

Tags:
Not what you were looking for? View more on this topic or Ask a question