Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Sales Order BADI need to change all items on save

0 Kudos
3,718

Hi,

I have a specification where I need to set the delivery priority of all items on a sales document on save of the document, according to the gross weight of the items.

I have tried to implement the user exit MV45AFZZ forms USEREXIT_SAVE_DOCUMENT_PREPARE and USEREXIT_SAVE_DOCUMENT unsuccessfully. This is because the changes made to table xvbap in the exits are only effected on the items that were either created or changed (the items that initially appear in yvbap in the exit).

I have searched for a classic BADI (this is a ECC 5.0 system - no enhancement spots etc) and found BADI_SD_SALES_ITEM but am unable to implement this as I get the error "for SAP internal use only".

I am out of idea.. please, some help would be highly appreciated.

8 REPLIES 8

Former Member
0 Kudos
706

Hi.

Look at interface methods of the following enhancement spots

from SE20 transaction.


BADI_SD_DOCUMENTFLOW           BADI for Document Flow Modification
BADI_SD_SALES                  General Enhancements for Sales Order Processing
BADI_SD_SALES_BASIC            Enhancements for Sales Order Processing Part 2
BADI_SD_SALES_ITEM             Enhancements for Sales Order Processing (Items)
BADI_SD_TAB_CUST_H             Tab Page for Own Details - Header Detail Order
BADI_SD_TAB_CUST_I             Tab Page for Own Data - Item Detail Order

0 Kudos
706

Thanks for you reply, but SE20 does not exist, this is a ECC 5.0 system the enhancement framework is not availiable to me.

0 Kudos
706

Marat,

the BADI's you mention above, including the BADI_SD_SALES, BADI_SD_SALES_ITEM, BADI_SD_TAB_CUST_I are not implementable. I get the message "only for SAP internal use" when trying to implement.

0 Kudos
706

Check enhancements below using SMOD transaction.

Create implementation using CMOD.


SDTRM001  Reschedule schedule lines without a new ATP check
V45A0001  Determine alternative materials for product selection
V45A0002  Predefine sold-to party in sales document
V45A0003  Collector for customer function modulpool MV45A
V45A0004  Copy packing proposal
V45E0001  Update the purchase order from the sales order
V45E0002  Data transfer in procurement elements (PRreq., assembly)
V45L0001  SD component supplier processing (customer enhancements)
V45P0001  SD customer function for cross-company code sales
V45S0001  Update sales document from configuration
V45S0003  MRP-relevance for incomplete configuration
V45S0004  Effectivity type in sales order
V45W0001  SD Service Management: Forward Contract Data to Item
V46H0001  SD Customer functions for resource-related billing
V60F0001  SD Billing plan (customer enhancement) diff. to billing plan

Especially pay attention to those which have name starting with

V45A because VA01 transaction has been attached to SAPMV45A program.

0 Kudos
706

There enhancements use the same logic via YVBAP and XVBAP tables. I will just have the same problem.

I have even tried using exit MV45AFZB USEREXIT_CHECK_VBAP to populate the entries into YVBAP and setting the update key to 'U'. But still the changes are only effected in rows that were changed only.

Perhaps creating an event that can be triggered after save of the sales order that will trigger code to update the sales order via a BAPI will work? If so - how would I got about this? Just a thought.

0 Kudos
706

Now,

the last possibility to enhance code is using implicit enhancement options.

They locate before the first and after the last statement in modularization units

like :


FORM
METHOD
FUNCTION

0 Kudos
706

Once again, this is an ECC 5.0 System there are no enhancement points availiable.

0 Kudos
706

Due to this technical issue it was decided to use a BAPI to make the changes to the Sales Order instead.

So using the user exit and the form USEREXIT_SAVE_DOCUMENT I write all the items in the sales order that was saved to a customized table ZSD_CHANGED (with table maintenance), with all the needed fields.

Then, still in the exit, I trigger an event called SALES_ORDER_CHANGED that will cause a batch job called Z_REACT_SO_CHANGE to react.

This batch job will run a program called ZSD_DEL_LPRIO that will pick up the items in the table ZSD_CHANGED and process then using the BAPI.

If the Items are processed successfully the items for the order in the table are deleted, to prevent the changes from taking place again.

Couldn't think of a better way other then having the enhancement framework availiable like in ECC 6.0.