Sales Order Changes Alert

We have a situation where the Marketing Team keeps making changes to existing sales orders. These changes are often not communicated to the production team, leading to the creation of products that are not in sync with the updated sales orders.

Could someone help us with the further process steps to be followed? Any documentation would be appreciated.

This is related to the S4Hana Public Cloud Edition.

Solution 1:

One way to help the production team is to develop a customized report. You can then schedule it to run in the background and automatically email any changes at the start of the workday.

Program logic look like this:

Check for open Sales Order by date range and open status using the following tables.

Table
VBAK - Sales Document: Header Data
VBAK-VBELN
VBAK-ERDAT - Date on Which Record Was Created

VBAP - Sales Document: Item Data
VBAP-VBELN - Sales Document
VBAP-POSNR - Sales Document Item

VBUK - Sales Document: Header Status and Administrative Data
VBUK-GBSTK - Overall processing status of document

VBUP - Sales Document: Item Status
VBUP-GBSTA - Overall processing status of the SD document item

After getting the open Sales Order data, use the following tables to retrieve the change information. 

Table
CDHDR - Change document header
CDHDR-OBJECTCLAS = ‘VERKBELEG’
CDHDR-OBJECTID = VBAK-VBELN
CDHDR-UDATE = Creation date of the change document
CDHDR-CHANGE_IND = U

CDPOS - Change document items
CDPOS-OBJECTCLAS = CDHDR-OBJECTCLAS
CDPOS-OBJECTID = CDHDR-OBJECTID
CDPOS-CHANGENR = CDHDR-CHANGENR

Solution 2:

395569 - CHECKLISTSD: Change Outputs

Symptom

When certain attribute values in documents are changed, the system must automatically create a change output. This requires customer-specific adjustments as the standard SAP system does not support change outputs processing.

This note provides modification instructions and does not claim to be complete. Internal program structures may change in different releases, so no guarantee is provided for this note (see also Notes 381348 and 170183).

Customizing Settings

For the output type on which the change output is based, make the following settings in Customizing (detail view of an output type):
General Data: Set the “Multiple issuing” indicator.

Change Outputs Section: Assign a form routine (field label: ‘T685B-AROUT’) from the program (field label: ‘T685B-APROG’) to the output type. 

Do not use the form routine of a print program.

Process

If the same output is found during new document processing, the assigned routine is executed by an external program call (performed in the subroutine NNAST_AENDE_CHECK of the include LV61BFON).

The routine must set a return code using the system field SY-SUBRC. If the value is zero, the system creates an output; if the value is other than zero, it does not create an output.

If the system creates an output, it sets the “Change message” indicator in the output record (field NAST-AENDE).

Since output determination starts during document processing, it is recommended to run the routine in the relevant programs. This ensures the required data of the document (old and new status) is available. Use the following programs and assign the required form routines to the includes of the relevant user exits:
 
Object Program Form Routine Include
Sales order SAPMV45A ZZ_ORDER_CH MV45AFZZ
Delivery SAPMV50A ZZ_DELIV_CH MV50AFZZ
Billing document SAPLV60A ZZ_INVOIC_CH LV60AFZZ

The most important data is available in internal tables or structures. The record layout generally corresponds to the basic tables. Variables for the new and old status are available for comparisons. The old status refers to data read before changes, while the new status refers to current data. This affects the following internal structures and tables:
 
Object Old Data New Data
Sales order YVBAK/YVBAP/YVEBP VBAK/XVBAP/XVBEP
Delivery YLIKP/YLIPS XLIKP/XLIPS
Billing document YVBRK/YVBRP XVBRK/XVBRP

The Y variables contain the old data, and the X variables contain the new data (except for the current order header). Objects are represented by a header structure (K) and an item table (P). For sales orders, an additional schedule line table (E) exists.

Procedure Example

The procedure can be illustrated by a simple example. If an item is added to an order or deleted from an order, the confirmation (output type BA00) must be printed again. All other changes are ignored.

Form Routine Creation:

First, create a form routine ZZ_ITEM_CHECK in the user exit MV45AFZZ. The source code may look as specified below.

If the change indicator is set to “Insert (I)” or “Delete (D)”, the change is relevant, and the return value is set to zero. As a result, the system creates a change output. By processing the output, the relevant print program is executed, printing out the complete order confirmation.

Important Remarks:

Identical Outputs: Within identical outputs, there can be only one output that is not processed. If several relevant changes to an object are performed one after the other and the relevant output is not immediately processed, the old output receives a new timestamp. This is not relevant in the above example because the system always prints the complete confirmation. A problem occurs if the last change restores the initial status before the last printout: The system prints the same confirmation. This can be avoided if the change history of an object is available (see change documents). It is also useful to print out only the actual changes, i.e., the items that have been changed.

Unprocessed Outputs: If there is a relevant change and subsequently, an output is created but not processed, and then an irrelevant change is performed in the document, the output that has not been processed yet must be retained.

Reason and Prerequisites

There are clarification requirements and information requirements in the environment of change outputs.

Solution

As mentioned above, a general solution is not available. This note is intended to be used as instructions.

Important: This is a modification. See Note 170183.

Note: SAP will not deal with the implementation and testing of source code in the SAP standard system.

Sample Source Code

Include MV45AFZZ:
* v_mod_395569
FORM ZZ_ITEM_CHECK.

  SY-SUBRC = 4.
  LOOP AT XVBAP.
    IF ( UPDKZ = 'I' ) OR ( UPDKZ = 'D' ).
      SY-SUBRC = 0.
      EXIT.
    ENDIF.
  ENDLOOP.

ENDFORM.
* A mod 395569
 

SAP SD Tips

See Also
Sales Process

Get help for your SAP SD problems
SAP SD Forums - Do you have a SAP SD Question?

SAP Sales and Distribution Books
SAP SD Books  - Certification, Interview Questions and Configuration

Delivery Hints
SAP Logistics Execution

SAP Sales and Distribution Tips
SAP SD Discussion Forum and Sales/Distribution Tips

Main Index
SAP ERP Modules, Basis, ABAP and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.