ABAP Mass Select and Print Material Master Change History

Konu Kategorisi
  1. ABAP Temel Bilgiler
Kullanıcı Değerlendirmesi
5.00 Oylama

Övünç DİNÇ

Çözüm Ekibi
Kayıtlı Üye
Katılım
8 Eki 2016
Mesajlar
939
Çözümler
4
Tepki puanı
276
Puanları
63
Yaş
42
Konum
İzmir
Web Sitesi
sapforo.com
Kullandığınız SAP Modülleri
  1. SAP MM
  2. SAP PP
  3. SAP FI
  4. SAP QM
Katılım Bölgesi
  1. İzmir
SAP sisteminde bir çok kullanıcı malzeme üzerinde yapılan tarihsel değişiklikleri görüntülemek ister.
Bunlara en basit örnek sistemde standart olarak gelen,

TCode: MM04 ekranıdır.

1524121450545.png


MM04 üzerinde gelen değişiklik verileri talepleriniz için yeterli olamayabilir,

1524121616663.png


Eğer detaylı değişiklik izlemeye yada veri çıkışına (Rapor) ihtiyacınız varsa aşağıdaki ekranlar üzerinden değişiklikleri görüntüleyebilirsiniz.

PHP:
MM04  Display material Change Documents   Logistics - Material Master
AUT10  Evaluation of Audit Trail   Logistics - Electronic Data Records
CS03  Display material BOM   Logistics - Bills of Material
SCU3  Table history   Basis - Table History
SCDO  Display Change Document Objects   Basis - Change Documents
CS80  Change Documents for material BOM   Logistics - Bills of Material
ME1P  Purchase Order Price history   MM - Purchasing
BD52  Activ.change pointer per chng.doc.it   Basis - ALE Integration Technology
CS20  Mass Change: Initial Screen   Logistics - Bills of Material
VB13  Display material Substitution   SD - Conditions
WG21  Create material groups   Logistics - Material Groups
BD50  Activate Change Ptrs for Mess. Type   Basis - ALE Integration Technology
CKMPCSEARCH  Price Change Documents for material   CO - Price Change
S_AHR_61016380  Logged changes in Infotype Data   Cross Application - Cross-Application Components
BD21  Select change pointer   Basis - ALE Integration Technology
MM19  Display material & at Key Date   Logistics - Material Master
CKMPCD  Display Price Change Document   CO - Price Change
MD06  Collective Display Of MRP List   PP - Master Data
CEWB  PP: Engineering Workbench   PP - Routing
CN60  Change Documents for Projects/Netw.   Project Systems - Information System
LU04  Selection of Posting Change Notices   Logistics Execution - Warehouse Management
MM12  Schedule Changing of material &   Logistics - Material Master
MD07  Current material Overview   PP - Master Data
RSSCD100  Display Change Documents   Basis - System Audit Information System
OS27  Modification Parameters for BOMs   Logistics - Bills of Material


Yukarıda veriler TCode örnekleri size yeterli gelmiyorsa aşağıda yer alan rapor örneğini kullanarak tablo ve verilerinizi kendinize göre revize ederek ihtiyaç duyulan raporu oluşturabilirsiniz.

Not: CDHDR ve CDPOS ekranlarına SE16 içerisinden ulaşabilirsiniz.


PHP:
Mass Select and Print Material Master Change History
*** SAPOfis Start of Program

TABLES:

CDHDR, CDPOS, MARA, MAKT, MARD.


FIELD-GROUPS: HEADER.


DATA: BEGIN OF CHGDOC OCCURS 50.

INCLUDE STRUCTURE CDRED.

DATA: END OF CHGDOC.

DATA:

      CHGTYPE(1),

      PLANT(4),

      MATNR1 LIKE CHGDOC-OBJECTID.

 
SELECT-OPTIONS:

    XMATNR  FOR CDHDR-OBJECTID,    "Material

    XUDATE  FOR CDHDR-UDATE,       "Change Date

    XUNAME  FOR CDHDR-USERNAME,    "User Name

    XTCODE  FOR CDHDR-TCODE,       "Transaction Code

    XWERKS  FOR MARD-WERKS.        "Plants


SELECTION-SCREEN SKIP.


*Filter change type

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

   PARAMETERS : XCHG1 AS CHECKBOX DEFAULT 'X',

                XCHG2 AS CHECKBOX DEFAULT 'X',

                XCHG3 AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN END OF BLOCK CHG0.



START-OF-SELECTION.


INSERT:

        CHGDOC-OBJECTID        "Material

        CHGTYPE                "Change type

        PLANT

        CHGDOC-CHANGENR

        CHGDOC-USERNAME

        CHGDOC-UDATE

        CHGDOC-TCODE

        CHGDOC-TABNAME

        CHGDOC-TABKEY

        CHGDOC-CHNGIND

        CHGDOC-FNAME

        CHGDOC-FTEXT

        CHGDOC-TEXTART

        CHGDOC-OUTLEN

        CHGDOC-F_OLD

        CHGDOC-F_NEW



INTO HEADER.


SELECT * FROM MARA WHERE MATNR IN XMATNR.


   MATNR1 = MARA-MATNR.

   CALL FUNCTION 'CHANGEDOCUMENT_READ'

     EXPORTING

*         ARCHIVE_HANDLE             = 0

*         CHANGENUMBER               = ' '

*         DATE_OF_CHANGE             = '00000000'

          OBJECTCLASS                = 'MATERIAL'

          OBJECTID                   = MATNR1

*         TABLEKEY                   = ' '

*         TABLENAME                  = ' '

*         TIME_OF_CHANGE             = '000000'

*         USERNAME                   = ' '

*         LOCAL_TIME                 = ' '

     TABLES

          EDITPOS                    = CHGDOC

     EXCEPTIONS

          NO_POSITION_FOUND          = 1

          WRONG_ACCESS_TO_ARCHIVE    = 2

          TIME_ZONE_CONVERSION_ERROR = 3

          OTHERS                     = 4.

   LOOP AT CHGDOC.

      CHECK:  CHGDOC-UDATE    IN XUDATE,

              CHGDOC-USERNAME IN XUNAME,

              CHGDOC-TCODE    IN XTCODE.


*     Chg type: 1. Part revision, 2. Price change, 3. Others

      CASE CHGDOC-TCODE.

         WHEN 'MM01' OR 'MM02' OR 'MM03'.  CHGTYPE = '1'.

         WHEN 'MR21'.  CHGTYPE = '2'.

         WHEN OTHERS.  CHGTYPE = '3'.

      ENDCASE.

*     Filter chg type

      IF ( CHGTYPE = '1' AND XCHG1 <> 'X' ) OR

        ( CHGTYPE = '2' AND XCHG2 <> 'X' ) OR

        ( CHGTYPE = '3' AND XCHG3 <> 'X' ).

       CONTINUE.

      ENDIF.

*     Plant is a substring of tabkey

      PLANT = CHGDOC-TABKEY+21(4).

   IF NOT ( XWERKS IS INITIAL ) AND NOT ( PLANT IS INITIAL ).

  CHECK PLANT IN XWERKS.

  ENDIF.

 EXTRACT HEADER.

 ENDLOOP.

ENDSELECT.


END-OF-SELECTION.

SORT.

LOOP.

*  Material

   AT NEW CHGDOC-OBJECTID.

      SELECT SINGLE * FROM MAKT  WHERE MATNR = CHGDOC-OBJECTID.

      FORMAT INTENSIFIED ON.

      SKIP.  SKIP.

      WRITE:/' *** Material:', (18) CHGDOC-OBJECTID, MAKT-MAKTX.

   ENDAT.

*  Change type

   AT NEW CHGTYPE.

      FORMAT INTENSIFIED ON.

      SKIP.

      CASE CHGTYPE.

         WHEN '1'.   WRITE:/ '  **  Change type:  PARTS REVISION'.

         WHEN '2'.   WRITE:/ '  **  Change type:  PRICE CHANGE'.

         WHEN '3'.   WRITE:/ '  **  Change type:  OTHERS'.

      ENDCASE.

      SKIP.

   ENDAT.


   SHIFT CHGDOC-F_OLD LEFT DELETING LEADING SPACE.

   SHIFT CHGDOC-F_NEW LEFT DELETING LEADING SPACE.

   FORMAT INTENSIFIED OFF.

   WRITE:

     /     PLANT          UNDER 'Plant',

      (50) CHGDOC-FTEXT   UNDER 'Field',

      (45) CHGDOC-F_OLD   UNDER 'Old value',

      (45) CHGDOC-F_NEW   UNDER 'New value'.

   AT NEW CHGDOC-CHANGENR.

      FORMAT INTENSIFIED OFF.

      WRITE:

           CHGDOC-CHANGENR   UNDER 'Change doc',

           CHGDOC-TCODE      UNDER 'Tcod',

           CHGDOC-USERNAME   UNDER 'User name   ',

           CHGDOC-UDATE      UNDER 'Date    ' DD/MM/YY.

   ENDAT.

   AT END OF CHGDOC-OBJECTID.

      SKIP.

      ULINE.

      SKIP.

   ENDAT.

ENDLOOP.

TOP-OF-PAGE.

WRITE: / SY-DATUM, SY-UZEIT,

    50 'ABC PTE LTD',

   100 'page', SY-PAGNO,

       / SY-REPID,

    48 'Change Documents Report',

   100 SY-UNAME.


SKIP.

ULINE.


WRITE:/3

        'Change doc',

        'Tcod',

        'User name   ',

        'Date    ',

        'Plant',

   (50) 'Field',

   (45) 'Old value',

   (45) 'New value'.

ULINE.


*** SAPOfis End of Program
 
Üst