Creating Sales Scheduling Agreement with Extensions using BAPI

By Arun Warrier, IBM India

Introduction:

A Scheduling Agreement is an outline agreement created between a Vendor and a Customer. A Sales Scheduling Agreement (not to be confused with the Purchasing Scheduling Agreement) is a long term Sales Agreement which contains the details of the delivery schedule and the deliveries are made to the customer as per the schedule entered in the document.  

The Transaction code for Creating a Sales Scheduling Agreement is VA31.  

The objective of this document is to illustrate creation of Sales Scheduling Agreements with Extensions (Z fields) using BAPI. In this scenario, a Z field (ZZMTLIFNR) that exist in VBAP (Sales order Line Item Table) needs to be mapped using the BAPI for creation of Scheduling Agreement.  

BAPI:

The BAPI used for Creation of Scheduling Agreements is SD_SALESDOCUMENT_CREATE.  

The following parameters/tables need to be populated before the BAPI is called:

1.     SALES_HEADER_IN

This structure needs to be populated with header level data of the scheduling agreement that needs to be created.

Some of the parameters that are passed to this structure are:

  1. DOC_DATE     – Document date              VBAK-AUDAT

  2. DOC_TYPE      – Document Type              VBAK-AUART

  3. SALES_ORG   – Sales Organization       VBAK-VKORG

  4. DISTR_CHAN – Distribution Channel   VBAK-VTWEG

  5. DIVISION         – Division                             VBAK-SPART

  6. PURCH_DATE  - Purchase Date              VBAK-BSTDK

  7. CT_VALID_F    – Valid from date             VBAK-GUEBG

  8. CT_VALID_T    – Valid to date                  VBAK-GUEEN

  9. PRICE_DATE    – Pricing Date                  VBAK-PRSDT

2.     SALES_HEADER_INX        

The fields in this structure needs to be populated with ‘X’, if they are being populated in the structure SALES_HEADER_IN.  

For e.g. if SALES_HEADER_IN-DOC_DATE is getting populated with a value say 11/01/2010, then SALES_HEADER_INX-DOC_DATE should be set to ‘X’.  

Code snippet for populating these two structures is given below:

 

Also the field SALES_HEADER_INX-UPDATEFLAG needs to be set to ‘I’.  

     

3.  SALES_ITEMS_IN           

This table needs to be populated with item level data of the scheduling agreement that needs to be created.

The parameters that are passed to this table are:

  1. ITM_NUMBER - Item Number                 VBAP-POSNR

  2. MATERIAL        - Material Number          VBAP-MATNR

  3. PLANT               -   Plant                            VBAP-WERKS

  4. ITEM_CAT         - Item Category                VBAP-PSTYV

  5. TARGET_QTY - Target Quantity              VBAP-ZMENG

  6. CUST_MAT35   - Customer Material        VBAP-KDMAT

  7. REASON_REJ   - Reason for Rejection    VBAP-ABGRU

 4. SALES_ITEMS_INX  

The fields in this structure needs to be populated with ‘X’, if they are being populated in the structure SALES_ITEMS_IN.  

Code snippet for populating these two structures is given below:

 

         The UPDATEFLAG in SALES_ITEMS_INX table needs to be set to ‘I’ (for insert).

The workareas are appended to the internal table.

 

5. SALES_PARTNER                               

This table should be populated with Partner Level Information (Sold to Party, Ship to Party Etc) of the document. The parameters that need to be passed are:

1. PARTN_ROLE    - Partner Role - VBPA-PARVW

2. PARTN_NUMBER – Partner Number – VBPA-KUNNR

3. ITM_NUMBER    - Item Number - VBPA-POSNR – This field needs to be populated with ‘000000’ for Header Level Partner and VBAP-POSNR for Item Level Partner.  

Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image