Sapass

 Simplify SAP R/3 development with Excel VBA/VB RFC  
Home> Bapi>SalesOrder



Index

SalesOrder

SalesOrder


The business object Sales order is a contractual arrangement
between a sales organization and a sold-to party concerning goods to be delivered or services to be rendered.


A sales order contains information about prices, quantities and dates.


The request is received by a sales area, which is then responsible for fulfilling the order.

Structure

A sales order consists of several items that contain the quantity of
the material or service specified for the order. This total quantity
can be divided into different partial quantities with the corresponding
delivery dates in the schedule lines. Sales order items can be set in a
hierarchy. This makes it possible to differentiate between batches or
to separate the different components of a material (BOM - bills of material).


In the item conditions, the valid conditions for the items are listed.
They can be distributed among the items from an overall condition valid for the whole order.


One item can be divided into several billing plan dates that each
determine a date for which the amount in the item is to be billed.

Integration

Other than sold-to party as customer, you can also specify business partners with different partner functions (e.g. ship-to party).


A sales order can refer to a quotation.


11-Dec-2005


Methods

Available Methods


  • ChangeFromData : Change Sales Order [ BAPI_SALESORDER_CHANGE ]
  • CreateFromDat1 : Sales order: Create Sales Order [ BAPI_SALESORDER_CREATEFROMDAT1 ] (Obsolete in 46C)
  • CreateFromDat2 : Sales order: Create Sales Order [ BAPI_SALESORDER_CREATEFROMDAT2 ]
  • CreateFromData : Create sales order [ BAPI_SALESORDER_CREATEFROMDATA ] (Obsolete in 40A)
  • CreateWithDia : Create Data Container with Dialog [ BAPI_SALESDOCU_CREATEWITHDIA ]
  • GetList : List of all Orders for Customer [ BAPI_SALESORDER_GETLIST ]
  • GetStatus : Display Sales Order Status [ BAPI_SALESORDER_GETSTATUS ]
  • Simulate : Simulate sales order [ BAPI_SALESORDER_SIMULATE ]

11-Dec-2005


ChangeFromData

ChangeFromData


You can use this method to change or delete sales orders.

You can change header, item, schedule line and configuration data.

In general, note that you should:

  • Only specify fields that should be changed
  • Select these fields by entering an X in the checkboxes

  • Enter a U in the UPDATEFLAG field
  • Always specify key fields when changing the data, including in the checkboxes
  • The configuration is an exception here. If this needs to be changed, you need to complete it again fully.
  • Maintain quantities and dates in the schedule line data

  • Possible UPDATEFLAGS:
  • U = change
  • D = delete
  • I = add
  • Example

    1. Delete the whole order
    2. Delete order items
    3. Change the order

    4. Change the configuration

    Notes

    1. Minimum entry:

    You must enter the order number in the SALESDOCUMENT structure.
    You must always enter key fields for changes.
    You must always specify the update indicator in the ORDER_HEADER_INX.


    1. Commit control:

    The BAPI does not run a database Commit, which means that theapplication must trigger the Commit so that the changes are read to the database. To do this, use the BAPI_TRANSACTION_COMMIT BAPI.


    11-Dec-2005


    CreateFromDat1

    CreateFromDat1


    You can use this method to create sales orders.

    You must enter at least the order header data (from the ORDER_HEADER_INstructure) as well as partner data (using the ORDER_PARTNERS table) as input parameters.

    Enter item data using the ORDER_ITEMS_IN table. You can allocate the
    item number by filling in the relevant fields manually, or the systemdoes it according to the settings in Customizing, whereby the relevant fields remain blank.

    If the item is configurable, you need to enter the configuration datain the ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_PART_OF and ORDER_CFGS_VALUE tables.


    You can use the BAPICCARD structure to enter credit card data. You caneither enter data for identifying the card or, you can enter data for an authorization in an external system.

    Once you have successfully created the sales order, the system displays
    the document number (in the SALESDOCUMENT field), as well as detaileddata about the other parties (in the OLD_TO_PARTY, SHIP_TO_PARTY andBILLING_PARTY structures). The RETURN parameter displays any errors that may have occured.

    The ORDER_ITEMS_OUT table contains more detailed information that will
    enable you to judge the pricing and availability of an item.

    Notes

    1. Mandatory entries:

    ORDER_HEADER_IN : DOC_TYPE Sales document type
    SALES_ORG Sales organization
    DISTR_CHAN Distribution channel
    DIVISION Division


    ORDER_PARTNERS..: PARTN_ROLE Partner functions, SP sold-to party
    PARTN_NUMB Customer number

    ORDER_ITEMS_IN..: MATERIAL Material number
    REQ_QTY Order quantity in sales unit

    1. Ship-to party


      If a ship-to party hasn't been entered, the ship-to party = sold-to
      party

    2. COMMIT control:Parameter WITHOUT_COMMIT
      If this switch is activated, the system does not process any CommitWork and the application that has called it up must trigger the Commit itself. To do this, useBAPI_TRANSACTION_COMMIT.
    3. German keywords:
      The following keywords must be entered in German, regardless of the
      logon language:

      DOC_TYPE Sales document type, for example TA for standard order
      PARTN_ROLE Partner function, for example, WE for ship-to party

    Further Information

    You can see further notes in OSS. Note 93091 contains general information about the SD BAPIs.


    11-Dec-2005


    CreateFromDat2

    CreateFromDat2


    You can use this method to create sales orders.

    You must enter at least sales order header data (via ORDER_HEADER_INstructure) and partner data (via the ORDER_PARTNERS table) as input parameters.

    Enter the item data via the ORDER_ITEMS_IN table. You can allocate item
    numbers manually, by filling in the relevant fields, or the system doesit, according to the settings for Customizing, by leaving the relevant fields blank.

    If you have configurable items, you must enter the configuration datain the ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_PART_OF and ORDER_CFGS_VALUE tables.


    Credit cards can be transferred via the BAPICCARD structure, on the onehand, data for card identification, on the other, data for a transaction which has taken place in an external system.

    Once you have created the sales order successfully, you will receive
    the document number (SALESDOCUMENT field). Any errors that may occur will be announced via the RETURN parameter.

    If no sales area has been created in the sales order header, then thesystem creates the sales area from the sold-to party or ship-to party,
    who has been entered in the partner table. If a clear sales area cannotbe created, you will receive a system message, and the sales order will not be created.

    Notes

    1. Mandatory entries:

    ORDER_HEADER_IN : DOC_TYPE Sales document type
    SALES_ORG Sales organization

    DISTR_CHAN Distribution channel
    DIVISION Division

    ORDER_PARTNERS..: PARTN_ROLE Partner role, SP sold-to party
    PARTN_NUMB Customer number

    ORDER_ITEMS_IN..: MATERIAL Material number


    1. Ship-to party:

      If no ship-to party is entered, use the following: Ship-to party =
      sold-to party.
    2. Commit control:
      The BAPI does not have a database commit. This means that the relevantapplication must leave the commit, in order that can be carried out on
      on the database. The BAPI BAPI_TRANSACTION_COMMIT is available for this.
    3. German key words:
      The following key words must be entered in German, independantly of
      the logon language:
      DOC_TYPE Sales document type, for example: TA for standard order
      PARTN_ROLE Partner role, for example: WE for ship-to party

    Further Information

    You can find further information in the OSS. The note 93091 contains general information on the BAPIs in SD.


    11-Dec-2005


    CreateFromData

    CreateFromData


    You can use this method to create sales orders.

    This BAPI is no longer maintained.

    Use one of the following BAPIs to create sales documents:

    - BAPI_INQUIRY_CREATEFROMDATA Create sales inquiries
    - BAPI_QUOTATION_CREATEFROMDATA Create quotation

    - BAPI_SALESORDER_CREATEFROMDAT1 Create sales orders


    11-Dec-2005


    CreateWithDia

    CreateWithDia


    Using this method, you can create sales documents with items, schedule lines and item conditions.

    You must enter at least sales order header data (via the structureORDER_HEADER_IN) and partner data (via the table ORDER_PARTNERS).

    Enter the item data via the table ORDER_ITEMS_IN. You can enter the item number manually, by filling in the relevant fields, or
    automatically, corresponding to Customizing, by leaving the relevantfields blank. If you decide to enter item numbers using R/3, noschedule lines or conditions can be entered, as these cannot be linked to the corresponding item.

    If you are dealing with configurable items, you must enter the configuration data in the tables ORDER_CFGS_REF, ORDER_CFGS_INST,
    ORDER_CFGS_PART_OF, ORDER_CFGS_VALUE and ORDER_CFGS_BLOB.

    The scheduling data can be published via the structure SALES_SCHEDULE_IN.

    Document condtions to be created can be entered via the structure SALES_CONDITIONS_IN.

    Credit card data can be published via the structure SALES_CCARD, card
    identification data on the one hand, data on an authorization that has taken place in an external system on the other.

    Once you have created the sales document successfully, you will receivethe document number (field SALESDOCUMENT_EX). (Feld SALESDOCUMENT_EX).


    Errors which might occur will be announced via the parameter RETURN.

    Using the checkbox:

    You can generate the individual components for a sales document with orwithout a checkbox. If you decide on the first possibility, only fields
    with unequal SPACE will be copied. In the second case (field UPDATEFLAG), only fields which have an 'X' in the box are copied. As aresult, fields, which are preassigned to default values by the system, can be set on SPACE again.

    Example


    Notes

    1. If no object references are to be written, the following fields (parameters) should be initialized:

      BINARY_RELATIONSHIPTYPE
      SALES_HEADER_IN-REFOBJECTTYPE
      SALES_HEADER_IN-REFOBJECTKEY

      SALES_HEADER_IN-REFDOCTYPE


    11-Dec-2005


    GetList

    GetList


    You can use this method to display the sales orders for a customer.

    Notes

    Mandatory entries:

    You must enter the relevant customer number in the SALESDOCUMENT parameter and the requested sales organization in theSALES_ORGANIZATION parameter.


    Optional entries:

    You can restrict the selection by entering certain criteria. Forexample you can display all the orders for a certain material or ordersfrom a particular time period (MATERIAL or DOCUMENT_DATE and DOCUMENT_DATE TO paramters). You can also find a certain sales order
    using the customer's purchase order number (PURCHASE_ORDER parameter).


    11-Dec-2005


    GetStatus

    GetStatus


    You can use this method to find information for certain sales orderswith regard to availability, processing status (for example, delivery status) and prices.

    Enter the relevant document number in the SALESDOCUMENT parameter. Thesystem then displays the detailed information in the STATUSINFO structure.


    Any errors that occur appear in the RETURN parameter.


    11-Dec-2005


    Simulate

    Simulate


    This method has the same interface definition as the BAPI_SALESORDER_CREATEFROMDAT1 function but differs from it in thathere the sales order is not updated.

    Here you can determine availability and pricing. This data is displayed in the ORDER_ITEMS_OUT table.


    Notes

    1. For 46A, the following enhancements have been made:
      1. New output tables:

        ORDER_SCHEDULE_IN Schedule line data input
        ORDER_CCARD_EX Credit card data output
        ORDER_SCHEDULE_EX Schedule line data output
        ORDER_CONDITION_EX Conditions output
        MESSAGETABLE Warning table (XVBFS)

      2. Sales area determination
      3. Order entry with ship-to party

    If no sales area is entered in the sales order header, then the systemcreates the sales area from the sold-to party or ship-to party, who hasbeen entered in the partner table. If no clear sales area can be
    created, you will receive a system message, and the sales order will not be created.


    11-Dec-2005