Skip to Content
avatar image
Former Member

How to find how many days from PR release to PO release (sitting in buyers queue) need report

This seems like it should be fairly simple but I cannot figure it out (I am new to SAP/I did a search here as well).

what am I trying to do?

I am looking to find out how long orders sat in the buyers queue once the PR was release to them.  I need this for all PO's for this calendar year.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Oct 30, 2015 at 03:15 AM

    Hi,

    Please use below code which will give you clear picture for lead time for PR, PO release.

    *&---------------------------------------------------------*

    *& PROGRAM       :  Report  ZMMR001

    *& TITLE         :  PR to GR with lead time

    *& MODULE        :  MM                                     *

    *& CREATED BY    :  Kunwar Verma

    *& CREATED ON    :  01.06.2012

    *& FUNCTIONAL    :  ALOK                                   *

    *& BUSINESS OWNER:                                         *

    *& RELEASE       :  ECC 6.0                                *

    *&---------------------------------------------------------*



    REPORT  ZMMR001 NO STANDARD PAGE HEADING LINE-SIZE 400.

    ***type group



    TYPE-POOLS:SLIS.



    TABLES:EKKO,EKPO,EBAN , LFA1, T16FS , T16FD .



    DATA : BEGIN OF IT_EKKO OCCURS 0,

           EBELN TYPE EBELN,

           BSART TYPE BBSRT,

           ERNAM TYPE ERNAM,

           EKORG TYPE EKORG,

           EKGRP TYPE BKGRP,

           BEDAT TYPE EBDAT,

           FRGKE(25),

           MEMORY TYPE MEMER,

           LIFNR LIKE EKKO-LIFNR,

           ZTERM LIKE EKKO-ZTERM,

           FRGGR LIKE EKKO-FRGGR,

           FRGSX LIKE EKKO-FRGSX,

           FRGZU LIKE EKKO-FRGZU,

           FRGKE1 LIKE EKKO-FRGKE,

           UDATE LIKE CDHDR-UDATE ,

           MENGE LIKE EKPO-MENGE,

           NETPR LIKE EKPO-NETPR,

           FRGC  LIKE T16FS-FRGC1,

           LENGTH(2),

           PEND(4),

           FRGC1 LIKE T16FS-FRGC1,

           PEND_T(20),

           END OF IT_EKKO.



    DATA : BEGIN OF IT_EKPO OCCURS 0,

           EBELN TYPE EBELN,

           EBELP TYPE EBELP,

           TXZ01 TYPE TXZ01,

           MATNR TYPE MATNR,

           WERKS TYPE EWERK,

           BANFN TYPE BANFN,

           MTART TYPE MTART,

           AFNAM TYPE AFNAM,

           MENGE LIKE EKPO-MENGE,

           NETPR LIKE EKPO-NETPR,

           MEINS LIKE EKPO-MEINS,

           ELIKZ LIKE EKPO-ELIKZ,

           KNTTP LIKE EKPO-KNTTP,

           END OF IT_EKPO.



    DATA: BEGIN OF IT_EKET OCCURS 0,

            EBELN TYPE EKET-EBELN,

            EBELP TYPE EKET-EBELP,

            EINDT TYPE EKET-EINDT,

            WEMNG TYPE EKET-WEMNG,

          END OF IT_EKET.



    DATA : BEGIN OF IT_EBAN OCCURS 0,

           BANFN TYPE BANFN,

           BNFPO TYPE BNFPO,

           BSART TYPE BBSRT,

           LOEKZ TYPE ELOEK,

           EKGRP TYPE BKGRP,

           ERNAM TYPE ERNAM,

           AFNAM TYPE AFNAM,

           TXZ01 TYPE TXZ01,

           MATNR TYPE MATNR,

           WERKS TYPE EWERK,

           BEDNR TYPE BEDNR,

           BADAT TYPE BADAT,

           FRGDT TYPE FRGDT,

           EKORG TYPE EKORG,

           EBELN TYPE EBELN,

           EBELP TYPE EBELP,

           BEDAT TYPE BEDAT,

           FRGKZ TYPE FRGKZ,

           MENGE LIKE EBAN-MENGE,

           PREIS LIKE EBAN-PREIS,

           MEINS1 LIKE EBAN-MEINS,

           UDATE LIKE CDHDR-UDATE,

           OBJECTID   TYPE CDOBJECTV,

           OBJECTID2   TYPE CDOBJECTV,

           END OF IT_EBAN.



    DATA:BEGIN OF IT_CDPOS OCCURS 0,

         OBJECTCLAS TYPE CDOBJECTCL,

         OBJECTID   TYPE CDOBJECTV,

         CHANGENR   TYPE CDCHANGENR,

         TABNAME    TYPE TABNAME,

         TABKEY     TYPE CDTABKEY,

         FNAME      TYPE FIELDNAME,

         CDCHNGID   TYPE CDCHNGIND,

         VALUE_NEW  TYPE CDFLDVALN,

         VALUE_OLD  TYPE CDFLDVALO,

         END OF IT_CDPOS.



    DATA:BEGIN OF IT_CDPOS1 OCCURS 0,

         OBJECTCLAS TYPE CDOBJECTCL,

         OBJECTID   TYPE CDOBJECTV,

         CHANGENR   TYPE CDCHANGENR,

         TABNAME    TYPE TABNAME,

         TABKEY     TYPE CDTABKEY,

         FNAME      TYPE FIELDNAME,

         CDCHNGID   TYPE CDCHNGIND,

         VALUE_NEW  TYPE CDFLDVALN,

         VALUE_OLD  TYPE CDFLDVALO,

         END OF IT_CDPOS1.







    DATA:BEGIN OF IT_CDHDR OCCURS 0,

         OBJECTCLAS TYPE CDOBJECTCL,

         OBJECTID   TYPE CDOBJECTV,

         CHANGENR   TYPE CDCHANGENR,

         USERNAME   TYPE CDUSERNAME,

         UDATE      TYPE CDDATUM,

         UTIME      TYPE CDUZEIT,

         END OF IT_CDHDR.



    DATA:BEGIN OF IT_CDHDR1 OCCURS 0,

         OBJECTCLAS TYPE CDOBJECTCL,

         OBJECTID   TYPE CDOBJECTV,

         CHANGENR   TYPE CDCHANGENR,

         USERNAME   TYPE CDUSERNAME,

         UDATE      TYPE CDDATUM,

         UTIME      TYPE CDUZEIT,

         END OF IT_CDHDR1.



    DATA:BEGIN OF IT_T161T OCCURS 0,

         SPRAS      TYPE  SPRAS,

         BSART      TYPE  ESART,

         BSTYP      TYPE  BSTYP,

         BATXT      TYPE  BATXT,

         END OF IT_T161T .



    DATA:BEGIN OF IT_T134T OCCURS 0,

         SPRAS      TYPE  SPRAS,

         MTART      TYPE  MTART,

         MTBEZ      TYPE  MTBEZ,

         END OF IT_T134T .



    DATA:BEGIN OF IT_T024 OCCURS 0,

         EKGRP      TYPE  EKGRP,

         EKNAM      TYPE  EKNAM,

         END OF IT_T024 .



    DATA:BEGIN OF IT_MARA OCCURS 0,

         MATNR      TYPE  MATNR,

         MTART      TYPE  MTART,

         MTBEZ      TYPE  MTBEZ,

         END OF IT_MARA .





    DATA : BEGIN OF IT_FINAL OCCURS 0,

           BANFN TYPE BANFN,

           BNFPO TYPE BNFPO,

           BSART TYPE BBSRT,

           LOEKZ TYPE ELOEK,

           EKGRP TYPE BKGRP,

           ERNAM TYPE ERNAM,

           AFNAM TYPE AFNAM,

           TXZ01 TYPE TXZ01,

           MATNR TYPE MATNR,

           WERKS TYPE EWERK,

           BEDNR TYPE BEDNR,

           BADAT TYPE BADAT,

           FRGDT TYPE FRGDT,

           EKORG TYPE EKORG,

           EBELN TYPE EBELN,

           EBELP TYPE EBELP,

           BEDAT TYPE BEDAT,

           FRGKZ TYPE FRGKZ,

           FRGKE(25),

           E_TAGE4(20),

           E_TAGE1(20),

           E_TAGE2(20),

           E_TAGE3(20),

           UDATE LIKE CDHDR-UDATE ,

           V_UDATE LIKE SY-DATUM,

           BATXT TYPE  BATXT,

           MTART TYPE MTART,

           MTBEZ TYPE  MTBEZ,

           EKNAM TYPE  EKNAM,

           BELNR TYPE EKBE-BELNR,

           GJAHR TYPE EKBE-GJAHR,

           LIFNR LIKE EKKO-LIFNR,

           NAME1 LIKE LFA1-NAME1,

           MENGE LIKE EBAN-MENGE,

           PREIS LIKE EBAN-PREIS,

           MENGE_PO LIKE EKPO-MENGE,

           NETPR LIKE EKPO-NETPR,

           FRGCT LIKE T16FD-FRGCT,

           MEINS LIKE EKPO-MEINS,

           MEINS1 LIKE EBAN-MEINS,

           ERNAM1  LIKE EKKO-ERNAM,

           FRGZU LIKE EKKO-FRGZU,

           FRGKE1 LIKE EKKO-FRGKE,

           PENDING(20),

           FRGGR LIKE EKKO-FRGGR,

           FRGSX LIKE EKKO-FRGSX,

           FRGC1 LIKE T16FS-FRGC1,

           PEND(4),

           PEND_T(20),

           EINDT LIKE EKET-EINDT,

           WEMNG TYPE EKET-WEMNG,

           ELIKZ LIKE EKPO-ELIKZ,

           OPN_QTY LIKE EKPO-MENGE,

           ZTERM LIKE EKKO-ZTERM,

           TEXT1 LIKE T052U-TEXT1,



            BUZEI TYPE EKBE-BUZEI,

            BUDAT TYPE EKBE-BUDAT,

            W_GRN_PO_DAY TYPE I,

            W_PO_RELE_GRN_DAY TYPE I,

            MENGE_EKBE TYPE EKBE-MENGE,

            KNTTP LIKE EKPO-KNTTP,

            ANLN1  like EBKN-ANLN1 ,

            KOSTL like EBKN-KOSTL,

            dmbtr like ekbe-dmbtr,

           END OF IT_FINAL,







    BEGIN OF WA_OUTPUT,

           BANFN TYPE BANFN,

           BNFPO TYPE BNFPO,

           BSART TYPE BBSRT,

           LOEKZ TYPE ELOEK,

           EKGRP TYPE BKGRP,

           ERNAM TYPE ERNAM,

           AFNAM TYPE AFNAM,

           TXZ01 TYPE TXZ01,

           MATNR TYPE MATNR,

           WERKS TYPE EWERK,

           BEDNR TYPE BEDNR,

           BADAT TYPE BADAT,

           FRGDT TYPE FRGDT,

           EKORG TYPE EKORG,

           EBELN TYPE EBELN,

           EBELP TYPE EBELP,

           BEDAT TYPE BEDAT,

           FRGKZ TYPE FRGKZ,

           FRGKE(25),

           E_TAGE4(20),

           E_TAGE1(20),

           E_TAGE2(20),

           E_TAGE3(20),

           UDATE TYPE CDDATUM,

           V_UDATE TYPE SY-DATUM,

           BATXT TYPE  BATXT,

           MTART TYPE MTART,

           MTBEZ TYPE  MTBEZ,

           EKNAM TYPE  EKNAM,

           BELNR TYPE EKBE-BELNR,

           GJAHR TYPE EKBE-GJAHR,

    END OF WA_OUTPUT.



    DATA: BEGIN OF T_EKBE OCCURS 0,

            EBELN TYPE EKBE-EBELN,

            EBELP TYPE EKBE-EBELP,

            VGABE TYPE EKBE-VGABE,

            GJAHR TYPE EKBE-GJAHR,

            BELNR TYPE EKBE-BELNR,

            BUZEI TYPE EKBE-BUZEI,

            BUDAT TYPE EKBE-BUDAT,

            MENGE TYPE EKBE-MENGE,

            DMBTR type ekbe-DMBTR,

          END OF T_EKBE.





    TYPES: BEGIN OF T_MSEGT,

            MBLNR TYPE MSEG-MBLNR,

            MJAHR TYPE MSEG-MJAHR,

            ZEILE TYPE MSEG-ZEILE,

            MEINS TYPE MSEG-MEINS,

            SJAHR TYPE MSEG-SJAHR,

            SMBLN TYPE MSEG-SMBLN,

            SMBLP TYPE MSEG-SMBLP,

           END OF T_MSEGT.



    DATA : T_MSEG TYPE STANDARD TABLE OF T_MSEGT WITH HEADER LINE.

    DATA : T_EBKN TYPE STANDARD TABLE OF EBKN WITH HEADER LINE.

    REFRESH : T_MSEG.





    DATA : T_TEMP LIKE IT_FINAL OCCURS 0 WITH HEADER LINE.



    *Alv Declarations



    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

           IT_EVENTS   TYPE SLIS_T_EVENT,

           WA_EVENT    TYPE SLIS_ALV_EVENT,

           GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,

           WA_LINE TYPE SLIS_LISTHEADER,

           IT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,

           G_TOP_OF_PAGE  TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.



    DATA : G_REPID LIKE SY-REPID.



    DATA : GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

           GT_EVENTS TYPE   SLIS_T_EVENT,

           GT_SORT     TYPE SLIS_T_SORTINFO_ALV.



    DATA: BEGIN OF IT_T16FS OCCURS 0 .

            INCLUDE STRUCTURE T16FS.

    DATA: END OF IT_T16FS.



    DATA: BEGIN OF IT_T16FS_A OCCURS 0 ,

            FRGGR LIKE T16FS-FRGGR,

            FRGSX  LIKE T16FS-FRGSX,

            FRGC  LIKE T16FS-FRGC1,

            CNT(2) TYPE C,

            PEND(4),

            CNT_1(2) TYPE C,

          END OF IT_T16FS_A.



    DATA: BEGIN OF IT_T16FD_1 OCCURS 0 .

            INCLUDE STRUCTURE T16FD.

    DATA: END OF IT_T16FD_1.



    DATA: DATE01 LIKE VTBBEWE-DBERBIS,

          DATE02 LIKE VTBBEWE-DBERVON,

          DATE03 LIKE VTBBEWE-DBERVON,

          DATE04 LIKE VTBBEWE-DBERVON,

          DATE05 LIKE VTBBEWE-DBERVON,

          DATE06 LIKE VTBBEWE-DBERVON,

          DATE07 LIKE VTBBEWE-DBERVON,

          DATE08 LIKE VTBBEWE-DBERVON,

          E_TAGE4(20),

           E_TAGE1(20),

           E_TAGE2(20),

           E_TAGE3(20).



    DATA : W_DAY TYPE I.

    DATA : W_GRN_PO_DAY TYPE I.

    DATA : W_PO_RELE_GRN_DAY TYPE I.

    CLEAR : W_GRN_PO_DAY , W_PO_RELE_GRN_DAY.



    ***selection-screen



    SELECTION-SCREEN:BEGIN OF BLOCK A1 WITH FRAME TITLE  TEXT-001.

    SELECT-OPTIONS:S_BANFN FOR EBAN-BANFN,

                   S_BADAT FOR EBAN-BADAT,

                   S_EKGRP FOR EKKO-EKGRP,

                   S_EKORG FOR EKKO-EKORG,

                   S_WERKS FOR EKPO-WERKS OBLIGATORY,

                   S_BSART FOR EBAN-BSART,

                   S_AFNAM FOR EBAN-AFNAM,

                   S_EBELN FOR EBAN-EBELN.



    PARAMETER:S_ERNAM LIKE EBAN-ERNAM,

              S_ERNAM1 LIKE EKKO-ERNAM.



    SELECTION-SCREEN:END OF BLOCK A1.







    ***AT-Selction screen

    START-OF-SELECTION.

      PERFORM GET_DATA.

      PERFORM DISPLAY_DATA.

    *&---------------------------------------------------------------------*

    *&      Form  GET_DATA

    *&---------------------------------------------------------------------*

    *       text

    *----------------------------------------------------------------------*

    *  -->  p1        text

    *  <--  p2        text

    *----------------------------------------------------------------------*

    FORM GET_DATA .



      SELECT BANFN

             BNFPO

             BSART

             LOEKZ

             EKGRP

             ERNAM

             AFNAM

             TXZ01

             MATNR

             WERKS

             BEDNR

             BADAT

             FRGDT

             EKORG

             EBELN

             EBELP

             BEDAT

             FRGKZ

             MENGE

             PREIS

             MEINS

             FROM EBAN INTO TABLE IT_EBAN WHERE BANFN IN S_BANFN

                                          AND   BADAT IN S_BADAT

                                          AND   AFNAM IN S_AFNAM

                                          AND   EKGRP IN S_EKGRP

                                          AND   EKORG IN S_EKORG

                                          AND   WERKS IN S_WERKS

                                          AND   BSART IN S_BSART

                                          AND   LOEKZ NE 'X'

                                          AND   FRGKZ IN ('R','2')

                                          AND   EBELN IN S_EBELN.

    *FOR PR



      IF NOT IT_EBAN[] IS INITIAL.

        SELECT * FROM EBKN INTO TABLE T_EBKN FOR ALL ENTRIES IN IT_EBAN

                                            WHERE BANFN = IT_EBAN-BANFN

                                             AND  BNFPO = IT_EBAN-BNFPO.

      ENDIF.



      LOOP AT IT_EBAN .



        SELECT OBJECTCLAS

            OBJECTID

            CHANGENR

            TABNAME

            TABKEY

            FNAME

            CHNGIND

            VALUE_NEW

            VALUE_OLD

            FROM CDPOS APPENDING TABLE IT_CDPOS1

            WHERE    OBJECTCLAS = 'BANF' AND

                     OBJECTID   = IT_EBAN-BANFN AND

                     TABNAME    = 'EBAN' AND

                     FNAME      = 'FRGKZ' AND

                     CHNGIND    = 'U'

                    AND VALUE_NEW  IN ('2','R').

      ENDLOOP.



      IF NOT IT_CDPOS1[] IS INITIAL.

        SELECT OBJECTCLAS

               OBJECTID

               CHANGENR

               USERNAME

               UDATE

               UTIME

               FROM CDHDR INTO TABLE IT_CDHDR1 FOR ALL ENTRIES IN IT_CDPOS1

                       WHERE  OBJECTCLAS = IT_CDPOS1-OBJECTCLAS AND

                              OBJECTID   = IT_CDPOS1-OBJECTID AND

                              CHANGENR   = IT_CDPOS1-CHANGENR.







      ENDIF.





      IF NOT IT_EBAN[] IS INITIAL.



        SELECT EBELN

               EBELP

               TXZ01

               MATNR

               WERKS

               BANFN

               MTART

               AFNAM

               MENGE

               NETPR

               MEINS

               ELIKZ

               KNTTP

               FROM EKPO INTO TABLE IT_EKPO FOR ALL ENTRIES IN IT_EBAN

                                            WHERE WERKS IN S_WERKS

                                            AND  AFNAM IN S_AFNAM

                                            AND  BSTYP = 'F'

                                            AND  BANFN = IT_EBAN-BANFN

                                            AND  AFNAM IN S_AFNAM

                                            AND  LOEKZ NE 'X'.

        IF NOT IT_EKPO[] IS INITIAL.



    **      SELECT ebeln

    **             bsart

    **             ernam

    **             ekorg

    **             ekgrp

    **             bedat

    **             frgke

    **             memory

    **             lifnr

    **             zterm

    **             frggr

    **             frgsx

    **             frgzu

    **             frgke

    **             FROM ekko INTO TABLE it_ekko FOR ALL ENTRIES IN it_ekpo

    **                                              WHERE ernam IN s_ernam

    **                                              AND   ekorg IN s_ekorg

    **                                              AND   ekgrp IN s_ekgrp

    **                                              AND   bsart IN s_bsart

    **                                              AND   ebeln = it_ekpo-ebeln

    **                                              AND   memory NE 'X'.



          SELECT EBELN

                 BSART

                 ERNAM

                 EKORG

                 EKGRP

                 BEDAT

                 FRGKE

                 MEMORY

                 LIFNR

                 ZTERM

                 FRGGR

                 FRGSX

                 FRGZU

                 FRGKE

                 FROM EKKO INTO TABLE IT_EKKO FOR ALL ENTRIES IN IT_EKPO

                                                  WHERE

    *        ernam IN s_ernam1

                                                  EBELN = IT_EKPO-EBELN

                                                  AND    MEMORY NE 'X'.





    *For GR Qty

          SELECT EBELN

                 EBELP

                 EINDT

                 WEMNG FROM EKET INTO TABLE IT_EKET

                 FOR ALL ENTRIES IN IT_EKPO

                 WHERE EBELN = IT_EKPO-EBELN

                 AND   EBELP = IT_EKPO-EBELP.



        ENDIF.





        IF NOT IT_EKKO[] IS INITIAL.

          SELECT * FROM T16FS INTO TABLE IT_T16FS FOR ALL ENTRIES IN IT_EKKO

                       WHERE FRGGR = IT_EKKO-FRGGR

                       AND   FRGSX = IT_EKKO-FRGSX.

        ENDIF.



        DATA:CNT(2) TYPE C.

        LOOP AT IT_T16FS.

          IT_T16FS_A-FRGGR = IT_T16FS-FRGGR.

          IT_T16FS_A-FRGSX = IT_T16FS-FRGSX.

    *Append It_T16FS_A.



          IF NOT IT_T16FS-FRGC8 IS INITIAL.

            IT_T16FS_A-FRGC = IT_T16FS-FRGC8.

    *cnt = cnt + 1 .

            CNT = 8 . .

            IT_T16FS_A-CNT =  CNT .

            APPEND IT_T16FS_A.

          ENDIF.

          IF NOT IT_T16FS-FRGC7 IS INITIAL.

            IT_T16FS_A-FRGC = IT_T16FS-FRGC7.

    *cnt = cnt + 1 .

            CNT = 7 .

            IT_T16FS_A-CNT =  CNT .

            APPEND IT_T16FS_A.

          ENDIF.

          IF NOT IT_T16FS-FRGC6 IS INITIAL.

            IT_T16FS_A-FRGC = IT_T16FS-FRGC6.

    *cnt = cnt + 1 .

            CNT = 6 .

            IT_T16FS_A-CNT =  CNT .

            APPEND IT_T16FS_A.

          ENDIF.

          IF NOT IT_T16FS-FRGC5 IS INITIAL.

            IT_T16FS_A-FRGC = IT_T16FS-FRGC5..

    *cnt = cnt + 1 .

            CNT = 5 .

            IT_T16FS_A-CNT =  CNT .

            APPEND IT_T16FS_A.

          ENDIF.

          IF NOT IT_T16FS-FRGC4 IS INITIAL.

            IT_T16FS_A-FRGC = IT_T16FS-FRGC4.

    *cnt = cnt + 1 .

            CNT = 4 .

            IT_T16FS_A-CNT =  CNT .

            APPEND IT_T16FS_A.

          ENDIF.

          IF NOT IT_T16FS-FRGC3 IS INITIAL.

            IT_T16FS_A-FRGC = IT_T16FS-FRGC3.

    *cnt = cnt + 1 .

            CNT = 3 .

            IT_T16FS_A-CNT =  CNT .

            APPEND IT_T16FS_A.

          ENDIF.

          IF NOT IT_T16FS-FRGC2 IS INITIAL.

            IT_T16FS_A-FRGC = IT_T16FS-FRGC2.

    *cnt = cnt + 1 .

            CNT = 2 .

            IT_T16FS_A-CNT =  CNT .

            APPEND IT_T16FS_A.

          ENDIF.

          IF NOT IT_T16FS-FRGC1 IS INITIAL.

            IT_T16FS_A-FRGC = IT_T16FS-FRGC1.

    *cnt = cnt + 1 .

            CNT = 1 .

            IT_T16FS_A-CNT =  CNT .

            APPEND IT_T16FS_A.

          ENDIF.

          CLEAR CNT .

        ENDLOOP.



        DATA: LENGTH(2) .

        LOOP AT IT_EKKO.

          LENGTH = STRLEN( IT_EKKO-FRGZU ).

          LENGTH  = LENGTH + 1.

          IT_EKKO-LENGTH = LENGTH.

          MODIFY IT_EKKO TRANSPORTING LENGTH.

          CLEAR LENGTH .

        ENDLOOP.

        DATA:PEND(4).



        LOOP AT IT_EKKO .

          LOOP AT IT_T16FS_A .

            IF IT_T16FS_A-FRGGR = IT_EKKO-FRGGR AND  IT_T16FS_A-FRGSX = IT_EKKO-FRGSX.

    *                          AND    CNT    = IT_EKKO-LENGTH.

    *        IF SY-SUBRC EQ 0.

              IF IT_EKKO-FRGKE = 'I'.

                IT_EKKO-PEND = IT_T16FS_A-FRGC.

              ELSEIF IT_EKKO-FRGKE1 = 'F'.

                IT_EKKO-PEND = ' '.

              ELSEIF IT_EKKO-FRGKE1 = 'N'.

                SELECT SINGLE FRGC1  FROM T16FS INTO IT_EKKO-FRGC1

                   WHERE FRGGR = IT_EKKO-FRGGR

                   AND FRGSX = IT_EKKO-FRGSX.

                IT_EKKO-PEND = IT_EKKO-FRGC1.

              ENDIF.

              MODIFY IT_EKKO TRANSPORTING PEND.

            ENDIF.

          ENDLOOP.

    *clear

        ENDLOOP.



        LOOP AT IT_EKKO .

          SELECT SINGLE * FROM T16FD INTO IT_T16FD_1

            WHERE  FRGGR = IT_EKKO-FRGGR

            AND    FRGCO = IT_EKKO-PEND.

          IF SY-SUBRC EQ 0 .

            IT_EKKO-PEND_T = IT_T16FD_1-FRGCT.

            MODIFY IT_EKKO TRANSPORTING PEND_T.

          ENDIF.

        ENDLOOP.



        SORT IT_T16FS_A  DESCENDING BY FRGGR FRGSX CNT.

        DATA: CNT_1(2).

    *loop at It_T16FS_A.

    * cnt_1 = cnt_1 + 1.

    * It_T16FS_A-CNt_1 = cnt_1 .

    * modify It_T16FS_A transporting cnt_1.

    *endloop.

        DELETE ADJACENT DUPLICATES FROM IT_T16FS_A COMPARING FRGGR FRGSX .



    *Delete It_T16FS_A where Cnt <> 1 .

        LOOP AT IT_EKKO.

          READ TABLE IT_T16FS_A WITH KEY FRGGR = IT_EKKO-FRGGR

                                         FRGSX = IT_EKKO-FRGSX.

          IF SY-SUBRC EQ 0.

            MOVE IT_T16FS_A-FRGC TO IT_EKKO-FRGC.

            MOVE IT_T16FS_A-FRGGR TO IT_EKKO-FRGGR.

            MOVE IT_T16FS_A-FRGSX TO IT_EKKO-FRGSX.

            MODIFY IT_EKKO TRANSPORTING FRGC FRGGR FRGSX.

          ENDIF.

        ENDLOOP.



        SELECT SPRAS

               BSART

               BSTYP

               BATXT

               FROM T161T INTO TABLE IT_T161T FOR ALL ENTRIES IN IT_EBAN

                                                  WHERE BSART = IT_EBAN-BSART

                                                  AND   SPRAS = 'E' .

        SELECT EKGRP

               EKNAM

               FROM T024 INTO TABLE IT_T024 FOR ALL ENTRIES IN IT_EBAN

                                                  WHERE EKGRP = IT_EBAN-EKGRP.



        SELECT MATNR

               MTART

               FROM  MARA INTO TABLE IT_MARA FOR ALL ENTRIES IN IT_EBAN

                                                  WHERE MATNR = IT_EBAN-MATNR.





        SELECT  SPRAS

                MTART

                MTBEZ

                FROM T134T INTO TABLE IT_T134T FOR ALL ENTRIES IN IT_MARA

                                                     WHERE MTART = IT_MARA-MTART

                                                     AND   SPRAS = 'E' .



    *FOR PO

        LOOP AT IT_EBAN.

          IT_EBAN-OBJECTID2 = IT_EBAN-EBELN.

          MODIFY IT_EBAN.

        ENDLOOP.







        SELECT OBJECTCLAS

               OBJECTID

               CHANGENR

               TABNAME

               TABKEY

               FNAME

               CHNGIND

               VALUE_NEW

               VALUE_OLD

               FROM CDPOS INTO TABLE IT_CDPOS

               FOR ALL ENTRIES IN IT_EBAN

               WHERE OBJECTCLAS    = 'EINKBELEG' AND

    *                 OBJECTID      = IT_EBAN-EBELN  AND

                     OBJECTID      = IT_EBAN-OBJECTID2  AND

                     TABNAME       = 'EKKO' AND

                     FNAME         = 'FRGKE' AND

                     CHNGIND       = 'U' AND

                     VALUE_NEW     = 'F'.





        SORT IT_CDPOS BY OBJECTCLAS OBJECTID CHANGENR DESCENDING.

        DELETE ADJACENT DUPLICATES FROM IT_CDPOS COMPARING OBJECTCLAS OBJECTID.



        IF IT_CDPOS[] IS NOT INITIAL.

          SELECT OBJECTCLAS

                 OBJECTID

                 CHANGENR

                 USERNAME

                 UDATE

                 UTIME

                 FROM CDHDR INTO TABLE IT_CDHDR FOR ALL ENTRIES IN IT_CDPOS

                 WHERE    OBJECTCLAS = IT_CDPOS-OBJECTCLAS AND

                          OBJECTID   = IT_CDPOS-OBJECTID AND

                          CHANGENR   = IT_CDPOS-CHANGENR.

        ENDIF.





      ENDIF.



      SORT IT_CDHDR  DESCENDING BY OBJECTID UDATE UTIME.

      SORT IT_CDHDR1 DESCENDING BY OBJECTID UDATE UTIME.





      IF IT_EKPO[] IS NOT INITIAL.

        SELECT  EBELN

                EBELP

                VGABE

                GJAHR

                BELNR

                BUZEI

                BUDAT

                MENGE

                DMBTR FROM EKBE INTO TABLE T_EKBE

                FOR ALL ENTRIES IN IT_EKPO

                WHERE EBELN = IT_EKPO-EBELN

                AND   EBELP = IT_EKPO-EBELP

                AND   VGABE = '1'.



      ENDIF.









      IF T_EKBE[] IS NOT INITIAL.



        SELECT MBLNR

              MJAHR

              ZEILE

              MEINS

              SJAHR

              SMBLN

              SMBLP FROM MSEG INTO TABLE T_MSEG

              FOR ALL ENTRIES IN T_EKBE

              WHERE MBLNR = T_EKBE-BELNR

              AND   MJAHR = T_EKBE-GJAHR.



      ENDIF.



      LOOP AT T_MSEG WHERE  SMBLN IS NOT INITIAL.

        DELETE  T_EKBE WHERE BELNR = T_MSEG-MBLNR

                       AND   BUZEI = T_MSEG-ZEILE

                       AND   GJAHR = T_MSEG-MJAHR.



        DELETE  T_EKBE WHERE BELNR = T_MSEG-SMBLN

                       AND   BUZEI = T_MSEG-SMBLP

                       AND   GJAHR = T_MSEG-SJAHR.



      ENDLOOP.







      LOOP AT IT_EBAN.



        CLEAR IT_FINAL.



        IT_FINAL-BANFN      =  IT_EBAN-BANFN.

        IT_FINAL-BNFPO      =  IT_EBAN-BNFPO.

        IT_FINAL-BSART      =  IT_EBAN-BSART.

        IT_FINAL-EKGRP      =  IT_EBAN-EKGRP.

        IT_FINAL-ERNAM      =  IT_EBAN-ERNAM.

        IT_FINAL-AFNAM      =  IT_EBAN-AFNAM.

        IT_FINAL-TXZ01      =  IT_EBAN-TXZ01.

        IT_FINAL-MATNR      =  IT_EBAN-MATNR.

        IT_FINAL-WERKS      =  IT_EBAN-WERKS.

        IT_FINAL-BEDNR      =  IT_EBAN-BEDNR.

        IT_FINAL-BADAT      =  IT_EBAN-BADAT.

        IT_FINAL-FRGDT      =  IT_EBAN-FRGDT.

        IT_FINAL-EBELN      =  IT_EBAN-EBELN.

        IT_FINAL-EBELP      =  IT_EBAN-EBELP.

        IT_FINAL-BEDAT      =  IT_EBAN-BEDAT.

        IT_FINAL-PREIS      =  IT_EBAN-PREIS.

        IT_FINAL-MENGE      =  IT_EBAN-MENGE.

        IT_FINAL-MEINS1      =  IT_EBAN-MEINS1.

        IT_FINAL-EKORG      =  IT_EBAN-EKORG.

    *    IT_FINAL-V_UDATE    =  IT_EBAN-FRGDT.



    READ TABLE T_EBKN WITH KEY BANFN = IT_EBAN-BANFN

                               BNFPO = IT_EBAN-BNFPO.

    if Sy-subrc EQ 0 .

      it_final-KOSTL = T_EBKN-KOSTL.

      it_final-ANLN1 = T_EBKN-ANLN1.

    endif.



        READ TABLE IT_EKPO WITH KEY EBELN = IT_EBAN-EBELN

                                    EBELP = IT_EBAN-EBELP.

    *    IF SY-SUBRC EQ 0 .



        IF SY-SUBRC EQ 0 .

          IT_FINAL-NETPR      =   IT_EKPO-NETPR.

          IT_FINAL-MENGE_PO   =   IT_EKPO-MENGE.

          IT_FINAL-MEINS      =   IT_EKPO-MEINS.

          IT_FINAL-ELIKZ      =   IT_EKPO-ELIKZ.

          IT_FINAL-KNTTP      =   IT_EKPO-KNTTP.



        ENDIF.



        READ TABLE IT_EKET WITH KEY EBELN = IT_EBAN-EBELN

                                    EBELP = IT_EBAN-EBELP.

        IF SY-SUBRC = 0.

          IT_FINAL-EINDT = IT_EKET-EINDT.

          IT_FINAL-WEMNG = IT_EKET-WEMNG.

        ENDIF.



        IT_FINAL-OPN_QTY = IT_FINAL-MENGE_PO - IT_FINAL-WEMNG.



        SHIFT IT_FINAL-MATNR LEFT DELETING LEADING '0'.





        CLEAR IT_EKKO.

        READ TABLE IT_EKKO WITH KEY EBELN = IT_EBAN-EBELN .

        IF SY-SUBRC = 0.

    *      it_final-ekorg      =  it_ekko-ekorg.

          IT_FINAL-FRGKE      =  IT_EKKO-FRGKE.

          IT_FINAL-LIFNR      = IT_EKKO-LIFNR .

          IT_FINAL-ZTERM      = IT_EKKO-ZTERM.

          IT_FINAL-ERNAM1     = IT_EKKO-ERNAM .

          IT_FINAL-FRGKE1     = IT_EKKO-FRGKE .

          IT_FINAL-FRGZU      = IT_EKKO-FRGZU.

          IT_FINAL-FRGGR      = IT_EKKO-FRGGR .

          IT_FINAL-FRGSX      = IT_EKKO-FRGSX.

          IT_FINAL-PEND_T     = IT_EKKO-PEND_T.



          SELECT SINGLE NAME1 FROM LFA1 INTO LFA1-NAME1 WHERE LIFNR = IT_EKKO-LIFNR.

          IF SY-SUBRC EQ 0.

            IT_FINAL-NAME1 = LFA1-NAME1 .

          ENDIF.



          SELECT SINGLE TEXT1 FROM T052U INTO IT_FINAL-TEXT1

          WHERE SPRAS = SY-LANGU

          AND ZTERM = IT_EKKO-ZTERM.





          SELECT SINGLE FRGCT FROM T16FD INTO T16FD-FRGCT

               WHERE FRGGR = IT_EKKO-FRGGR

               AND FRGCO = IT_EKKO-FRGC.

          IF SY-SUBRC EQ 0.

            IT_FINAL-FRGCT = T16FD-FRGCT .

          ENDIF.

        ENDIF.



        IF IT_EKKO-FRGKE = 'F'.

          CLEAR IT_CDHDR.

          READ TABLE IT_CDHDR WITH KEY OBJECTID = IT_EBAN-EBELN.

          IF SY-SUBRC = 0.

            IT_FINAL-UDATE      =  IT_CDHDR-UDATE.

          ENDIF.

        ENDIF.



        CLEAR IT_CDHDR1.

    *    FRGDT

        READ TABLE IT_CDHDR1 WITH KEY OBJECTID = IT_EBAN-BANFN.

        IF SY-SUBRC = 0.

          IT_FINAL-V_UDATE      =  IT_CDHDR1-UDATE.

        ENDIF.



        CLEAR IT_T161T.

        READ TABLE IT_T161T WITH KEY BSART = IT_EBAN-BSART.

        IF SY-SUBRC = 0.

          IT_FINAL-BATXT      =  IT_T161T-BATXT.

        ENDIF.





        CLEAR IT_T024.

        READ TABLE IT_T024 WITH KEY EKGRP = IT_EBAN-EKGRP.

        IF SY-SUBRC = 0.

          IT_FINAL-EKNAM      =  IT_T024-EKNAM.

        ENDIF.



        CLEAR IT_MARA.

        READ TABLE IT_MARA WITH KEY MATNR = IT_EBAN-MATNR.

        IF SY-SUBRC = 0.

          IT_FINAL-MTART      =  IT_MARA-MTART.

          CLEAR IT_T134T.

          READ TABLE IT_T134T WITH KEY MTART = IT_MARA-MTART.

          IF SY-SUBRC = 0.

            IT_FINAL-MTBEZ      =  IT_T134T-MTBEZ.

          ENDIF.

        ENDIF.

        APPEND IT_FINAL.

      ENDLOOP.



      LOOP AT IT_FINAL.

        IF IT_FINAL-FRGKE1 = 'F'.

          IT_FINAL-FRGKE = 'Released'.

    *      it_final-pending = ' '.

        ENDIF.

        IF IT_FINAL-FRGKE1 = 'N'.

          IT_FINAL-FRGKE = 'Not Released'.

          SELECT SINGLE FRGC1  FROM T16FS INTO IT_FINAL-FRGC1

           WHERE FRGGR = IT_FINAL-FRGGR

           AND FRGSX = IT_FINAL-FRGSX.

    *     it_final-pending = it_final-FRGC1.

        ENDIF.

        IF IT_FINAL-FRGKE1 = 'I'.

          IT_FINAL-FRGKE = 'Intermediate Released'.

        ENDIF.

        MODIFY IT_FINAL.

      ENDLOOP.





      LOOP AT IT_FINAL.



    *1.pr create to pr release---------------------------------------------



        DATE05 = SY-DATUM.



        IF IT_FINAL-V_UDATE = '00000000'.

          CLEAR W_DAY.

          CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

            EXPORTING

              BEGDA = IT_FINAL-BADAT

              ENDDA = DATE05

            IMPORTING

              DAYS  = W_DAY.







        ELSE.



          CLEAR W_DAY.

          CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

            EXPORTING

              BEGDA = IT_FINAL-BADAT

              ENDDA = IT_FINAL-V_UDATE

            IMPORTING

              DAYS  = W_DAY.



        ENDIF.



        IF W_DAY LE 0.

          W_DAY = W_DAY + 1.

        ELSE.

          W_DAY = W_DAY - 1.

        ENDIF.



        MOVE W_DAY TO IT_FINAL-E_TAGE2.

    *--------------------------------------------------------------------------

    *2.pr release  to po create-----





        DATE02 = SY-DATUM.



        IF IT_FINAL-BEDAT = '00000000'.





          CLEAR W_DAY.

          CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

            EXPORTING

              BEGDA = IT_FINAL-V_UDATE

              ENDDA = DATE02

            IMPORTING

              DAYS  = W_DAY.



    *adding step 15



          CLEAR W_DAY.

          CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

            EXPORTING

              BEGDA = IT_FINAL-BADAT

              ENDDA = DATE04

            IMPORTING

              DAYS  = W_DAY.







        ELSE.



          CLEAR W_DAY.

          CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

            EXPORTING

              BEGDA = IT_FINAL-V_UDATE

              ENDDA = IT_FINAL-BEDAT

            IMPORTING

              DAYS  = W_DAY.





    * ----------------------OR---------------------------

          DATE06 = SY-DATUM.



          IF IT_FINAL-V_UDATE = '00000000'.



            CLEAR W_DAY.

            CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

              EXPORTING

                BEGDA = IT_FINAL-BEDAT

                ENDDA = DATE06

              IMPORTING

                DAYS  = W_DAY.









          ELSE.





            CLEAR W_DAY.

            CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

              EXPORTING

                BEGDA = IT_FINAL-V_UDATE

                ENDDA = IT_FINAL-BEDAT

              IMPORTING

                DAYS  = W_DAY.







          ENDIF.





        ENDIF.



        IF W_DAY LE 0.

          W_DAY = W_DAY + 1.

        ELSE.

          W_DAY = W_DAY - 1.

        ENDIF.



        MOVE W_DAY TO IT_FINAL-E_TAGE4.



    *---------------------------------------------------------------------------------------

    *3.po create to po release----





        DATE03 = SY-DATUM.



        IF IT_FINAL-UDATE = '00000000'.





          CLEAR W_DAY.

          CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

            EXPORTING

              BEGDA = IT_FINAL-BEDAT

              ENDDA = DATE03

            IMPORTING

              DAYS  = W_DAY.







        ELSE.



          CLEAR W_DAY.

          CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

            EXPORTING

              BEGDA = IT_FINAL-BEDAT

              ENDDA = IT_FINAL-UDATE

            IMPORTING

              DAYS  = W_DAY.





    * ----------------------OR---------------------------

          DATE07 = SY-DATUM.



          IF IT_FINAL-BEDAT = '00000000'.





            CLEAR W_DAY.

            CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

              EXPORTING

                BEGDA = IT_FINAL-UDATE

                ENDDA = DATE07

              IMPORTING

                DAYS  = W_DAY.



    ** adding step 16---------------------



            CLEAR W_DAY.

            CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

              EXPORTING

                BEGDA = IT_FINAL-V_UDATE

                ENDDA = DATE02

              IMPORTING

                DAYS  = W_DAY.





            CLEAR W_DAY.

            CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

              EXPORTING

                BEGDA = IT_FINAL-BADAT

                ENDDA = DATE04

              IMPORTING

                DAYS  = W_DAY.







          ELSE.



            CLEAR W_DAY.

            CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

              EXPORTING

                BEGDA = IT_FINAL-BEDAT

                ENDDA = IT_FINAL-UDATE

              IMPORTING

                DAYS  = W_DAY.



          ENDIF.

        ENDIF.



        IF  IT_FINAL-BEDAT = '00000000' AND   IT_FINAL-BEDAT = '00000000'.

          E_TAGE1 = '0'.

          W_DAY = 0.

        ELSE.

          IF W_DAY LE 0.

            W_DAY = W_DAY + 1.

          ELSE.

            W_DAY = W_DAY - 1.

          ENDIF.





        ENDIF.







        MOVE W_DAY TO IT_FINAL-E_TAGE1.



    *--------------------------------------------------------------------------------------------

    *4.total lead time-----------





        DATE04 = SY-DATUM.



        IF IT_FINAL-UDATE = '00000000'.





          CLEAR W_DAY.

          CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

            EXPORTING

              BEGDA = IT_FINAL-BADAT

              ENDDA = DATE04

            IMPORTING

              DAYS  = W_DAY.





        ELSE.



          CLEAR W_DAY.

          CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

            EXPORTING

              BEGDA = IT_FINAL-BADAT

              ENDDA = IT_FINAL-UDATE

            IMPORTING

              DAYS  = W_DAY.



        ENDIF.





        IF W_DAY LE 0.

          W_DAY = W_DAY + 1.

        ELSE.

          W_DAY = W_DAY - 1.

        ENDIF.



        MOVE W_DAY TO IT_FINAL-E_TAGE3.



    *GRN  Post date - PO Release date

        CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

          EXPORTING

            BEGDA = IT_FINAL-BUDAT

            ENDDA = IT_FINAL-V_UDATE

          IMPORTING

            DAYS  = W_GRN_PO_DAY.



        MOVE W_GRN_PO_DAY TO IT_FINAL-W_GRN_PO_DAY.





    **PR Release to GRN

        IT_FINAL-W_PO_RELE_GRN_DAY = IT_FINAL-W_GRN_PO_DAY + IT_FINAL-E_TAGE3.



        MODIFY IT_FINAL TRANSPORTING  E_TAGE1 E_TAGE2 E_TAGE3 E_TAGE4 W_GRN_PO_DAY W_PO_RELE_GRN_DAY.





      ENDLOOP.

    *count





      LOOP AT IT_FINAL.

    *For GRN No

        READ TABLE T_EKBE WITH KEY EBELN = IT_FINAL-EBELN

                                   EBELP = IT_FINAL-EBELP.

        IF SY-SUBRC = 0.

          LOOP AT T_EKBE WHERE EBELN = IT_FINAL-EBELN

                         AND   EBELP = IT_FINAL-EBELP.



            IT_FINAL-BELNR      =  T_EKBE-BELNR.

            IT_FINAL-GJAHR      =  T_EKBE-GJAHR.

            IT_FINAL-BUZEI      =  T_EKBE-BUZEI.

            IT_FINAL-BUDAT      =  T_EKBE-BUDAT.

            IT_FINAL-MENGE_EKBE =  T_EKBE-MENGE.

            IT_FINAL-DMBTR     =  T_EKBE-DMBTR.

            T_TEMP = IT_FINAL.

            APPEND T_TEMP.

            CLEAR T_TEMP.

          ENDLOOP.



        ELSE.

          CLEAR : IT_FINAL-BELNR,IT_FINAL-GJAHR,IT_FINAL-BUZEI.

          T_TEMP = IT_FINAL.

          APPEND T_TEMP.

          CLEAR T_TEMP.

        ENDIF.



      ENDLOOP.



      CLEAR : IT_FINAL,IT_FINAL[].



      IT_FINAL[] = T_TEMP[].



      IF NOT S_ERNAM IS INITIAL.

        LOOP AT IT_FINAL.

          IF IT_FINAL-ERNAM NE S_ERNAM.

            DELETE IT_FINAL.

          ENDIF.

        ENDLOOP.

      ENDIF.



      IF NOT S_ERNAM1 IS INITIAL.

        LOOP AT IT_FINAL.

          IF IT_FINAL-ERNAM1 NE S_ERNAM1.

            DELETE IT_FINAL.

          ENDIF.

        ENDLOOP.

      ENDIF.







    ENDFORM.                    " GET_DATA

    *&---------------------------------------------------------------------*

    *&      Form  DISPLAY_DATA

    *&---------------------------------------------------------------------*

    *       text

    *----------------------------------------------------------------------*

    *  -->  p1        text

    *  <--  p2        text

    *----------------------------------------------------------------------*

    FORM DISPLAY_DATA .



      DATA : LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

    *1



      IT_FIELDCAT-FIELDNAME = 'BSART'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Pr Doc.Type'.

      IT_FIELDCAT-SELTEXT_L = 'Pr Doc.Type'.

      IT_FIELDCAT-OUTPUTLEN = 04.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.

    *------------------------------------------

      IT_FIELDCAT-FIELDNAME = 'BATXT'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Doc.Type Desc.'.

      IT_FIELDCAT-SELTEXT_L = 'Doc.Type Desc.'.

      IT_FIELDCAT-OUTPUTLEN = 20.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



    *------------------------------------------



      IT_FIELDCAT-FIELDNAME = 'KNTTP'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Acc Assignment Cat'.

      IT_FIELDCAT-SELTEXT_L = 'Acc Assignment Cat'.

      IT_FIELDCAT-OUTPUTLEN = 5.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'BANFN'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PR Number'.

      IT_FIELDCAT-SELTEXT_L = 'PR Number'.

      IT_FIELDCAT-OUTPUTLEN = 12.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



    *3

      IT_FIELDCAT-FIELDNAME = 'BNFPO'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Item'.

      IT_FIELDCAT-SELTEXT_L = 'Item'.

      IT_FIELDCAT-OUTPUTLEN = 4.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'MENGE'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Qty'.

      IT_FIELDCAT-SELTEXT_L = 'Qty'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'MEINS1'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'UOM'.

      IT_FIELDCAT-SELTEXT_L = 'UOM'.

      IT_FIELDCAT-OUTPUTLEN = 6.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





      IT_FIELDCAT-FIELDNAME = 'PREIS'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PR Price'.

      IT_FIELDCAT-SELTEXT_L = 'PR Price'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





      IT_FIELDCAT-FIELDNAME = 'KOSTL'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Cost Centre'.

      IT_FIELDCAT-SELTEXT_L = 'Cost Centre'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



    *2

      IT_FIELDCAT-FIELDNAME = 'ANLN1'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Asset No'.

      IT_FIELDCAT-SELTEXT_L = 'Asset No'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





    *4

      IT_FIELDCAT-FIELDNAME = 'WERKS'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Plant'.

      IT_FIELDCAT-SELTEXT_L = 'Plant'.

      IT_FIELDCAT-OUTPUTLEN = 04.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.

    *5

      IT_FIELDCAT-FIELDNAME = 'EKORG'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Pur. Org.'.

      IT_FIELDCAT-SELTEXT_L = 'Pur. Org.'.

      IT_FIELDCAT-OUTPUTLEN = 04.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.

    *6

      IT_FIELDCAT-FIELDNAME = 'EKGRP'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Pur. Grp.'.

      IT_FIELDCAT-SELTEXT_L = 'Pur. Grp.'.

      IT_FIELDCAT-OUTPUTLEN = 03.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.

    *------------------------------------------------

      IT_FIELDCAT-FIELDNAME = 'EKNAM'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Pur.Grp.Desc.'.

      IT_FIELDCAT-SELTEXT_L = 'Pur.Grp.Desc.'.

      IT_FIELDCAT-OUTPUTLEN = 20.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





    *-----------------------------------------------

    *7

      IT_FIELDCAT-FIELDNAME = 'MATNR'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Material Number'.

      IT_FIELDCAT-SELTEXT_L = 'Material Number'.

      IT_FIELDCAT-OUTPUTLEN =  10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



    *------------------------------------------------

      IT_FIELDCAT-FIELDNAME = 'MTART'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Material Type'.

      IT_FIELDCAT-SELTEXT_L = 'Material Type'.

      IT_FIELDCAT-OUTPUTLEN =  10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





      IT_FIELDCAT-FIELDNAME = 'MTBEZ'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Material Type Desc.'.

      IT_FIELDCAT-SELTEXT_L = 'Material Type Desc.'.

      IT_FIELDCAT-OUTPUTLEN = 25.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





    *------------------------------------------------

    *8

      IT_FIELDCAT-FIELDNAME = 'TXZ01'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Item Description'.

      IT_FIELDCAT-SELTEXT_L = 'Item Description'.

      IT_FIELDCAT-OUTPUTLEN = 40.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'ERNAM'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PR Created By'.

      IT_FIELDCAT-SELTEXT_L = 'PR Created By'.

      IT_FIELDCAT-OUTPUTLEN = 12.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'AFNAM'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Requisitioner'.

      IT_FIELDCAT-SELTEXT_L = 'Requisitioner'.

      IT_FIELDCAT-OUTPUTLEN = 12.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





      IT_FIELDCAT-FIELDNAME = 'BEDNR'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Tracking Number'.

      IT_FIELDCAT-SELTEXT_L = 'Tracking Number'.

      IT_FIELDCAT-OUTPUTLEN = 15.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





    *9

      IT_FIELDCAT-FIELDNAME = 'BADAT'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PR Creation date'.

      IT_FIELDCAT-SELTEXT_L = 'PR Creation date'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



    *10

      IT_FIELDCAT-FIELDNAME = 'V_UDATE'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PR Release Date'.

      IT_FIELDCAT-SELTEXT_L = 'PR Release Date'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





    *11

      IT_FIELDCAT-FIELDNAME = 'EBELN'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PO number'.

      IT_FIELDCAT-SELTEXT_L = 'PO number'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.

    *12





      IT_FIELDCAT-FIELDNAME = 'EBELP'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PO line item'.

      IT_FIELDCAT-SELTEXT_L = 'PO line item'.

      IT_FIELDCAT-OUTPUTLEN =  05.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'MENGE_PO'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Order Qty'.

      IT_FIELDCAT-SELTEXT_L = 'Order Qty'.

      IT_FIELDCAT-OUTPUTLEN = 15.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'WEMNG'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'GR Qty'.

      IT_FIELDCAT-SELTEXT_L = 'GR Qty'.

      IT_FIELDCAT-OUTPUTLEN = 15.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'OPN_QTY'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Open Qty'.

      IT_FIELDCAT-SELTEXT_L = 'Open Qty'.

      IT_FIELDCAT-OUTPUTLEN = 15.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'MEINS'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'UOM'.

      IT_FIELDCAT-SELTEXT_L = 'UOM'.

      IT_FIELDCAT-OUTPUTLEN = 4.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'NETPR'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PO Price'.

      IT_FIELDCAT-SELTEXT_L = 'PO Price'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'ERNAM1'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PO Created By'.

      IT_FIELDCAT-SELTEXT_L = 'PO Created By'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'BEDAT'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PO creation Date'.

      IT_FIELDCAT-SELTEXT_L = 'PO creation Date'.

      IT_FIELDCAT-OUTPUTLEN =  10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'EINDT'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Delivery Date'.

      IT_FIELDCAT-SELTEXT_L = 'Delivery Date'.

      IT_FIELDCAT-OUTPUTLEN =  10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'ELIKZ'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Delv Compl Ind'.

      IT_FIELDCAT-SELTEXT_L = 'Delv Compl Ind'.

      IT_FIELDCAT-OUTPUTLEN =  10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





      IT_FIELDCAT-FIELDNAME = 'FRGKE'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Release indicator'.

      IT_FIELDCAT-SELTEXT_L = 'Release indicator'.

      IT_FIELDCAT-OUTPUTLEN =  25.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





      IT_FIELDCAT-FIELDNAME = 'FRGCT'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Final released By'.

      IT_FIELDCAT-SELTEXT_L = 'Final released By'.

      IT_FIELDCAT-OUTPUTLEN = 25.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'PEND_T'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Pending For Rel'.

      IT_FIELDCAT-SELTEXT_L = 'Pending For Rel'.

      IT_FIELDCAT-OUTPUTLEN = 25.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





    *15

      IT_FIELDCAT-FIELDNAME = 'UDATE'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PO Release Date'.

      IT_FIELDCAT-SELTEXT_L = 'PO Release Date'.

      IT_FIELDCAT-OUTPUTLEN =  10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





    *16

      IT_FIELDCAT-FIELDNAME = 'E_TAGE2'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PR create to Rel.Lead time '.

      IT_FIELDCAT-SELTEXT_L = 'PR create to Rel.Lead time '.

      IT_FIELDCAT-OUTPUTLEN = 16.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



    *17

      IT_FIELDCAT-FIELDNAME = 'E_TAGE4'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PR Rel to PO create Lead time'.

      IT_FIELDCAT-SELTEXT_L = 'PR Rel to PO create Lead time'.

      IT_FIELDCAT-OUTPUTLEN = 16.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.

    *18

      IT_FIELDCAT-FIELDNAME = 'E_TAGE1'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PO create to PO Rel.Lead time'.

      IT_FIELDCAT-SELTEXT_L = 'PO create to PO Rel.Lead time'.

      IT_FIELDCAT-OUTPUTLEN = 16.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



    *19

      IT_FIELDCAT-FIELDNAME = 'E_TAGE3'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

    **  it_fieldcat-seltext_m = 'PR Release to PO Release'.

    **  it_fieldcat-seltext_l = 'PR Release to PO Release'.

      IT_FIELDCAT-SELTEXT_M = 'Total Lead Time'.

      IT_FIELDCAT-SELTEXT_L = 'Total Lead Time'.

      IT_FIELDCAT-OUTPUTLEN =  14.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.

    *21

    *----------------------------------------

      IT_FIELDCAT-FIELDNAME = 'LIFNR'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Vendor Code'.

      IT_FIELDCAT-SELTEXT_L = 'Vendor Code'.

      IT_FIELDCAT-OUTPUTLEN = 15.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





      IT_FIELDCAT-FIELDNAME = 'NAME1'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Vendor Name'.

      IT_FIELDCAT-SELTEXT_L = 'Vendor Name'.

      IT_FIELDCAT-OUTPUTLEN = 35.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'ZTERM'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Pay Terms'.

      IT_FIELDCAT-SELTEXT_L = 'Pay terms.'.

      IT_FIELDCAT-OUTPUTLEN = 5.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'TEXT1'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Pay Terms Desc'.

      IT_FIELDCAT-SELTEXT_L = 'Pay terms Desc.'.

      IT_FIELDCAT-OUTPUTLEN = 20.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'BELNR'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'GRN Doc No'.

      IT_FIELDCAT-SELTEXT_L = 'GRN Doc No'.

      IT_FIELDCAT-OUTPUTLEN = 10.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'BUZEI'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'Item'.

      IT_FIELDCAT-SELTEXT_L = 'Item'.

      IT_FIELDCAT-OUTPUTLEN = 7.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'MENGE_EKBE'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'GRN Qty'.

      IT_FIELDCAT-SELTEXT_L = 'GRN Qty.'.

      IT_FIELDCAT-OUTPUTLEN = 7.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'DMBTR'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'GRN Amount'.

      IT_FIELDCAT-SELTEXT_L = 'GRN Amount'.

      IT_FIELDCAT-OUTPUTLEN = 13.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.





      IT_FIELDCAT-FIELDNAME = 'BUDAT'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'GRN Post Dt'.

      IT_FIELDCAT-SELTEXT_L = 'GRN Post Dt'.

      IT_FIELDCAT-OUTPUTLEN = 11.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'GJAHR'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'GRN Yr'.

      IT_FIELDCAT-SELTEXT_L = 'GRN Yr'.

      IT_FIELDCAT-OUTPUTLEN = 7.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'W_GRN_PO_DAY'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PO release to GRN '.

      IT_FIELDCAT-SELTEXT_L = 'PO release to GRN'.

      IT_FIELDCAT-OUTPUTLEN = 16.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



      IT_FIELDCAT-FIELDNAME = 'W_PO_RELE_GRN_DAY'.

      IT_FIELDCAT-TABNAME   = 'IT_FINAL'.

      IT_FIELDCAT-SELTEXT_M = 'PR release to GRN'.

      IT_FIELDCAT-SELTEXT_L = 'PR release to GRN'.

      IT_FIELDCAT-OUTPUTLEN = 16.

      APPEND IT_FIELDCAT.

      CLEAR IT_FIELDCAT.



    *----------------------------------------

    *****Events during list display



      CLEAR WA_EVENT.

      WA_EVENT-NAME = 'TOP_OF_PAGE'.

      WA_EVENT-FORM = 'TOP_OF_PAGE'.

      APPEND WA_EVENT TO IT_EVENTS.



    *****Comments for top-of-page



      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

        EXPORTING

          I_BUFFER_ACTIVE          = ' '

    *     i_callback_program       = sy-repid

          I_CALLBACK_PROGRAM       = SY-CPROG

          I_CALLBACK_TOP_OF_PAGE   = 'TOP_OF_PAGE'

          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'

    *     i_callback_pf_status_set = 'SET_PF_STATUS'

    *     is_layout                = st_layout

          IT_FIELDCAT              = IT_FIELDCAT[]

    *     it_events                = it_events[]

        TABLES

          T_OUTTAB                 = IT_FINAL.





    ENDFORM.                    " DISPLAY_DATA



    *----------------------------------------------------------*

    *       FORM SET_PF_STATUS                                 *

    *----------------------------------------------------------*

    FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.

      SET PF-STATUS 'STANDARD'.

      "Copy of 'STANDARD' pf_status from fgroup SALV

    ENDFORM.                    "set_pf_status



    *&---------------------------------------------------------------------*

    *&      Form  USER_COMMAND

    *&---------------------------------------------------------------------*

    *       text

    *----------------------------------------------------------------------*

    *  -->  p1        text

    *  <--  p2        text

    *----------------------------------------------------------------------*

    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM



    RS_SELFIELD TYPE SLIS_SELFIELD.

      CASE RS_SELFIELD-FIELDNAME.

        WHEN 'EBELN'.

          CLEAR IT_FINAL.

          READ TABLE IT_FINAL INTO WA_OUTPUT INDEX RS_SELFIELD-TABINDEX.

          IF SY-SUBRC = 0.

    *        IF it_final-EBELN <> ''.

            SET PARAMETER ID 'BES' FIELD WA_OUTPUT-EBELN.

            CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

    *        ENDIF.

          ENDIF.

        WHEN 'BANFN'.

          CLEAR IT_FINAL.

          READ TABLE IT_FINAL  INTO WA_OUTPUT INDEX RS_SELFIELD-TABINDEX.

          IF SY-SUBRC = 0 .

    *       IF it_final-BANFN <> ''.

            SET PARAMETER ID 'BAN' FIELD WA_OUTPUT-BANFN.

            CALL TRANSACTION 'ME53N' AND SKIP FIRST SCREEN.

    *      ENDIF.

          ENDIF.



        WHEN 'BELNR'.

          CLEAR IT_FINAL.

          READ TABLE IT_FINAL  INTO WA_OUTPUT INDEX RS_SELFIELD-TABINDEX.

          IF SY-SUBRC = 0 .

    *       IF it_final-BANFN <> ''.

            SET PARAMETER ID 'MBN' FIELD WA_OUTPUT-BELNR.

            SET PARAMETER ID 'MJA' FIELD WA_OUTPUT-GJAHR.

            CALL TRANSACTION 'MIGO' AND SKIP FIRST SCREEN.

    *      ENDIF.

          ENDIF.

      ENDCASE.

    ENDFORM.                    " USER_COMMAND

    *&---------------------------------------------------------------------*

    *&      Form  top_of_page

    *&---------------------------------------------------------------------*

    *       text

    *----------------------------------------------------------------------*

    *  -->  p1        text

    *  <--  p2        text

    *----------------------------------------------------------------------*

    *FORM fill_headingtable TABLES p_heading STRUCTURE heading USING tablename .

    FORM TOP_OF_PAGE .

      DATA : WA_HEADER TYPE  SLIS_LISTHEADER.

      DATA: T_HEADER TYPE SLIS_LISTHEADER OCCURS 0.

      REFRESH T_HEADER.

      DATA : DATE_1(30),

            DATE(12).

      DATA: DATE1(12),

             DATE2(12),

             TIME(8).

    *  WRITE P_DATE TO DATE_1.

    *  DATE_1 = SY-DATUM.

      WA_HEADER-TYP = 'H'.

      WA_HEADER-INFO = 'PR,PO and GR WITH LEAD TIME'.

      APPEND WA_HEADER TO T_HEADER.



      WA_HEADER-TYP = 'S'.

      WA_HEADER-KEY = 'Report Genrated By:'.

      WA_HEADER-INFO = SY-UNAME.

      APPEND WA_HEADER TO T_HEADER.

      CLEAR:WA_HEADER .



      WA_HEADER-TYP  = 'S'.

      WA_HEADER-KEY = 'Date: '.

      CONCATENATE  SY-DATUM+6(2) '.'

                   SY-DATUM+4(2) '.'

                   SY-DATUM(4) INTO WA_HEADER-INFO .   "todays date

      APPEND WA_HEADER TO T_HEADER.

      CLEAR: WA_HEADER.



      WA_HEADER-TYP = 'S'.

      WA_HEADER-KEY = 'Time:'.

      CONCATENATE SY-UZEIT+0(2) '.' SY-UZEIT+2(2)'.' SY-UZEIT+4(2) INTO TIME .

      WA_HEADER-INFO = TIME.

      APPEND WA_HEADER TO T_HEADER.

      CLEAR:WA_HEADER .



      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

        EXPORTING

          IT_LIST_COMMENTARY = T_HEADER.



    ENDFORM.                    "TOP_OF_PAGE

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 29, 2015 at 10:01 PM

    The date of approval is nothing else than a date in the change history.

    You need to find that date of approval in the change history from the purchase order and subtract the date of approval from the change history of the requisition and as result you get to know how long the process needed.

    You need an ABAPer to create such report.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 30, 2015 at 04:21 AM

    Hi,

    You can create a report using query tool or Z program to match your requirement. Try to use table CDHDR to get information about the date and time PR release and PO release.

    Thanks and regards!

    Thanh Chu.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      You cannot join OBJECTID and EBELN (or BANFN) fields. So as Mr. Jürgen said it can only be achieved with ABAP

  • avatar image
    Former Member
    Oct 30, 2015 at 08:34 AM

    Hi Micah,

    You may use BAPI's for retrieving the Release Dates of PR and PO.

    BAPI_PO_GETRELINFO

    BAPI_REQUISITION_GETRELINFO

    Thanks and Regards,

    Vikram

    Add comment
    10|10000 characters needed characters exceeded