28/01/2013

CASSICAL REPORT EVENTS

                                          

                        ZCRIS_CLASSICAL_REPORT

*&---------------------------------------------------------------------*
*& Report                   ZCRIS_CLASSICAL_REPORT   
*& Author                   XXX
*& Start Date             27/08/2010
*& Purpose                 REPORT TO DISPLAY  THE PURCHASE DOCS
*&                               USING EVENT
*& COPIED FROM    NA            
*&              
*& *******************************************************************
*& MODIFICATION LOGS :
*& CHANGE REQUEST      CllEMAX4756
*& SUPPLIERS                       xxxxxxxxxx
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZCRIS_CLASSICAL_REPORT   NO STANDARD PAGE HEADING LINE-COUNT 20(3)                  .

TYPES :  BEGIN OF TY_POS ,
              EBELN TYPE EBELN ,
             LIFNR TYPE LIFNR ,
             BUKRS TYPE BUKRS ,
             EKORG TYPE EKORG ,
             EBELP TYPE EBELP ,
             MATNR TYPE MATNR ,
             MENGE TYPE BSTMG ,
             NETPR TYPE BPREI,
             END OF TY_POS.


DATA : IT_POS TYPE TABLE OF TY_POS ,
       WA_POS TYPE          TY_POS.

DATA : V_BUKRS TYPE BUKRS ,
       V_EKORG TYPE EKORG.




SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME .
SELECT-OPTIONS: S_BUKRS FOR WA_POS-BUKRS,     "COMPANY CODE
                S_EKORG FOR WA_POS-EKORG.     "PURCHASING ORGANIZATION
SELECTION-SCREEN END OF BLOCK B1.



************************************************
*      TOP-OF-PAGE
************************************************
TOP-OF-PAGE.
WRITE : 15 'Comp.Code' ,
        17 'Vendor'    ,
        28 'Pur.Org'   ,
        40 'Doc.Nof'   ,
        52 'Item'      ,
        60 'Mat.Nol'   ,
        80 'Price'     .
ULINE.


*************************************************
**          INTIALIZATION
*************************************************
INITIALIZATION.
S_BURKS-LOW      = '1000'.
S_BUKRS-HIGH      = '5000'.
S_BUKRS-SIGN      = 'I'.
S_BUKRS-OPTION   = 'BT'.
APPEND S_BUKRS.





*************************************************
*      AT SELECTION SCREEN
*************************************************
AT SELECTION-SCREEN ON S_BUKRS.
SELECT BUKRS INTO V_BUKRS FROM T001 WHERE BUKRS IN S_BUKRS.
ENDSELECT.
IF SY-SUBRC <> 0.
WRITE : / 'INVALID COMPANY CODE'.
ENDIF.


AT SELECTION-SCREEN ON S_EKORG.
SELECT EKORG INTO V_EKORG FROM EKKO WHERE EKORG IN S_EKORG.
ENDSELECT.
IF SY-SUBRC <> 0.
WRITE : / 'INVALID PURCHASING ORGANIZATION'.
ENDIF.



*****************************************************
*       START OF SELECTION
*****************************************************
START-OF-SELECTION.
SELECT  EKKO~EBELN
        EKKO~LIFNR
        EKKO~BUKRS
        EKKO~EKORG
        EKPO~EBELP
        EKPO~MATNR
        EKPO~MENGE
        EKPO~NETPR INTO TABLE IT_POS
        FROM  EKKO INNER JOIN EKPO
                        ON   EKKO~EBELN = EKPO~EBELN
                      WHERE  EKKO~BUKRS IN S_BUKRS
                        AND  EKKO~EKORG IN S_EKORG.


*******************************************************
*      END OF SELECTION
*******************************************************
END-OF-SELECTION.
IF NOT IT_POS IS INITIAL.
LOOP AT IT_POS INTO WA_POS.
WRITE : 15 WA_POS-BUKRS ,
        17 WA_POS-LIFNR ,
        28 WA_POS-EKORG ,
        40 WA_POS-EBELN ,
        52 WA_POS-EBELP ,
        60 WA_POS-MATNR ,
        80 WA_POS-NETPR.
ENDLOOP.
ELSE.
WRITE : 1 ' NO RECORDS FOUND FOR THE GIVEN SELECTION' .

ENDIF.


******************************************************************
*                END OF PAGE
*******************************************************************

END-OF-PAGE.
uline.
WRITE : 'tech.sap29@gmail.com' .
uline.

1 comment: