29
SAP AG 2001, Title of Presentation, Speaker Name 1 Top 10 Userexits in SD

Userexits in SD

  • Upload
    biltex

  • View
    33

  • Download
    3

Embed Size (px)

DESCRIPTION

Userexits in SD

Citation preview

Page 1: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 1/29

SAP AG 2001, Title of Presentation, Speaker Name 1

Top 10 Userexits in

SD

Page 2: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 2/29

SAP AG 2001, Title of Presentation, Speaker Name 2

What is a Userexit?

A Userexit is a predefined place in the SAP standard code wherethe user can write code to influence processing.

Code written in userexits is not overwritten during an upgrade.

A list of most userexits can be found in the IMG.

SD -> System Modification -> Userexits

This list grows with every new release. Code written in userexits is not supported by SAP.

Page 3: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 3/29

SAP AG 2001, Title of Presentation, Speaker Name 3

TOP 10 SD Userexits

1. APPEND Structures

2. User Screens in Sales Order Processing

3. Determining Sales Orders Fields

4. Add New Fields for Pricing

5. Pricing Procedure Userexits

6. ATP Plant Selection

7. Copying Data to Reference Documents

8.  Sales Document “Save” Userexits 

9.  Pricing Type with “New Pricing” 

10. Influencing “New Pricing” 

Page 4: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 4/29

SAP AG 2001, Title of Presentation, Speaker Name 4

Number 1: Append Structures

Can I add a new field to the sales order?

Release 3.0A APPEND STRUCTURES

Page 5: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 5/29

SAP AG 2001, Title of Presentation, Speaker Name 5

Number 2: User Screens in Sales Order Entry 

I just added a field to the sales order header.

How can I maintain / display it in the sales order?

HEADER

SAPMV45A 8309

This is an include dynpro in SAPMV45A 309 

ITEM

SAPMV45A 8459

This is an include dynpro in SAPMV45A 459

Page 6: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 6/29

SAP AG 2001, Title of Presentation, Speaker Name 6

User dynpros exist as part of the “additional data”

screens at header/item level in 3.0. They have their 

own tabs in Release 4.X.

Sales Installation Specific Data Definitions

MV45ATZZ

Sales Installation Specific PBO Modules

MV45AOZZ

Sales Installation Specific PAI Modules

MV45AIZZ

I just added a field to the sales order header.How can I maintain / display it in the sales order? 

Number 2: User Screens in Sales Order Entry 

Page 7: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 7/29 SAP AG 2001, Title of Presentation, Speaker Name 7

Number 3: Determining Sales Order Fields 

MV45AFZZ Sales Order Header  

USEREXIT_MOVE_FIELD_TO_VBAK

Sales Order Item 

USEREXIT_MOVE_FIELD_TO_VBAP

MV45AFZB

Sales Order Serial Numbers  USEREXIT_MOVE_FIELD_TO_VBSN

I just added a new field to the sales order header.How do I fill it with a value?

How can I determine the payment terms different

from standard?

Sales Order Schedule Line

  USEREXIT_MOVE_FIELD_TO_VBEP

Sales Order Business Data

  USEREXIT_MOVE_FIELD_TO_VBKD

Page 8: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 8/29 SAP AG 2001, Title of Presentation, Speaker Name 8

Number 3: Determining Sales Order Fields 

MV45ATZZ Use for general data declarations

TABLES: YYYY.

Common Work Areas

KUAGV - Sold-to Party InformationKUWEV - Ship-to Party Information

KURGV - Payer Information

KUREV - Bill-to Party Information 

MAAPV - Material Master View: Sales Org Data 1

MAEPV - Material Master View: Sales Org Data 2

Page 9: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 9/29 SAP AG 2001, Title of Presentation, Speaker Name 9

Number 3: Determining Sales Order Fields 

MV45AFZZFORM USEREXIT_MOVE_FIELD_TO_VBAK . 

IF SVBAK-TABIX = 0.

VBAK-ZZFIELD = YYYY-ZZFIELD1.

ENDIF.

FORM USEREXIT_MOVE_FIELD_TO_VBKD. IF SVBKD-TABIX = 0.

VBKD-ZTERM = YYYY-ZZFIELD2.

ENDIF. 

Page 10: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 10/29 SAP AG 2001, Title of Presentation, Speaker Name 10

Number 4: Add New Fields for Pricing

How can I price off of the new field I added to thesales order header?

 Add new field to:KOMKAZ - User header fields for pricing

KOMPAZ - User item fields for pricing

 Add to pricing field catalog and create necessary

pricing tables, access sequences.

Next slide …. 

Page 11: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 11/29 SAP AG 2001, Title of Presentation, Speaker Name 11

Number 4: Add New Fields for Pricing

Fill value during order entry and billing. MV45AFZZ – Sales Order 

USEREXIT_PRICING_PREPARE_TKOMK

TKOMK_ZZABC=VBAK-ZZABC

USEREXIT_PRICING_PREPARE_TKOMP

TKOMP-ZZABC=VBAP-ZZABC

RV60AFZZ – Billing DocumentUSEREXIT_PRICING_PREPARE_TKOMK

USEREXIT_PRICING_PREPARE_TKOMP

How can I price off of the new field I added to thesales order header? 

Page 12: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 12/29 SAP AG 2001, Title of Presentation, Speaker Name 12

Number 5: Pricing Procedure Userexits

What are all of the formulas, requirements, etc. inthe pricing procedure for?

Pricing Procedure Requirement

Access Sequence Requirement

Scale Base Formula

Condition Base Formula

Condition Value Formula

Page 13: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 13/29 SAP AG 2001, Title of Presentation, Speaker Name 13

Step Condition type Name Requirement Calc.type Base value

1

10

15

16

17

100

Price

Gross value

Sales deal

% discount

Value discount

Net value

XXX1

XXX2

XXX3

XXX4

2

2

6

8

17

14

12

Pricing procedure

Requirements Formula

s

Access

10

20

Table Requirement

14 Sales Org / Customer / Material

Sales Org / Material

AccessSequence

Condition

TypeXXX4 Scale Base Formula: 15 

51

2

3

4

Number 5: Pricing Procedure Userexits

Page 14: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 14/29 SAP AG 2001, Title of Presentation, Speaker Name 14

VOFM

Requirements

Copying

Requirements

Formulas

Data transfer 

Sales

Orders

Deliveries

Billing

DocumentsTexts

Sales

 Activities

Pricing

Output

Control

 Account

determination

Material

determination

Listing /

Exclusion

Scale

base

Condition

base

Condition

base value

Structure of 

group key

Roundingrule

Statistics

Number 5: Pricing Procedure Userexits

Page 15: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 15/29 SAP AG 2001, Title of Presentation, Speaker Name 15

General Notes 

Requirements are available to aid performance by eliminating

unnecessary accesses to the database.

Formulas are available to calculate values differently from the

way they are calculated in the standard system or to set certainvalues.

In formulas, the field XKWERT always stands for the number 

being determined.

Important work areas: KOMK - Sales header communication structure

KOMP - Sales item communication structure

XKOMV - Internal pricing table

Number 5: Pricing Procedure Userexits

Page 16: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 16/29 SAP AG 2001, Title of Presentation, Speaker Name 16

Requirements 

Definable at the pricing procedure and

access sequence level.

The requirement routine defines the circumstances under which

the access should be made.

Examples 

Requirement ‘6’: Only perform the access if condition

exclusion is not active.

CHECK: KOMP-KZNEP NE ‘X’. New Requirement: Discount is only relevant for items with

material group ‘ABC’. 

CHECK: KOMP-MATKL EQ ‘ABC’.

Number 5: Pricing Procedure Userexits

Page 17: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 17/29 SAP AG 2001, Title of Presentation, Speaker Name 17

Formulas 

Scale Base Formula

This formula alters the value that the system uses to read the

scales in the condition record.

Standard delivered formula “023” is used with condition type

KP03 to compute the incremental surcharge for not ordering in fullpallets. If 24.30 pallets are ordered, scale base formula “023”

changes XKWERT to 0.30 which is then used to read the scales to

determine the appropriate surcharge.

Scale

Base 

Number 5: Pricing Procedure Userexits

Page 18: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 18/29

SAP AG 2001, Title of Presentation, Speaker Name 18

Formulas 

Condition Base Formula

After the condition record has been read and the scale value

retrieved, it is possible to influence the condition basis to which

the scale value will be applied.

Standard delivered formula “022” is used with condition type

KP00 to compute the discount based on full pallets ordered. If 

24.30 pallets are ordered, condition base formula “022” changes

XKWERT to 24 which is then multiplied by the scale rate.

Condition

Base Formula

Number 5: Pricing Procedure Userexits

Page 19: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 19/29

SAP AG 2001, Title of Presentation, Speaker Name 19

Formulas 

Condition Value Formula

After the system has found the correct scale rate from the

condition record and the condition basis for the calculation, the

condition value is calculated.

Scale Rate Condition Basis Condition Value 

5- USD per CS X 5 CS = 25- USD

10- % X 1500 USD = 150- USD

It is possible to influence the condition value calculated by the

system using the condition value formula. It is also possible to

use the formula to do comparisons and set flags.

Number 5: Pricing Procedure Userexits

Page 20: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 20/29

SAP AG 2001, Title of Presentation, Speaker Name 20

Formulas 

Condition Value Formula - Examples

Under certain circumstances, the condition value should be set to

zero.

IF XXX = YYY.XKWERT = 0.

ENDIF.

Standard formulas “8” and “9” are used with customer expected

price to compare the expected value / price with the net value of 

the sales order item. Based on the result, the “pricing ok” flag is

used to block the line item.

Number 5: Pricing Procedure Userexits

Page 21: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 21/29

SAP AG 2001, Title of Presentation, Speaker Name 21

Number 6: ATP Plant Selection 

My primary sourcing plant is determined by zip codeand shipping conditions. Can I do this in SAP?

How can I automate the selection of plants on the

“Other Plants” push button screen? 

MV45AFZB

Selection of primary sourcing plant USEREXIT_SOURCE_DETERMINATION

RV03VFZZ

Selection of secondary sourcing plant USEREXIT_PLANT_SELECTION

Page 22: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 22/29

SAP AG 2001, Title of Presentation, Speaker Name 22

Number 6: ATP Plant Selection 

Define new table (ZZSOURCE) in data dictionary: 

ZIPCD Zip code (full or partial length)

LPRIO Delivery priorityPLNT1 Plant 1

PLNT2 Plant 2, 3, 4, etc.

MV45AFZB 

FORM USEREXIT_SOURCE_DETERMINATION

SELECT SINGLE * FROM ZZSOURCE

WHERE ZIPCD EQ KUWEV-PSTLZ

AND LPRIO EQ KUWEV-VSBED.

VBAP-WERKS = ZZSOURCE-PLNT1.

My primary sourcing plant is determined by zip code

and shipping conditions.Can I do this in SAP?

Page 23: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 23/29

SAP AG 2001, Title of Presentation, Speaker Name 23

Number 6: ATP Plant Selection 

RV03VFZZ

FORM USEREXIT_PLANT_SELECTION

SELECT SINGLE * FROM ZZSOURCE

WHERE ZIPCD EQ KUWEV-PSTLZ

AND LPRIO EQ KUWEV-VSBED.

(Mark SELKZ field in PLANTS internal table for the plant(s)that should be checked or rearrange plants to show secondary,tertiary, etc. selections).

How can I automate the selection of plants on the“Other Plants” push button?

Page 24: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 24/29

SAP AG 2001, Title of Presentation, Speaker Name 24

Number 7: Copying Data to Reference Documents 

I create credit memo requests with reference to thesource billing document, but payment card data doesn‟t

copy from the billing document. Can I do this in SAP?TABLES: T180, FPLTC. ‘’ Not needed in all routines

IF T180-TRTYP CA 'HV'. ‘’Not in display transactions)

IF NOT CVBRK-RPLNR IS INITIAL.

SELECT SINGLE * FROM FPLTC WHERE FPLNR = CVBRK-RPLNR 

AND FPLTR = 900001.

IF SY-SUBRC = 0. “referenced document contains credit cards

CCDATA-CCNUM = FPLTC-CCNUM. "Payment cards: Card number 

CCDATA-CCINS = FPLTC-CCINS. "Payment cards: Card type

CCDATA-DATBI = FPLTC-DATBI. "Payment cards: Exp. date

CCDATA-CCNAME = FPLTC-CCNAME. "Payment cards: Cardholder ENDIF.

SY-SUBRC = 0.

ENDIF.

ENDIF.

(See Data Transfer under t-code VOFM)

Page 25: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 25/29

SAP AG 2001, Title of Presentation, Speaker Name 25

Number 8: Sales Document “Save” Userexits 

MV45AFZZ

8a USEREXIT_SAVE_DOCUMENT_PREPARE

(Look at Note 64876 if you want to return the user to the

transaction.)

MV45AFZZ

8b USEREXIT_SAVE_DOCUMENT

I have some special checks to perform before asales order can be saved. Where can I specify

them?

I have some user tables to update when a sales

order is saved. Where can I do that? 

Page 26: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 26/29

SAP AG 2001, Title of Presentation, Speaker Name 26

Number 9: Pricing Type with New Pricing 

MV61AFZA USEREXIT_CHANGE_PRICING_RULE

PRICING_RULE = „C‟. 

Release 4.0C allows the pricing rule to be specified in a

pop up window with “New Pricing”. 

Refer to note 24832 for more examples. 

When I use “new pricing” in the sales order, I lose all manually entered conditions. Can I do anything

about this? 

Page 27: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 27/29

SAP AG 2001, Title of Presentation, Speaker Name 27

Number 10: Influencing “New Pricing” 

When I change the value of field XXX, the system

does not automatically reprice the document. How

can I accomplish this?

MV45AFZB

USEREXIT_NEW_PRICING_VBAP (document item)

Example: New pricing if the “route” is changed. 

IF VBAP-ROUTE NE *VBAP-ROUTE.

NEW_PRICING = 'B'. ENDIF.

USEREXIT_NEW_PRICING_VBKD (business data)

Page 28: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 28/29

SAP AG 2001, Title of Presentation, Speaker Name 28

Last Thoughts

Userexits are to a talented ABAP programmer what a canvas is to atalented artist.

Userexits are great solution solvers. When you’ve come up against a

gap, look for a userexit as the possible solution.

Remember that code in userexits is not supported by SAP, even if Customer Service happens to give you the code.

Document the business processes that your userexits support.

When you upgrade or interface, that information will be much more

valuable to you than the code itself.

Try to keep it simple!

Page 29: Userexits in SD

7/16/2019 Userexits in SD

http://slidepdf.com/reader/full/userexits-in-sd 29/29

Patti Meder Kimler 

Product Manager 

Supply Chain Management

SAP America, Inc.

3999 West Chester Pike

Newtown Square, PA 19073

Tel: 610-661-8575

Fax: 610-661-8576

Pager: 877-630-9366

Email: [email protected]