Saturday 20 May 2017

SAP OTC Process: BAPI Quotation Create Extension - Part 1

SAP OTC (Order-to-Cash) process is the core process of SAP Sales and distribution module. SAP OTC process involves various steps. The first process is ‘ENQUIRY’ from the customers, then ‘QUOTATION’, next is the ‘SALES ORDER’ followed by ‘STANDARD ORDER’ , ‘SHIPPING’, ‘DELIVERY’ , ‘PICKING’ etc.

SAP BAPI (Business Application Programming Interfaces) are widely in SAP Environment for creating, updating and deleting business documents along with reading from the backend database as well. BAPIs are the API methods of SAP business object types, and stored in Business Objects Repository (BOR).

This blog discusses Extension for BAPIs which are part of OTC process. This document is part 1 of the SAP OTC Process extensions serious. Part 2 discusses Sales Order extension.

In Current blog , I am discussing Quotation extension scenario for BAPI_QUOTATION_CREATEFROMDATA2. As discussed earlier, QUOTATION is response to customer Inquiry.

Before we move on to the coding side. There are tables and structures, that must extended with the custom fields.

1) The first step is to add custom fields in the VBAP (Sales document Item level) . I am taking date and time fields, as part of the custom data as show in the below screen capture.

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

2) The next step is adjusting the following structures :

Adjust the following structures for customer enhancements to table VBAP:
  1. VBAPKOZ
  2. VBAPKOZX
  3. BAPE_VBAP
  4. BAPE_VBAPX
  5. VBAPKOM
  6. VBAPKOMX
SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

Here , I have demonstrated adding custom fields in 3 out of 6 structures. Adjusting all structures are mandatory.

3) After adjusting required structures I move on to the coding part of BAPI API_QUOTATION_CREATEFROMDATA2 for the BAPI extension process.

(a) First we need to declare extension container to hold custom data as show below

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

This container needs to be filled and, then supplied at the ‘extensionin’ table for the BAPI_QUOTATION_CREATEFROMDATA2.

4) Now lets fill up some data using function module ‘BAPISDORDER_GETDETAILEDLIST‘ based on inquiry.

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

5) Schedule lines needs to be adjust for example transport planning date, Goods issue date ,scheduling lines date etc as show below.

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

6) For updating custom fields and creating quotations, i am using times and dates fields from table ‘AFVV‘ these fields need to be updating along with quotation creation as part of custom fields data. I am reading date and time fields and putting them in the internal table .

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

7) Next step is updating the extension container

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

8) Now we are ready to call the BAPI_QUOTATION_CREATEFROMDATA2 

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

9) I executed the program and check extension container.

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

extension container is ready ,

10) Now I have to check if I have the new quotation number in variable lv_new_sales_document_type

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

As you can see in the above screen capture, the BAPI returns the new quotation number indicating the successful execution of BAPI.

11) Finally I check the new quotation number in VBAP TABLE and check if custom fields are updated.

SAP Tutorials and Materials, SAP Certifications, SAP Modules, SAP Guides, SAP Learning, SAP SD

All the Custom fields are updated for the newly created Quotation.
SAP Online Guides, Tutorials, Materials and Certifications.

Related Posts

3 comments:

  1. Hello sir,your article about SAP OTC Process:BAPI Quotation Create Extension is very good.Thanks for sharing useful information about various steps involved in SAP OTC Process and also Extension for BAPIs which are part of OTC process in your blog.Visit us at SAP SD Online Training in Hyderabad to learn SAP SD skills.

    ReplyDelete