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: 

user exit in MV45AFZB include

Former Member
0 Kudos

Hi experts,

I got a requirement like this .

To develop user exit to check if the sales order item is within warranty or not,

And then display a message for user action.

Background information and requirement:

When a lift is installed, the Warranty Period is stored in the material master characteristic. If there is a replacement, then the SAP Notification will trigger a Sales Order where the user will create the sale item. During this item creation, a user exit is required to check whether this new replacement should be covered by an existing sales order item warranty (i.e whether the same part has been replaced before and within the warranty period), and the search is by the sales code (ie. The sale order item eg.DEIN material), equipment number ( as represented by the Equipment number in the technical object section in the Sales order header) and subcode (as defined in the characteristic of the item) combination. If an existing item is found and the warranty is still valid (ie.Today - Sales Order items’s Service Rendered Date(that is manually entered by user)< Warranty Period), Then the system should display a message indicating that the sales order item should be crated in service order instead. Otherwise, prompt a message indicating that the user can continue to create the sales order item.

Basic Logic:

User Exit 1:

USEREXIT_MOVE_FIELD_TO _VBKD



1. Develop this user exit to get the Equipment Number from the Notification. The Notification number is retrieved from the Sales Order document flow.
2. Assign the Equipment number to the Sales Order Item’s Technical Information Equipment number field.

User Exit 2:

USEREXIT_CHECK_ABAP



After user enters Sales Order Item, It triggers the user exit USEREXIT_CHECK_ABAP that the performs the following actions.

1. Get the current characteristic, Subcode, value, possibly using USEREXIT_GET_FIELD_FROM _SDCOM.
2. Using the same material number, retrieve the characteristic Warranty Period in the material master classification.
3. Using current sales order item material number and Equipment Number, get all sales order tiem in VBAP and VERIS02 where VBAP-MATNR = material number (which will retrieve the historical sales with same sales code) and EQUINO = Equipment Number.
4. Sort list found by Sales order item’s Service Rendered Date in descending order.
5. Repeat through this list of items until same Sub code is found.

· Get item characteristic Subcode.
· If Subcode = current Subcode and Today <(Service Rendered Date + Warranty Period)
o “part is within warranty. Sales order: NNNNNN. Please create this item in Service Order as non-chargeable.





I got these USEREXITS in MV45AFZB and MV45AFZZ includes.

Can any one tell me what is the purpose of

USEREXIT_MOVE_FIELD_TO_VBKD

in

MV45AFZB

include
and

USEREXIT_CHECK_VBAP

in

MV45AFZZ

include? .

If i write code in above includes is it work out? OR is there any other way to achieve above requirement?

Can any one tell me Step by step process to achieve this.

Iam new to USEREXITs.

Points guaranteed

cheers

kaki

4 REPLIES 4

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Check out the help.

http://help.sap.com/saphelp_46c/helpdata/en/64/72369adc56d11195100060b03c6b76/frameset.htm

Click user exits, user exits in sales, user exits in sales document processing.

Regards,

Rich Heilman

Former Member
0 Kudos

1. You have to get a key from SAP to modify the two includes in which the user exits are present.

2. You have to enter statement 'INCLUDE z**. ' in both user exits in the MV45* includes. Then save and activate the MV45** includes.

3. You have to figure out the code that carries out the functionality described in your specifications.

3. Write the code in includes Z** .

4. Now the code written by you will be executed when you run the relevant SD transaction

Message was edited by: Sudhir Bhate

former_member188685
Active Contributor
0 Kudos

Hi Kaki,

USEREXIT_CHECK_VBAP this is in <b>MV45AFZB</b>

USEREXIT_MOVE_FIELD_TO_VBKD in <b>MV45AFZZ</b>

you gave it in reverse.

first one is to check the consistency , completeness and the second one is to move some fields to VBKD.

i guess these exits will meet your requirement..

Thanks

Vijay

Former Member
0 Kudos

Here are some tips to develop the logic in the two user exits:

In Userexit for VBKD, the Notification ID will be available. Using this Notification ID you have to get the Equipment Number from relevant tables. Then you have to enter this number in the corresponding field of VBKD. This number will be used in the next exit to verify the warranty validity for the line item.

In Userexit for VBAP, you have to verify, (using logic given in your specs) if the part is still under warranty. If yes then you have to raise message and disallow creation of line item in Sales Order. If the warranty is not valid, you have to allow creation of the line item in sales order.