Skip to Content
author's profile photo Former Member
Former Member

standard report

i'm looking for report that gives me all the changes that was made in sales order

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 10, 2008 at 11:46 AM

    hi,

    Give the sales order number in CDHDR and CDPOS tables to find all the changes made to it.

    Regards,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 10, 2008 at 11:58 AM

    Hi,

    If you are looking at the document flow of the sales order then VBFA is the table you need to look into.

    If you are looking at changes made to the sales order like change of item quantity, change of price etc, then CDHDR & CDPOS are the tables you need to look into.

    The object class that you need to pass is VERKBELEG, Pass Object ID as sales document number (with leading zeros).

    You can get the modification history of sales order schedule line delivery date details from CDHDR and CDPOS table.

    Use CDHDR-OBJECTCLAS = 'VERKBELEG'

    Pass

    OBJECTID = sales document no with leading zeros

    TCODE = VA02

    to CDHDR table to get the list of CHANGENR

    In CDPOS table pass

    CDPOS-OBJECTCLAS = CDHDR-OBJECTCLAS

    CDPOS-OBJECTID = CDHDR-OBJECTID

    CDPOS-CHANGENR = CDHDR-CHANGENR

    CDPOS-TABNAME = VBEP

    TABKEY = <table_key_for_vbep> (concatenate client, sales document no, item number and schedule line no)

    CDPOS-FNAME as the field name in VBEP table for which change is being looked for in ur report.

    Use this code it will get all the details

    Sales Order Changed History Display

    *

    Sales Order Changed History Display

    *

    You can execute the report by :

    1. Change Date

    2. User Name

    3. Sales Order Number

    *

    Submitted by : SAP Basis, ABAP Programming and Other IMG Stuff

    http://www.sap-img.com

    *

    REPORT ZSDCHANGE LINE-SIZE 132 NO STANDARD PAGE HEADING

    LINE-COUNT 065(001)

    MESSAGE-ID VR.

    TABLES: DD04T,

    CDHDR,

    CDPOS,

    DD03L,

    DD41V,

    T685T,

    VBPA,

    TPART,

    KONVC,

    VBUK.

    DATA: BEGIN OF ICDHDR OCCURS 50.

    INCLUDE STRUCTURE CDHDR.

    DATA: END OF ICDHDR.

    SELECT-OPTIONS: XUDATE FOR ICDHDR-UDATE,

    XNAME FOR ICDHDR-USERNAME,

    XVBELN FOR VBUK-VBELN.

    SELECTION-SCREEN SKIP.

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

    PARAMETERS: SUDATE RADIOBUTTON GROUP R1,

    SNAME RADIOBUTTON GROUP R1,

    SOBID RADIOBUTTON GROUP R1.

    SELECTION-SCREEN END OF BLOCK BLK1.

    DATA: WFLAG,

    WCHANGENR LIKE CDHDR-CHANGENR,

    WUDATE LIKE CDHDR-UDATE,

    WNAME LIKE CDHDR-USERNAME,

    WVBELN LIKE VBUK-VBELN,

    WDEC1 TYPE P DECIMALS 3,

    WDEC2 TYPE P DECIMALS 3,

    WDEC3 TYPE P DECIMALS 3,

    WDEC4 TYPE P DECIMALS 3.

    DATA: UTEXT(16) VALUE 'has been changed',

    ITEXT(16) VALUE 'has been created',

    DTEXT(16) VALUE 'has been deleted'.

    DATA: BEGIN OF ICDSHW OCCURS 50.

    INCLUDE STRUCTURE CDSHW.

    DATA: END OF ICDSHW.

    DATA: BEGIN OF ITAB OCCURS 10.

    INCLUDE STRUCTURE CDSHW.

    DATA: UDATE LIKE CDHDR-UDATE,

    USERNAME LIKE CDHDR-USERNAME,

    CHANGENR LIKE CDHDR-CHANGENR,

    VBELN(10),

    POSNR(6),

    ETENR(4),

    INDTEXT(200),

    END OF ITAB.

    SELECT * FROM VBUK WHERE VBELN IN XVBELN.

    CLEAR CDHDR.

    CLEAR CDPOS.

    CDHDR-OBJECTCLAS = 'VERKBELEG'.

    CDHDR-OBJECTID = VBUK-VBELN.

    PERFORM READHEADER.

    PERFORM READPOS.

    LOOP AT ITAB.

    CASE ITAB-TABNAME.

    WHEN 'VBPA'.

    IF ITAB-FNAME = 'KUNNR' OR

    ITAB-FNAME = 'LIFNR' OR

    ITAB-FNAME = 'PARNR' OR

    ITAB-FNAME = 'PERNR' OR

    ITAB-FNAME IS INITIAL.

    MOVE ITAB-TABKEY TO VBPA.

    SELECT SINGLE * FROM TPART WHERE SPRAS = SY-LANGU

    AND PARVW = VBPA-PARVW.

    IF SY-SUBRC = 0.

    REPLACE '&' WITH TPART-VTEXT INTO ITAB-INDTEXT.

    ENDIF.

    ENDIF.

    WHEN 'VBAP'.

    IF ITAB-FNAME IS INITIAL.

    REPLACE '&' WITH 'Item' INTO ITAB-INDTEXT.

    ENDIF.

    WHEN 'KONVC'.

    MOVE ITAB-TABKEY TO KONVC.

    SELECT SINGLE * FROM T685T WHERE SPRAS = SY-LANGU

    AND KVEWE = 'A'

    AND KAPPL = 'V'

    AND KSCHL = KONVC-KSCHL.

    IF SY-SUBRC = 0.

    REPLACE '&' WITH T685T-VTEXT INTO ITAB-INDTEXT.

    ENDIF.

    ENDCASE.

    IF ITAB-INDTEXT(1) EQ '&'.

    REPLACE '&' WITH ITAB-FTEXT(40) INTO ITAB-INDTEXT.

    ENDIF.

    IF ITAB-CHNGIND = 'I'.

    REPLACE '%' WITH ITEXT INTO ITAB-INDTEXT.

    ELSEIF ITAB-CHNGIND = 'U'.

    REPLACE '%' WITH UTEXT INTO ITAB-INDTEXT.

    ELSE.

    REPLACE '%' WITH DTEXT INTO ITAB-INDTEXT.

    ENDIF.

    CONDENSE ITAB-INDTEXT.

    MODIFY ITAB.

    ENDLOOP.

    ENDSELECT.

    IF SUDATE = 'X'.

    SORT ITAB BY UDATE VBELN POSNR ETENR.

    ELSEIF SOBID = 'X'.

    SORT ITAB BY VBELN POSNR ETENR UDATE.

    ELSE.

    SORT ITAB BY USERNAME VBELN POSNR ETENR UDATE.

    ENDIF.

    LOOP AT ITAB.

    CLEAR WFLAG.

    IF SUDATE = 'X'.

    IF WUDATE NE ITAB-UDATE.

    SKIP.

    WRITE:/001 ITAB-UDATE,

    023 ITAB-USERNAME,

    037(10) ITAB-VBELN.

    WFLAG = 'X'.

    WUDATE = ITAB-UDATE.

    WCHANGENR = ITAB-CHANGENR.

    ENDIF.

    ELSEIF SOBID NE 'X'.

    IF WVBELN NE ITAB-VBELN.

    SKIP.

    WRITE:/001 ITAB-VBELN.

    WVBELN = ITAB-VBELN.

    ENDIF.

    ELSE.

    IF WNAME NE ITAB-USERNAME.

    SKIP.

    WRITE:/001 ITAB-USERNAME.

    WNAME = ITAB-USERNAME.

    ENDIF.

    ENDIF.

    IF WCHANGENR NE ITAB-CHANGENR.

    WRITE:/023 ITAB-USERNAME,

    037(10) ITAB-VBELN.

    WFLAG = 'X'.

    WCHANGENR = ITAB-CHANGENR.

    ENDIF.

    IF WFLAG = 'X'.

    WRITE: 013 ITAB-CHNGIND,

    049 ITAB-POSNR,

    057 ITAB-ETENR,

    065 ITAB-INDTEXT(60).

    ELSE.

    WRITE: /013 ITAB-CHNGIND,

    049 ITAB-POSNR,

    057 ITAB-ETENR,

    065 ITAB-INDTEXT(60).

    ENDIF.

    WRITE:/065 ITAB-F_OLD.

    WRITE:/065 ITAB-F_NEW.

    ENDLOOP.

    FORM READHEADER.

    CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'

    EXPORTING

    DATE_OF_CHANGE = CDHDR-UDATE

    OBJECTCLASS = CDHDR-OBJECTCLAS

    OBJECTID = CDHDR-OBJECTID

    TIME_OF_CHANGE = CDHDR-UTIME

    USERNAME = CDHDR-USERNAME

    TABLES

    I_CDHDR = ICDHDR

    EXCEPTIONS

    NO_POSITION_FOUND = 1

    OTHERS = 2.

    CASE SY-SUBRC.

    WHEN '0000'.

    WHEN '0001'.

    MESSAGE S311.

    LEAVE.

    WHEN '0002'.

    MESSAGE S311.

    LEAVE.

    ENDCASE.

    ENDFORM.

    FORM READPOS.

    LOOP AT ICDHDR.

    CHECK ICDHDR-UDATE

    IN XUDATE.

    CHECK ICDHDR-USERNAME

    IN XNAME.

    CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'

    EXPORTING

    CHANGENUMBER = ICDHDR-CHANGENR

    TABLEKEY = CDPOS-TABKEY

    TABLENAME = CDPOS-TABNAME

    IMPORTING

    HEADER = CDHDR

    TABLES

    EDITPOS = ICDSHW

    EXCEPTIONS

    NO_POSITION_FOUND = 1

    OTHERS = 2.

    CASE SY-SUBRC.

    WHEN '0000'.

    LOOP AT ICDSHW.

    CHECK ICDSHW-CHNGIND NE 'E'.

    CLEAR ITAB.

    MOVE-CORRESPONDING ICDHDR TO ITAB.

    MOVE-CORRESPONDING ICDSHW TO ITAB.

    CASE ITAB-TABNAME.

    WHEN 'KONVC'.

    MOVE ICDHDR-OBJECTID TO ITAB-VBELN.

    MOVE ICDSHW-TABKEY(6) TO ITAB-POSNR.

    WHEN OTHERS.

    MOVE ICDSHW-TABKEY+3(10) TO ITAB-VBELN.

    MOVE ICDSHW-TABKEY+13(6) TO ITAB-POSNR.

    MOVE ICDSHW-TABKEY+19(4) TO ITAB-ETENR.

    ENDCASE.

    MOVE '& %' TO ITAB-INDTEXT.

    APPEND ITAB.

    CLEAR ITAB.

    ENDLOOP.

    WHEN OTHERS.

    MESSAGE S311.

    LEAVE.

    ENDCASE.

    ENDLOOP.

    ENDFORM.

    TOP-OF-PAGE.

    WRITE:/ SY-DATUM,SY-UZEIT,

    50 'SALES ORDER CHANGE HISTORY',

    120 'Page', SY-PAGNO.

    WRITE: / SY-REPID,

    60 'SALES ORDERS STATISTICS'.

    SKIP.

    ULINE.

    IF SUDATE = 'X'.

    WRITE:/001 'Change Date',

    013 'Time',

    023 'User Name',

    037 'Sale Order',

    049 'Line',

    057 'Sch No',

    065 'Changes'.

    ELSEIF SOBID = 'X'.

    WRITE:/001 'Sale Order',

    013 'Line',

    021 'Sch No',

    029 'Change Date',

    041 'Time',

    051 'User Name',

    065 'Comment'.

    ELSE.

    WRITE:/001 'User Name',

    015 'Time',

    025 'Change Date',

    037 'Sale Order',

    049 'Line',

    057 'Sch No',

    065 'Changes'.

    ENDIF.

    ULINE.

    End of Program

    Reward Points if found helpfull..

    Cheers,

    Chandra Sekhar.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.