ABAP Development for MM and SD in SAP

主页 » SAP电子书 » ABAP开发/Basis

作者 SAP Press 2017年出版 分类:sap 2157

ABAP Development for Materials Management in SAP

ABAP Development for Sales and Distribution in SAP 两本书,官方出品,英文原版!

1 Introduction ............................................................................... 13

1.1 Objectives ................................................................................... 13

1.2 Structure and Content ................................................................. 13

1.3 Target Audience ........................................................................... 14

1.4 Prerequisites ................................................................................ 14

2 General Information on User Exits and BAdIs ........................... 17

2.1 Using User Exits ........................................................................... 17

2.1.1 Finding and Viewing Enhancements ............................... 18

2.1.2 Creating a Project and Assigning Enhancements .............. 18

2.1.3 Using Components of the Project .................................... 19

2.1.4 Activating and Deactivating Projects .............................. 21

2.2 Use of Classic BAdIs ..................................................................... 22

2.2.1 Finding and Viewing Enhancements ............................... 22

2.2.2 Creating a BAdI Implementation ..................................... 24

2.2.3 Working with Methods ................................................... 25

2.2.4 Activating and Deactivating BAdIs .................................. 27

2.2.5 Enhanced Editing Options ............................................... 28

2.3 Use of New BAdIs (Enhancement Spots) ...................................... 29

2.3.1 SAP Enhancement Framework ......................................... 29

2.3.2 Finding and Viewing Enhancement Spots ........................ 30

2.3.3 Creating Enhancement Implementations ......................... 31

2.3.4 Working with Methods ................................................... 33

2.3.5 Activating and Deactivating BAdIs .................................. 34

3 User Exits and BAdIs in Purchasing .......................................... 37

3.1 Customized Fields in Purchase Orders .......................................... 37

3.1.1 Overview of the Implementation ..................................... 38

3.1.2 Implementation of Custom Purchase Order Data

and Function Group ........................................................ 42

3.1.3 Integration of Custom Fields into the BAdIs .................... 54

3.1.4 Integration of Customer Fields into the Business Logic .... 61

3.1.5 Initializing, Reading, and Updating Data ......................... 68

3.1.6 Display of Error Messages ............................................... 69

3.2 Customizing the Document Overview in Purchase

Requisitions or Purchase Orders ................................................... 72

3.2.1 Removal of a Standard Selection Variant ......................... 72

3.2.2 Inserting Custom Selection Variants ................................ 75

4 User Exits and BAdIs in External Services Management .......... 83

4.1 Prepopulating Account Assignment for Service Lines ................... 83

4.2 Input Check of the Service Lines .................................................. 86

4.2.1 Prepopulating Fields in EXIT_SAPLMLSP_030 ................. 87

4.2.2 Input Check in EXIT_SAPLMLSP_031 .............................. 88

4.3 Prepopulation of the Header Data in the Data Entry Sheet ........... 89

5 User Exits and BAdIs in Inventory Management ...................... 93

5.1 Custom Fields in Transaction MIGO ............................................. 93

5.1.1 Custom Fields: An Overview ........................................... 94

5.1.2 Preparations in the ABAP Dictionary ............................... 97

5.1.3 Preparation of the Function Group .................................. 98

5.1.4 Preparation and Status Management in

MB_MIGO_BADI ............................................................ 104

5.1.5 Activation of Custom Header Data .................................. 109

5.1.6 Activation of Custom Item Data ...................................... 112

5.1.7 Updating the Data .......................................................... 117

5.2 Other Functions of the BAdI MB_MIGO_BADI ............................ 118

5.2.1 Noting Custom Data ....................................................... 119

5.2.2 Input Checks in Transaction MIGO .................................. 123

5.3 Checking and Prepopulating Standard Fields ................................ 125

5.3.1 Prepopulation of Storage Location and Text .................... 125

5.3.2 Checking the Standard Fields .......................................... 126

5.4 Check of the Earliest Delivery Date .............................................. 127

5.5 Tolerance Limits for Scheduling Agreements ................................ 129

5.5.1 Overwriting Overdelivery Quantity .................................. 129

5.5.2 Overwriting Default Quantity .......................................... 132

5.6 Enhancement of Reservations........................................................ 134

5.6.1 Prepopulating Fields ........................................................ 135

5.6.2 Checking Entries ............................................................. 137

6 User Exits and BAdIs in the Valuation and Account

Assignment Area ........................................................................ 139

6.1 GR/IR Clearing Account ............................................................... 139

6.2 Overriding the Account Determination in the User Exit ................ 141

7 User Exits and BAdIs in Logistics Invoice Verification .............. 145

7.1 Custom Fields in Transaction MIRO ............................................. 145

7.1.1 Overview of the Solution via BAdI ................................... 146

7.1.2 BAdI in Detail — Customizations in the

ABAP Dictionary ............................................................. 148

7.1.3 Creating a Custom Dynpro with Table Control ................ 151

7.1.4 Preparation of the Data in the BAdI ................................ 154

7.1.5 Back to the Dynpro ......................................................... 158

7.2 Overriding Tolerance Checks ....................................................... 164

7.2.1 Tolerance Limits in Customizing ...................................... 165

7.2.2 Use of the Enhancement ................................................. 166

8 Validation and Substitution of Accounting Documents ........... 171

8.1 Validation of Accounting Documents ........................................... 172

8.1.1 Callup Points .................................................................. 172

8.1.2 Steps ............................................................................... 173

8.1.3 Example without Exit Routine ......................................... 174

8.1.4 Example with Exit Routine .............................................. 177

8.2 Substitution of Accounting Documents ........................................ 182

8.2.1 Substitution without Exit Routine .................................... 183

8.2.2 Substitution with Exit Routine ......................................... 185

8.2.3 Read Access to Data of the Source Document ................. 188

Appendices ...................................................................................... 193

A User Exits and BAdIs in SAP Materials Management .............................. 193

A.1 Purchasing ................................................................................... 194

A.1.1 Purchase Order Requisitions in General ........................... 194

A.1.2 Purchase Orders in General ............................................. 199

A.1.3 Outline Agreements (Scheduling Agreements/

Contracts) ....................................................................... 205

A.1.4 Pricing ............................................................................ 208

A.1.5 Commitment Functions ................................................... 210

A.1.6 Cross-Document ............................................................. 211

A.1.7 Vendor Evaluation ........................................................... 215

A.1.8 IDoc Processing ............................................................... 216

A.1.9 Logistics Information Systems .......................................... 218

A.1.10 Archiving ......................................................................... 218

A.2 External Services Management ..................................................... 221

A.3 Inventory Management ................................................................ 227

A.3.1 Material Documents in General ....................................... 227

A.3.2 Goods Receipt ................................................................. 233

A.3.3 Reservations .................................................................... 235

A.3.4 Archiving ......................................................................... 236

A.4 Valuation and Account Assignment .............................................. 238

A.5 Logistics Invoice Verification ........................................................ 240

A.5.1 General ........................................................................... 240

A.5.2 Archiving ......................................................................... 254

A.5.3 Conventional Invoice Verification .................................... 254



1 Introduction to Enhancements in Sales and Distribution ......... 19

1.1 Enhancing Standard SD Functionality ........................................... 20

1.1.1 Exits ................................................................................ 21

1.1.2 Projects ........................................................................... 31

1.2 Customer Routines ...................................................................... 32

1.3 The Enhancement and Switch Framework .................................... 34

1.3.1 Explicit Enhancements .................................................... 35

1.3.2 Implicit Enhancements .................................................... 38

1.3.3 The Switch Framework .................................................... 40

1.4 Comparison of Enhancement Methods ........................................ 41

1.5 Summary ..................................................................................... 43

PART I Enhancements in Sales Order Processing

2 Validating Sales Order Data ...................................................... 47

2.1 Business Scenario ......................................................................... 47

2.2 Finding the Right Enhancement ................................................... 48

2.3 Implementing the Solution .......................................................... 51

2.3.1 Create a New Database Z Table ....................................... 52

2.3.2 Generate Table Maintenance ........................................... 52

2.3.3 Create Parameter Transaction .......................................... 52

2.3.4 Creating an Enhancement Point Implementation ............. 54

2.3.5 Implementing an Implicit Enhancement ......................... 56

2.3.6 Coding the User Exit ....................................................... 57

2.4 Summary ..................................................................................... 59

3 Capturing and Saving Additional Data Fields in Sales Order

Processing .................................................................................. 61

3.1 Business Scenario ......................................................................... 61

3.2 Finding the Right Enhancement ................................................... 62

3.2.1 Using the Additional Data B Tab ...................................... 63

3.2.2 Using Implicit Enhancements .......................................... 63

3.2.3 Using Persistent Objects .................................................. 65

3.2.4 USEREXIT_SAVE_DOCUMENT ........................................ 65

3.3 Implementing the Solution .......................................................... 66

3.3.1 Declarations of Data Elements, Database Tables,

and Table Types ............................................................... 66

3.3.2 Create Persistency Classes for Survey Data ....................... 68

3.3.3 Create Database Table Lock Entries ................................. 71

3.3.4 Creating Modification and Implicit Enhancements

for a Custom Screen ........................................................ 71

3.3.5 Create the Implicit Enhancement for PBO Modules ......... 73

3.3.6 Create the Implicit Enhancement for Module PAI ............ 76

3.3.7 Adding Layout Changes to Screen 8309 of SAPMV45A .... 81

3.4 Summary ..................................................................................... 82

4 Creating an SAP CRM Activity after SD Order Billing .............. 83

4.1 Business Scenario ......................................................................... 83

4.2 Finding the Right Enhancement ................................................... 84

4.3 Communication between SAP Systems via RFC ............................ 90

4.3.1 ABAP-to-ABAP Communications .................................... 90

4.3.2 Setting Up RFC Connections ............................................ 91

4.4 Implementing the Solution .......................................................... 93

4.4.1 Creating a New Function Group in the SAP CRM

System ............................................................................ 94

4.4.2 Creating an RFC Function Module in the SAP CRM

System ............................................................................ 94

4.4.3 Specify Function Module Parameters ............................... 95

4.4.4 Implement ABAP Logic to Create an Activity in

SAP CRM ........................................................................ 95

4.4.5 Create the Enhancement Point Implementation in

Function Module RV_INVOICE_REFRESH ........................ 97

4.5 Summary ..................................................................................... 99

5 Filtering Pricing Data within a Web Service ............................. 101

5.1 Background on SOA and Enterprise Services ................................ 102

5.1.1 Service-Oriented Architectures ........................................ 102

5.1.2 Characteristics and Goals of SOA ..................................... 102

5.1.3 Enterprise Services and Web Services .............................. 104

5.1.4 Finding Enterprise Services ............................................. 105

5.2 Business Scenario ......................................................................... 109

5.3 Finding the Right Enhancement ................................................... 111

5.4 Implementing the Solution .......................................................... 111

5.4.1 Locate the Web Service using Transaction SE80 ............... 112

5.4.2 Locate a Provider Class for the Web Service .................... 112

5.4.3 Locate and Implement the Outbound BAdI ..................... 114

5.4.4 Find the Correct Outbound Parameter in the BAdI

Signature ......................................................................... 116

5.4.5 Implement ABAP Coding ................................................. 118

5.4.6 Testing the Enhanced Service .......................................... 119

5.5 Summary ..................................................................................... 120

6 Using a Custom Field in SD Pricing .......................................... 121

6.1 Business Scenario ......................................................................... 121

6.2 Finding the Right Enhancement ................................................... 122

6.3 Implementing the Solution .......................................................... 123

6.3.1 Creating a New Customer Field for Table VBAK ............... 123

6.3.2 Adding a New Field to Pricing Communication

Structure KOMK ............................................................. 125

6.3.3 Creating a New Condition Table ...................................... 126

6.3.4 Maintaining USEREXIT_PRICING_PREPARE_TKOMK ....... 126

6.3.5 Maintaining the Access Sequence .................................... 128

6.3.6 Defining a New Condition Type ....................................... 129

6.3.7 Maintaining Condition Rates in Transaction VK11 ........... 129

6.4 Summary ..................................................................................... 130

PART II Enhancements in Delivery Processing

7 Setting a Delivery Block on the Header Level ........................... 135

7.1 Business Scenario ......................................................................... 135

7.2 Finding the Right Enhancement ................................................... 136

7.3 Implementing the Solution .......................................................... 137

7.3.1 Locating the BAdI ........................................................... 137

7.3.2 Creating a BAdI Implementation ..................................... 140

7.3.3 Adding Code to the Implementation ............................... 143

7.4 Summary ..................................................................................... 144

8 Using a BAdI to Keep Track of Delivery KPIs ............................ 145

8.1 Business Scenario ......................................................................... 145

8.1.1 Current KPI Solution ....................................................... 145

8.1.2 To-Be Process for KPI Reporting ...................................... 146

8.2 Finding the Right Enhancement ................................................... 148

8.3 Implementing the Solution .......................................................... 150

8.3.1 Custom KPI Field Table Layouts ....................................... 150

8.3.2 Define Custom Table ZKPI_FIELDS .................................. 151

8.3.3 Generating a Table Maintenance for ZKPI_FIELDS ........... 154

8.3.4 Define Custom Table ZKPI_DATA .................................... 155

8.3.5 Implement ABAP Coding in Method SAVE_AND_

PUBLISH_DOCUMENT .................................................... 156

8.4 Summary ..................................................................................... 161

9 Using a Customer Exit to Enhance the Outbound Delivery

Monitor ...................................................................................... 163

9.1 Business Scenario ......................................................................... 163

9.2 Finding the Right Enhancement ................................................... 165

9.3 Implementing the Solution .......................................................... 166

9.3.1 Implement the Customer Exit Routine ............................. 166

9.3.2 Add New Field Entries to Append Structure LIPOVZ ....... 168

9.3.3 Add Coding to Derive KPI Data and Calculate

Delivery Age ................................................................... 172

9.3.4 Testing the Enhanced Delivery Monitor .......................... 175

9.4 Summary ..................................................................................... 175

PART III Enhancements in Billing

10 Invoice Splitting Using a VOFM Routine .................................. 179

10.1 Business Scenario ......................................................................... 179

10.2 Finding the Right Enhancement ................................................... 180

10.2.1 Understanding the Invoice Split ...................................... 180

10.2.2 Finding Exits or Enhancements ........................................ 181

10.2.3 Transfer Routines ............................................................. 182

10.3 Implementing the Solution .......................................................... 184

10.3.1 Copy the Existing VOFM Routine .................................... 184

10.3.2 Create an Implicit Enhancement within the Data

Transfer Routine .............................................................. 186

10.3.3 Add Custom ABAP Coding .............................................. 190

10.3.4 Apply Routine to Copy Control ....................................... 191

10.4 Summary ..................................................................................... 192

11 Changing Invoice Reference and Numbering Range

during Document Creation ........................................................ 195

11.1 Business Scenario ......................................................................... 195

11.2 Finding the Right Enhancement ................................................... 198

11.3 Implementing the Solution .......................................................... 201

11.3.1 Define New Numbering Ranges ...................................... 201

11.3.2 Define the Cross-Reference Table .................................... 202

11.3.3 Implement Implicit Enhancements in RV60AFZC ............. 204

11.3.4 Add Coding to Establish Delivery Type ............................ 206

11.3.5 Implement an Implicit Enhancement in RV60AFZZ .......... 207

11.3.6 Add Coding to Amend the Numbering Range .................. 207

11.4 Summary ..................................................................................... 208

PART IV Conclusion

12 Finding the Right Enhancement Technique .............................. 211

12.1 Techniques Used and How the Solution Was Found ..................... 211

12.2 Solution Search Categories ........................................................... 213

12.3 Key Aspects When Implementing Enhancements ......................... 214

12.4 There is No “Silver Bullet” ............................................................ 216

13 Future Outlook .......................................................................... 217

Appendices ...................................................................................... 221

A Exits and BAdIs in Sales and Distribution ............................................... 223

A.1 Sales Orders ................................................................................. 223

A.2 Deliveries .................................................................................... 232

A.3 Invoicing ...................................................................................... 238

A.4 Transport Documents ................................................................... 242

A.5 Shipment Costs ............................................................................ 246

B Code Listing for Class ZCL_SURVEY ....................................................... 249

C The Author ............................................................................................ 253


ABAP BAdi User Exit

下载链接:

上一本

《Kill SAP FICO》from SAP刀客

下一本

Warehouse Management with SAP Functionality and Technical Configuration