Skip to Content
author's profile photo Former Member
Former Member

what is the use of bapi_salesorder_simulate

Hi Experts,

Please explain me the use of bapi_salesorder_simulate or give me a useful link.

Thank you.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Feb 27, 2007 at 08:17 AM

    HI Madhu,

    Most of the BAPIs will be documented in the SE37 transaction itself. If you do not have the system access, here it is:

    "Short Text

    Sales Order: Simulate Sales Order

    Functionality

    This method has the same interface definition as the

    BAPI_SALESORDER_CREATEFROMDAT1 function but differs from it in that here

    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:

    a) 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)

    b) Sales area determination

    c) Order entry with ship-to party

    If no sales area is entered in the sales order header, then the system

    creates the sales area from the sold-to party or ship-to party, who has

    been 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. "

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 08:20 AM

    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:

    a) 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)

    b) Sales area determination

    c) Order entry with ship-to party

    If no sales area is entered in the sales order header, then the system creates the sales area from the sold-to party or ship-to party, who has been 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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 08:21 AM

    hi,

    take this one:

    REPORT z_salesorder_simulate.

    DATA: order_header_in LIKE bapisdhead,

    order_items_in LIKE TABLE OF bapiitemin,

    return LIKE bapireturn,

    wa_order_items_in LIKE LINE OF order_items_in,

    order_partners LIKE TABLE OF bapipartnr,

    wa_order_partners LIKE LINE OF order_partners,

    order_items_out LIKE TABLE OF bapiitemex,

    wa_order_items_out LIKE LINE OF order_items_out.

    • Fill order_header_in

    order_header_in-doc_type = 'TA'.

    • Fill order_items_in

    wa_order_items_in-material = '000000000000000001'.

    wa_order_items_in-req_qty = '1000'.

    APPEND wa_order_items_in TO order_items_in.

    • Fill order_items_in

    wa_order_partners-partn_role = 'AG'.

    wa_order_partners-partn_numb = '0000000001'.

    APPEND wa_order_partners TO order_partners.

    • Execute Function Module BAPI_SALESORDER_SIMULATE

    CALL FUNCTION 'BAPI_SALESORDER_SIMULATE'

    EXPORTING

    order_header_in = order_header_in

    IMPORTING

    return = return

    TABLES

    order_items_in = order_items_in

    order_partners = order_partners

    order_items_out = order_items_out.

    • The return structure gives any error messages

    WRITE: return-message.

    • Print out the order items

    LOOP AT order_items_out INTO wa_order_items_out.

    WRITE: wa_order_items_out-material,

    wa_order_items_out-short_text,

    wa_order_items_out-subtotal_2.

    ENDLOOP.

    ______________________________________________________________

    extend the example above with this code:

    DATA: it_vbapvb LIKE TABLE OF vbapvb,

    wa_vbapvb LIKE LINE OF it_vbapvb.

    • Fill it_VBAPVB

    wa_vbapvb-matnr = '000000000000000001'.

    wa_vbapvb-zmeng = 1.

    APPEND wa_vbapvb TO it_vbapvb.

    • Fill order_items_in

    LOOP AT it_vbapvb INTO wa_vbapvb.

    wa_order_items_in-material = wa_vbapvb-matnr.

    wa_order_items_in-req_qty = wa_vbapvb-zmeng * 1000.

    APPEND wa_order_items_in TO order_items_in.

    ENDLOOP.

    ___________________________________________________________________

    The BAPI does not return the line items with the price. YOu will have to work around this a little. This is what I have done.

    1. BAPI_SALESORDER_CREATEFROMDAT2 calls SD_SALESDOCUMENT_CREATE. Instead of creating a copy of the BAPI, i have created a copy of SD_SALESDOCUMENT_CREATE.

    2. Create a table SALES_ITEMS_OUT type VBAP in the tables parameter for this function.

    3. Then use EXPORT to memory to store the TESTRUN flag.

    4. in User Exit USEREXIT_CHECK_VBAP; EXPORT TESTRUN flag from memory and check if it set. (which means you are simulating the order creation).

    5. If TESTRUN is set, move contents of VBAP to internal table. Export the table to memory. So for every line item at this user exit level, the prices are calculated and you are storing them in an internal table in memory.

    6. Finally in the copy of SD_SALESDOCUMENT_CREATE, at the end, import the internal table from memory and pass this to sales_items_out.

    ____________________________________________________________________

    Some one is actually changing a Condition Value Pricing Formuala (You will find it in transaction VOFM, in the menu Formulas->Condition value

    In fact the routine number is 932. You can check the source code from VOFM.

    These are pricing related formulas which are used for determining a pricing condition value during Sales Document Create/Change and are integrated into Pricing function group coding (SAPLV61A).

    You can ask the corresponding user to correct his code..

    ______________________________________________________________

    Two possibilities,

    Go to SE38 and enter program name RV64A932 and hit change, if the other user SZPAK is not locking it then you should be able to change the code. Just correct the syntax error, save and activate.

    Or goto VOFM, Formulas->condition value,

    goto 932 routine, hit change and correct the syntax error, save and activate.

    Try intimating the user who changed it if it is not allowing you to change it or is asking for a change request..

    Hope this helps..

    Also if you are able to change it then put a comment for the other user so that he will know that you have corrected the syntax error..

    Pls : award points if useful.

    cheers!

    sri

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.