Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

bap_salesorder_simulate

Former Member
0 Likes
748

Hi All,

Can any one help me on using the FM bap_salesorder_simulate.Also please tell me what is the purpose of using this FM because my requirement has something to do with Pricng Calculation.

It would be of great help if someone could send me a working example of this FM.

Thanks In advance

Gaurav

Hi All,

Can any one help me on using the FM bap_salesorder_simulate.Also please tell me what is the purpose of using this FM because my requirement has something to do with Pricng Calculation.

It would be of great help if someone could send me a working example of this FM.

Thanks In advance

Gaurav

4 REPLIES 4
Read only

Former Member
0 Likes
639

Please can any one help on this.I promise to reward points ..

Read only

Former Member
0 Likes
639

BAPI_SALESORDER_SIMULATE will give you the pricing information based on the material and customer entered and also gives availability information.

Check this code as example..

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.
 DATA: it_vbapvb LIKE TABLE OF vbapvb,
      wa_vbapvb LIKE LINE OF it_vbapvb.

* 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.
 
* 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.


* 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.

Message was edited by: Thomas Mann

Read only

0 Likes
639

Hi,

Can you help me in using BAPI "BAPI_SALESORDER_SIMULATE " for variant configurable material.

If you have any sample code please apste it here.

Thanks in advance.

Read only

Former Member
0 Likes
639

Hi,

BAPI_SALESORDER_SIMULATE is to check the sales order creation by passing the primary data. If it is successful(check the return parameters), then call BAPI_SALESORDER_CREATEFROMDAT2 to create a sales order.

Best regards,

Prashant