Throw Information message for sale order created with value less that 5$

Hi all,
        I am basically an abaper, I have got a requirement in SD. The requirement is any sales order created with value less that 5$, should be prompted with an error message saying the minimum order value should be more than 5$. Could any one help me on this.
Thanks in advance,
shiv

userexit_save_document_prepare,main program - sapmv45a, issue an error message if your document value is less than 5$ (VBAK-NETWR) but check if your order has any non-rejected item, I would not issue this message if all items are rejected:
loop at xvbap where updkz ne 'D' and abgru = ' '.
  exit.
endloop.
if sy-subrc = 0.  "-you have at least one non-rejected, non-deleted item.
NOTE: sapmv45a works NOT only for orders, so please check document types in your logic which are relevant to your messge only (VBAK-VBTYP and/or VBAK-AUART).

Similar Messages

  • Need no document flow update for sales order create with reference

    Dear All.
    We would like to have the ability to create a sales order with reference to another sales order, and have the document flow of the sales order not updated.
    Unlike the case of a standard create with reference where the documents are linked, in this case there is no relationship between the documents.  The first document is just acting like a template for the remaining documents, to save time during order entry.
    We have turned off update of document flow at the line item level.
    But I don't see a way for us to turn this off at the header (document level).  So wondering if there's another way to turn this off, or possibly through user-exit or VOFM requirement?
    Has anyone else done this?
    I think that CRM has this functionality, but we're still entering orders through ERP-SD.
    Many Thanks!

    Hello Colleague;
    The issue you have reported is SAP standard.  The checkbox "Update Document Flow" (V_TVCPAAP-UPFLU) controls document flow at item level.  If this checkbox is set to blank, there will be no document flow at item level.
    However, the document flow cannot be completely turned off - if the 'update document flow' indicator is blank, you will still see an entry in the document flow, but there will be no update to table VBFA (Sales Document Flow) and the document flow of the predecessor will not be updated at item level (no record in VBFA at item level).                                                                               
    The reason is that the system checks VBAP (Sales Document: Item Data) for fields VGBEL (Document number of the reference document) and VGPOS (Item number of the reference item) for values.  You will always have document flow information on header and item level in the successor because it stores this information in table VBAP.                                                                               
    Related with this issue, you can find a Note 53383 for your review.
    I hope it can clarify the case.
    Regards
    Ruy Castro

  • Pricing condition redetermination for sales order created with reference

    Hi,
    Are  there any exit or routines that can be used to redetermine MWST pricing condition alone when creating sales order with reference to another sales order? The pricing from preceeding sales order is copied but we need only MWST to be redetermined after saving the order
    This is because we are making changes so that while saving the sales order the material tax classification is defaulted to M based on some conditions so that MWST picks up the value M
    Regards,
    Vin

    Hello Vinod ,
    did you tried following options :-
    1.Using Exit ( MV45aFzz) and re calculte pricning using FM 'PRICING'.
    2.or Using Copy Control (Tcode : VOFM ) while creating order with Ref.
    regards
    Prabhu

  • ATP for sales orders created with BAPI_SALESORDER_CREATEFROMDAT2

    We use BAPI_SALESORDER_CREATEFROMDAT2 to create sales orders (from external EDI system).  How can I use this BAPI to perform availability-to-promise checking?  If it can't be done is there another function module I can use where I pass a sales order number and it performs ATP on the entire order or individual lines?  thanks for any help.

    Hi,
    Please check BAPI BAPI_MATERIAL_AVAILABILITY.
    Regards,
    Ferry Lianto

  • Change of Sold to Party in Sales order created with Reference to Contract

    Dear Gurus
    I want to change the sold to party in Sales Order created with reference to contract.
    When I create a Sales order with reference to contract the system copies all the partner functions- Sold to, Ship to, Bill to and Payer alongwith other data.
    However Sold to is marked as "Grey" and not changable, rest of the partners can be changed.
    There is no subsiquent document created with reference to this Sales Order.
    Please advice.
    Thanks a lot.
    Regards
    Raghu

    Hi ,
    Please follow the below mentioned step.
    1) Create a partner function letts say Authorized SP .
    2) Assign all the possible authorised  SP (customer) in the contract.
    3) When you create sales order with reff to Contract. Put the customer for whom you wish to create a sales order in release partner tab.
    Hop this will resolve our problem
    Regards,
    Krishna O

  • Function module which uses both BAPI's for sales order create and change

    Please name the function module which uses both BAPI's for sales order create and change.
    BAPI_SALESORDER_CREATEFORMDAT2
    BAPI_SALESORDERCHANGE

    Yup.
    you must write a piece of code for this.
    with if else condition.first check if SO is exsist than use second FM to change it else create new SO from first FM.
    logic somethig like this.
    Amit.

  • I have created a quotation in CRM system. I want that to be downloaded into ECC, so that, I can create a sales order there with reference to that quotation. So, what are the parameters that I need to set in CRM system so that my quotation gets replicated?

    Dear Experts,
    I have created a quotation in CRM system. I want that to be downloaded into ECC, so that, I can create a sales order there with reference to that quotation. What are the parameters that I need to set in CRM system so that my quotation gets replicated without any error?
    Please help me in this regard. An early and in detail step by step guidance is highly appreciated.
    Thanks,
    SMTP

    It may be best to recreate the folder and the smart playlists from scratch.
    tt2

  • Sales Order Created with reference to Contract - Exchange rate Issue

    When Sales Order created with reference to contract VBKD fields KURSK and KURSK_DAT gets copied from contract and not redetrmined based on pricing date and Exchange rate type. I expected it to be determined based on pricing date is standard. What I am missing, should it be controlled by data transfers
    If Document currency and condition currency are different it cause problems with incorrect condition values are calculated, as KOMP-KURSK are copied from VBKD-KURSK
    Any help or directions would be greatly appreciated . We are on 4.7 ISOIL
    Sincerely Julietta

    Well,
    and if we have the same issue, but we don't have OIL Version, but simple 4.6C, which solution has to be applied then?
    Thank you
    Standa

  • Error  : Sales order 'create with Reference' to the contract

    We have made a value contract. Now we are trying to make a Sales order 'create with Reference' to the contract.
    when we do that, we am getting error 'copying material in any value contract item is not permitted'
    Any help or directions would be greatly appreciated . We are on Ecc 6.0
    Rohit

    As of now my value contract has just one material. so i dont need assortment module settings. right?
    in VTAA settings are as follows
    Target type: OR  
    Source type: ZK1
    there is only on item category
    Target item category: TAN   
    Source item category: WKN
    Copying requirement : 301
    update doc flow : 2
    pricing type : C
    cont item copy mode : A
    DataT am using 151,102,002
    There are no schedule line.
    Rohit
    Edited by: rohit kumar on May 15, 2008 7:36 PM

  • Need code for sales order create report using bapi's

    need code for sales order create report using bapi's

    Hi,
    Go through below link
    http://www.saptechies.com/bapi_salesorder_createfromdat2/
    <b>Reward points if it helps,</b>
    Satish

  • Is there a Business Object for Sales Order Create and Change VA01 and VA02

    Hi experts -
    I am looking for a business object for Sales order create and change VA01 and VA02 respectively?
    Thanks,
    Mark

    Hi Mark,
    I think this question is best answered in [SAP Solutions|/community [original link is broken]; Forums.
    - Subhodeep
    Edited by: Subhodeep on Aug 29, 2009 11:14 AM

  • BAPI for sales order create

    My query is
    In BAPI_SALESORDER_CREATEFROMDAT2, when pricing condition types have been passed in ORDER_CONDITIONS_IN  tables, after creation of sales order, double conditions types occurred in sales order.
    How to remove that duplicacy ?
    Suggestion is that
    1st set of condition types occurring based on config
    2nd set of conditions types coming from FM.
    How to ignore 1st of data?

    hi
    Hi,
    Go through this one
    *& Report ZSD_j_SALESORDER
    report zsd_j_salesorder1 line-size 132 message-id zmmbapi .
    *& Created By : janani
    *& Created on : 13.10.2007
    *& Requested By : vardhman
    *& Description of program :
    Internal table definition *
    data: gt_order_header_in like bapisdhead occurs 0 with header line,
    gt_return like bapireturn1 occurs 0 with header line, " Return Messages
    gt_order_items_in like bapiitemin occurs 0 with header line, " Item Data
    gt_salesdocument like bapivbeln-vbeln , "Number of Generated Document
    gt_order_partners like bapiparnr occurs 0 with header line, "Document Partner
    gt_return1 like bapiret2 occurs 0 with header line.
    Data definition *
    types: begin of ty_gt_ft_sales ,
    partn_numb(10) type n ,"Customer Number 1
    partn_role(2) ,"Partner function
    sales_org(4) , "Sales Organization
    distr_chan(2) , "Distribution Channel
    division(002), "DIVISION
    doc_type(4) , "Sales Document Type
    purch_no(020), "Purchase order
    material(18), "MATERIAL
    targetquantity(020),"Target quantity
    reqqty(020), "Req quantity
    reqdate(010), "req date
    *REQ_DATE_H(010),
    ref_1(012), "Ref
    unload_pt(025),
    *PARTN_ROLE(2) ,"Partner function
    *PARTN_NUMB(10) ,"Customer Number 1
    end of ty_gt_ft_sales,
    begin of ty_header ,
    partn_numb(10) ,"Customer Number 1
    partn_role(2) ,"Partner function
    sales_org(4) , "Sales Organization
    distr_chan(2) , "Distribution Channel
    division(002), "DIVISION
    doc_type(4) , "Sales Document Type
    purch_no(020), "Purchase order
    unload_pt(025),
    req_date_h(010),
    end of ty_header,
    begin of ty_item,
    material(18), "MATERIAL
    targetquantity(020),"Target quantity
    reqqty(020), "Req quantity
    reqdate(010), "req date
    ref_1(012), "Ref
    *UNLOAD(025),
    end of ty_item.
    data : msg(240) type c, " Return Message
    e_rec(8) type c, " Error Records Counter
    rec_no(8) type c, " Records Number Indicator
    s_rec(8) type c, " Successful Records Counter
    t_rec(8) type c, " Total Records Counter
    v_matnr like mara-matnr,
    v_parvw type parvw.
    data : gt_ft_sales type standard table of ty_gt_ft_sales with header line.
    data : wa_gt_ft_sales type ty_gt_ft_sales,
    wa_order_items_in like gt_order_items_in,
    wa_gt_ft_sales1 type ty_gt_ft_sales,
    wa_header type ty_header,
    salesdocument like bapivbeln-vbeln.
    selection block for EXCEL UPLOAD FILE
    selection-screen begin of block b1 with frame title text-000.
    parameters file type ibipparms-path obligatory.
    selection-screen end of block b1.
    *<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .
    at selection-screen on value-request for file .
    perform getname.
    form getname.
    call function 'F4_FILENAME'
    exporting
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    importing
    file_name = file.
    endform.
    *TOP-OF-PAGE.
    top-of-page.
    skip 3.
    format color col_heading inverse on.
    write 40 text-001.
    format color col_heading inverse off.
    skip 1.
    format color col_negative inverse on.
    write :/ text-002, 13 sy-mandt , 104 text-003, 121 sy-uname,
    / text-004, 13 sy-datum , 104 text-005, 121 sy-uzeit.
    format color col_negative inverse off.
    skip 3.
    *START-OF-SELECTION.
    start-of-selection.
    perform get_data.
    perform bapi.
    *end-of-page.
    perform result.
    form result.
    t_rec = e_rec + s_rec.
    skip 3.
    format color col_total inverse on.
    write: /38 text-007, t_rec.
    format color col_total inverse off.
    format color col_negative inverse on.
    write: /38 text-008, e_rec.
    format color col_negative inverse off.
    format color col_total inverse on.
    write: /38 text-009, s_rec.
    format color col_total inverse off.
    endform.
    *& Form get_data
    text
    --> p1 text
    <-- p2 text
    form get_data .
    call function 'WS_UPLOAD' "#EC *
    exporting
    filename = file
    filetype = 'DAT'
    tables
    data_tab = gt_ft_sales
    exceptions
    conversion_error = 1
    file_open_error = 2
    file_read_error = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    no_authority = 10
    others = 11.
    if sy-subrc 0 .
    message e000.
    endif.
    endform. " get_data
    *& Form BAPI
    form bapi .
    loop at gt_ft_sales into wa_gt_ft_sales.
    wa_gt_ft_sales1 = wa_gt_ft_sales.
    at new partn_numb.
    wa_header-doc_type = wa_gt_ft_sales1-doc_type..
    wa_header-sales_org = wa_gt_ft_sales1-sales_org . "'0001'
    wa_header-distr_chan = wa_gt_ft_sales1-distr_chan. "'01'
    wa_header-division = wa_gt_ft_sales1-division. " '01'
    wa_header-purch_no = wa_gt_ft_sales1-purch_no.
    wa_header-req_date_h = wa_gt_ft_sales1-reqdate.
    call function 'CONVERSION_EXIT_PARVW_INPUT'
    exporting
    input = wa_gt_ft_sales1-partn_role
    importing
    output = v_parvw.
    wa_header-partn_role = v_parvw.
    wa_header-partn_numb = wa_gt_ft_sales1-partn_numb.
    wa_header-unload_pt = wa_gt_ft_sales1-unload_pt.
    move-corresponding wa_header to gt_order_partners.
    move-corresponding wa_header to gt_order_header_in.
    append gt_order_header_in.
    append gt_order_partners.
    endat.
    call function 'CONVERSION_EXIT_CCMAT_INPUT'
    exporting
    input = wa_gt_ft_sales1-material
    importing
    output = v_matnr.
    gt_order_items_in-material = v_matnr .
    gt_order_items_in-target_qty = wa_gt_ft_sales1-targetquantity . "'1000'
    gt_order_items_in-req_qty = wa_gt_ft_sales1-reqqty.
    gt_order_items_in-req_date = wa_gt_ft_sales1-reqdate.
    *GT_ORDER_ITEMS_IN-BILL_DATE = wa_GT_FT_SALES1-REQDATE.
    gt_order_items_in-ref_1 = wa_gt_ft_sales1-ref_1.
    append gt_order_items_in.
    clear : wa_gt_ft_sales1,wa_header.
    at end of partn_numb.
    call function 'BAPI_SALESORDER_CREATEFROMDAT1'
    exporting
    order_header_in = gt_order_header_in
    WITHOUT_COMMIT = ' '
    CONVERT_PARVW_AUART = 'X'
    importing
    salesdocument = salesdocument
    SOLD_TO_PARTY =
    SHIP_TO_PARTY =
    BILLING_PARTY =
    return = gt_return
    tables
    order_items_in = gt_order_items_in
    order_partners = gt_order_partners.
    ORDER_ITEMS_OUT =
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CCARD =
    ORDER_CFGS_BLOB =
    ORDER_SCHEDULE_EX =
    if gt_return-type eq 'E' .
    e_rec = e_rec + 1.
    read table gt_return with key id = 'V1'.
    format color col_negative inverse on.
    rec_no = e_rec + s_rec.
    concatenate text-006 rec_no ':'
    gt_return-message into msg separated by space .
    condense msg.
    write: / msg.
    format color col_negative inverse off.
    elseif gt_return-number = '000'.
    s_rec = s_rec + 1.
    format color col_positive inverse on.
    msg = 'SUCCESS'.
    condense msg.
    write: / msg .
    format color col_positive inverse off.
    write :/ salesdocument, 'Has been created'.
    perform commit_mm.
    endif.
    clear: gt_return[], msg.
    endat.
    endloop.
    endform. " SLALE_UPLOAD_DATA
    *& Form COMMIT_MM
    text
    --> p1 text
    <-- p2 text
    form commit_mm .
    call function 'BAPI_TRANSACTION_COMMIT'
    exporting
    wait = 'X'
    importing
    return = gt_return1.
    clear: gt_order_items_inhttp://].\"GT_ORDER_CONDITIONS_IN[.
    endform. " COMMIT_MM
    inthis pass re_doc field in header...

  • BAPI Sales order create with reference

    Hi
    I need to use BAPI to create sales order with reference to Quantity Contract. The line item material quantity would be less than or equal to quantity contract quantity.
    Sales order needs to be created with new quantity.
    Quantity contract quantity change needs to be maintained.
    Document flow needs to be maintained.
    Is any one aware if this is possible using BAPI_SALESORDER_CREATEFROMDAT2. If yes, how?
    Any insights would be highly appreciated.

    Hi Maninder,
    The BAPI does not allow the Pricing Conditions to be sourced from the Contract. I debugged the BAPI and it uses a piece of code (don't recall which subroutine though) from SAPMV45A which is relevant for dialog processing where it reads from the VBAP and *VBAP structures. Well this structure is only populated when you are using the Front End transaction (VA41, VA42, etc). Because this structure is empty, pricing conditions do not flow across.
    Here is a little prototype program I whipped up to test my method of creating a Sales order and then changing the Sales Order:
    REPORT  ypat_salesorder_create LINE-SIZE 256.
    * This program will create a ZOC Sales Order with Reference to Contract
    * 20000720 / 10. This will be done via BAPI. There are 2 BAPi calls,
    * BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_SALESORDER_CHANGE. We need to
    * perform 2 BAPI calls as the BAPI to create the Sales Order does not
    * bring across the Pricing Conditions properly. To get around this we
    * create the Order with reference to the Contract, then we get the
    * related Pricing Conditions from the COntract and then update the newly
    * created Order.
    * Constants
    CONSTANTS: c_contract  LIKE vbak-vbeln VALUE '0020000720',
               c_item      LIKE vbap-posnr VALUE '000010'.
    * Structures
    * Structure to hold BAPI Header
    DATA: st_bapisdhd1   LIKE bapisdhd1.
    * Internal Tables
    * Sales Order Create BAPI Return Messages
    DATA: tbl_return     TYPE STANDARD TABLE OF bapiret2
                         WITH HEADER LINE.
    * Sales Order BAPI Line Item
    DATA: tbl_bapisditm  TYPE STANDARD TABLE OF bapisditm
                         WITH HEADER LINE.
    * Sales Order BAPI Line Item
    DATA: tbl_bapisditmx  TYPE STANDARD TABLE OF bapisditmx
                         WITH HEADER LINE.
    * Sales Order BAPI Pricing Conditions
    DATA: tbl_bapicond   TYPE STANDARD TABLE OF bapicond
                         WITH HEADER LINE.
    * Sales Order BAPI Partner Functions
    DATA: tbl_bapiparnr  TYPE STANDARD TABLE OF bapiparnr
                         WITH HEADER LINE.
    * Sales Order BAPI Schedule Lines
    DATA: tbl_bapischdl  TYPE STANDARD TABLE OF bapischdl
                         WITH HEADER LINE.
    * Sales Order BAPI Schedule Lines
    DATA: tbl_bapischdlx TYPE STANDARD TABLE OF bapischdlx
                         WITH HEADER LINE.
    * Sales Order BAPI Pricing Conditions
    DATA: tbl_bapicondx    TYPE STANDARD TABLE OF bapicondx
                           WITH HEADER LINE.
    * Customer Enhancement for VBAK, VBAP, VBEP
    DATA: tbl_bapiparex    TYPE STANDARD TABLE OF bapiparex
                           WITH HEADER LINE.
    * Table to hold BAPI Detail Conditions
    DATA: tbl_bapisdcond   TYPE STANDARD TABLE OF bapisdcond
                           WITH HEADER LINE.
    * Table to hold Return Messages from Sales Order Change BAPI
    DATA: tbl_return_chg  TYPE STANDARD TABLE OF bapiret2
                          WITH HEADER LINE.
    * Variables
    DATA: g_vbeln_created   LIKE vbak-vbeln,
          g_valid_contract  TYPE c,
          g_cont_price_date TYPE d.
    * Start of Selection
    START-OF-SELECTION.
      PERFORM validate_contract.
      PERFORM create_sales_ord.
      PERFORM update_sales_ord.
    * End of Selection
    END-OF-SELECTION.
      PERFORM write_output_report.
    * Subroutines
    *&      Form  create_sales_ord
    *       Create the Sales Order
    FORM create_sales_ord .
      PERFORM populate_bapi_tables.
      PERFORM call_create_sales_ord_bapi.
    ENDFORM.                    " create_sales_ord
    *&      Form  populate_bapi_tables
    *       Fill up the BAPI Tables
    FORM populate_bapi_tables .
      PERFORM populate_bapi_header.
      PERFORM build_bapi_partners.
      PERFORM build_bapi_items.
      PERFORM build_bapi_sched_lines.
    ENDFORM.                    " populate_bapi_tables
    *&      Form  populate_bapi_header
    *       Build BAPI Header Details
    FORM populate_bapi_header .
      CLEAR st_bapisdhd1.
      st_bapisdhd1-doc_type     = 'ZOC'.         "Order type
      st_bapisdhd1-sales_org    = '026'.         "Sales Org
      st_bapisdhd1-distr_chan   = '00'.          "Dist Channel
      st_bapisdhd1-division     = '00'.          "Division
      st_bapisdhd1-purch_no_c   = 'Cust Po No'.  "Cust PO No
      st_bapisdhd1-name         = 'Orderer'.     "Name of Orderer
      st_bapisdhd1-ord_reason   = ''.            "Order Reason
      st_bapisdhd1-sales_off    = '3001'.        "Sales Office
      st_bapisdhd1-sales_grp    = '301'.         "Market Area
      IF g_valid_contract = 'X'.
        st_bapisdhd1-price_date = g_cont_price_date.
      ENDIF.
    ENDFORM.                    " populate_bapi_header
    *&      Form  build_bapi_partners
    *       Build BAPI Partner Functions
    FORM build_bapi_partners .
      CLEAR tbl_bapiparnr.
      tbl_bapiparnr-partn_role   = 'AG'.
      tbl_bapiparnr-partn_numb   = '0000100750'.
      APPEND tbl_bapiparnr.
      CLEAR tbl_bapiparnr.
      tbl_bapiparnr-partn_role   = 'WE'.
      tbl_bapiparnr-partn_numb   = '0000504472'.
      APPEND tbl_bapiparnr.
    ENDFORM.                    " build_bapi_partners
    *&      Form  build_bapi_items
    *       Build The BAPI Line Items
    FORM build_bapi_items .
      DATA: l_matnr LIKE mara-matnr.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = '10000072'
        IMPORTING
          output = l_matnr.
      CLEAR tbl_bapisditm.
      tbl_bapisditm-itm_number  = c_item.
      IF g_valid_contract = 'X'.
        tbl_bapisditm-ref_doc     = c_contract.
        tbl_bapisditm-ref_doc_it  = c_item.
        tbl_bapisditm-ref_doc_ca  = 'G'.       "Contract
      ENDIF.
      tbl_bapisditm-material    = l_matnr.
      tbl_bapisditm-plant       = '3012'.
      tbl_bapisditm-target_qty  = '5.000'.
      tbl_bapisditm-target_qu   = 'M3'.
      tbl_bapisditm-item_categ  = 'ZZOC'.
      tbl_bapisditm-sales_dist  = '301'.
      tbl_bapisditm-dlv_prio    = '02'.
      tbl_bapisditm-prc_group5  = '080'.
      tbl_bapisditm-cust_mat35  = 'kdmat'.
      tbl_bapisditm-route       = 'TESYS'.
      tbl_bapisditm-usage_ind   = 'CIV'.
      APPEND tbl_bapisditm.
      CLEAR tbl_bapisditmx.
      tbl_bapisditmx-itm_number = c_item.
      tbl_bapisditmx-ref_doc    = 'X'.
      tbl_bapisditmx-ref_doc_it = 'X'.
      tbl_bapisditmx-ref_doc_ca = 'X'.
      tbl_bapisditmx-material   = 'X'.
      tbl_bapisditmx-updateflag = 'I'.
      tbl_bapisditmx-plant      = 'X'.
      tbl_bapisditmx-target_qty = 'X'.
      tbl_bapisditmx-target_qu  = 'X'.
      tbl_bapisditmx-item_categ = 'X'.
      tbl_bapisditmx-sales_dist = 'X'.
      tbl_bapisditmx-dlv_prio   = 'X'.
      tbl_bapisditmx-prc_group5 = 'X'.
      tbl_bapisditmx-cust_mat35 = 'X'.
      tbl_bapisditmx-usage_ind  = 'X'.
      tbl_bapisditmx-route      = 'X'.
      APPEND tbl_bapisditmx.
    ENDFORM.                    " build_bapi_items
    *&      Form  build_bapi_sched_lines
    *       Build the BAPI Schedule Lines
    FORM build_bapi_sched_lines .
      CLEAR tbl_bapischdl.
      tbl_bapischdl-itm_number  = c_item.
      tbl_bapischdl-req_qty     = '1'.
      tbl_bapischdl-req_date    = sy-datum.
      APPEND tbl_bapischdl.
    ENDFORM.                    " build_bapi_sched_lines
    *&      Form  build_bapi_conditions
    *       Pull the BAPI Pricing Conditions from the Contract
    FORM build_bapi_conditions .
      LOOP AT tbl_bapisdcond.
        CLEAR tbl_bapicond.
        MOVE-CORRESPONDING tbl_bapisdcond TO tbl_bapicond.
        APPEND tbl_bapicond.
        CLEAR tbl_bapicondx.
        tbl_bapicondx-itm_number = tbl_bapicond-itm_number.
        tbl_bapicondx-cond_st_no = tbl_bapicond-cond_st_no.
        tbl_bapicondx-cond_count = tbl_bapicond-cond_count.
        tbl_bapicondx-cond_type  = tbl_bapicond-cond_type.
        tbl_bapicondx-updateflag = 'I'.
        tbl_bapicondx-cond_value = 'X'.
        tbl_bapicondx-currency   = 'X'.
        tbl_bapicondx-cond_unit  = 'X'.
        tbl_bapicondx-cond_p_unt = 'X'.
        tbl_bapicondx-varcond    = tbl_bapicond-varcond.
        APPEND tbl_bapicondx.
      ENDLOOP.
    ENDFORM.                    " build_bapi_conditions
    *&      Form  call_create_sales_ord_bapi
    *       Call the Sales Order Create BAPI
    FORM call_create_sales_ord_bapi .
      CLEAR g_vbeln_created.
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
          order_header_in    = st_bapisdhd1
        IMPORTING
          salesdocument      = g_vbeln_created
        TABLES
          return             = tbl_return
          order_items_in     = tbl_bapisditm
          order_items_inx    = tbl_bapisditmx
          order_partners     = tbl_bapiparnr
          order_schedules_in = tbl_bapischdl.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDFORM.                    " call_create_sales_ord_bapi
    *&      Form  update_sales_ord
    *       Update the newly created Sales Order with the Pricing Conditions
    *       from the Contract
    FORM update_sales_ord .
      CHECK g_valid_contract EQ 'X'.
      PERFORM get_contract_details.
      PERFORM build_bapi_conditions.
      PERFORM call_change_sales_ord_bapi.
    ENDFORM.                    " update_sales_ord
    *&      Form  get_contract_details
    *       Get Contract Details
    FORM get_contract_details .
    * Need to manually get the relevant Pricing Conditions as the BAPI
    * BAPISDORDER_GETDETAILEDLIST causes problems when we call the BAPI
    * BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_SALESORDER_CHANGE (I think
    * this is due to the fact that these BAPIs belong to the same Function
    * Group and there must be some common structures that are not cleared
    * causing us all sorts of grief when we try and call the next BAPI)
      DATA: tbl_konv TYPE STANDARD TABLE OF konv WITH HEADER LINE.
      DATA: tbl_komv TYPE STANDARD TABLE OF komv WITH HEADER LINE.
      DATA: tbl_vbak TYPE STANDARD TABLE OF vbak WITH HEADER LINE.
    * Pricing Condition Master
      DATA: BEGIN OF tbl_t685a OCCURS 0,
              kschl     LIKE t685a-kschl,
              kaend_wrt LIKE t685a-kaend_wrt,
            END OF tbl_t685a.
      SELECT *
             INTO TABLE tbl_vbak
             FROM vbak
             WHERE vbeln = c_contract.
      READ TABLE tbl_vbak INDEX 1.
      SELECT *
             INTO TABLE tbl_konv
             FROM konv
             WHERE knumv = tbl_vbak-knumv AND
                   kposn = c_item.
      CHECK sy-subrc EQ 0.
    * We now need to make sure we only bring across the Condition Types that
    * are EDITABLE. If we bring across non editable conditions (such as
    * 'ZPR1') the Change Sales Order BAPI will fail
      SELECT kschl kaend_wrt
             INTO TABLE tbl_t685a
             FROM t685a
             FOR ALL ENTRIES IN tbl_konv
             WHERE kappl     EQ 'V'             AND  "Sales
                   kschl     EQ tbl_konv-kschl  AND
                   kaend_wrt EQ 'X'             AND  "Value is Editable
                   kmanu     NE 'D'.                 "Process manually
    * Prepare for Binary Search
      SORT tbl_t685a BY kschl.
      LOOP AT tbl_konv.
        READ TABLE tbl_t685a WITH KEY kschl = tbl_konv-kschl BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE-CORRESPONDING tbl_konv TO tbl_komv.
          APPEND tbl_komv.
        ENDIF.
      ENDLOOP.
      CHECK NOT tbl_komv[] IS INITIAL.
    * Map KOMV into the more BAPI friendly BAPISDCOND structure
      CALL FUNCTION 'MAP_INT_TO_EXT_STRUCTURE'
        TABLES
          fxvbak        = tbl_vbak
          fxkomv        = tbl_komv
          fxbapikomv    = tbl_bapisdcond
        EXCEPTIONS
          entry_missing = 1
          OTHERS        = 2.
    ENDFORM.                    " get_contract_details
    *&      Form  call_change_sales_ord_bapi
    *       Call the Change Sales Order BAPI
    FORM call_change_sales_ord_bapi .
      DATA: st_head_chg      LIKE bapisdh1x,
            st_logic_switch  TYPE bapisdls.
      CHECK NOT g_vbeln_created IS INITIAL.
      CHECK g_valid_contract EQ 'X'.
      st_head_chg-updateflag     = 'U'.
      st_logic_switch-cond_handl = 'X'.
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = g_vbeln_created
          order_header_inx = st_head_chg
          logic_switch     = st_logic_switch
        TABLES
          return           = tbl_return_chg
          conditions_in    = tbl_bapicond
          conditions_inx   = tbl_bapicondx.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDFORM.                    " call_change_sales_ord_bapi
    *&      Form  write_output_report
    *       Produce Output Report
    FORM write_output_report .
      IF NOT g_vbeln_created IS INITIAL.
        WRITE:/ 'Success! Sales Order', g_vbeln_created, 'was created!'.
      ELSE.
        WRITE:/ 'Failure! Sales Order was not created!'.
      ENDIF.
      SKIP.
      WRITE:/ 'Sales Order Create Log'.
      LOOP AT tbl_return.
        WRITE:/ tbl_return-type, tbl_return-id, tbl_return-number,
                tbl_return-message.
      ENDLOOP.
      SKIP.
      WRITE:/ 'Sales Order Change Log'.
      LOOP AT tbl_return_chg.
        WRITE:/ tbl_return_chg-type, tbl_return_chg-id,
                tbl_return_chg-number, tbl_return_chg-message.
      ENDLOOP.
    ENDFORM.                    " write_output_report
    *&      Form  validate_contract
    *       Make sure that the Contract is Valid
    FORM validate_contract .
      DATA: l_gueen  LIKE vbak-gueen,
            l_prsdt  LIKE vbkd-prsdt.
      SELECT SINGLE  vbak~gueen vbkd~prsdt
             INTO (l_gueen, l_prsdt)
             FROM vbak
             INNER JOIN vbkd
             ON vbak~vbeln = vbkd~vbeln
             WHERE vbak~vbeln = c_contract AND
                   vbkd~posnr = '000000'.
      IF sy-datum LE l_gueen.
    * Contract is valid! Set Order Price Date
        g_valid_contract  = 'X'.
        g_cont_price_date = l_prsdt.
      ENDIF.
    ENDFORM.                    " validate_contract
    Hope this helps.
    Cheers,
    Pat.

  • Sales Order CReated with Reference

    Hi,
    I created a sales order with reference to an existing order. I created delivery based on the new order that was created with reference. HOwever, if i try to get the sales order number of my delivery, the sales order that i am getting is the sales order number that was referenced. How will I retreived the new sales order number from VBFA?
    Thanks,
    Louisse

    Hello,
             We can follow the below Procedure to get the Sales Order Number from VBFA Table.
    1. Input the Delivery in VBELN field to get VBELV (Sales Order)
        Number with VBTYP_V = 'C' (Order). 
    2. Now, if the Sales Order which is fetched is the one which is
        referenced, then Input the Sales Order Number again in the
        VBFA Table into the Field VBELV and fetch the Sales Order
        Number (New) in the VBELN Field with VBTYP_N = 'C'.
    3. You should be able to satisfy your requirement.
    Hope it was clear.
    Thanks and Regards,
    Venkat Phani Prasad Konduri

  • Sales Order Created with one SH and want to change SH before delivery

    Hi SAP Experts,
    I need your confirmation on this.
    today our Business is following a concept of Multiple SH.
    description:
    while creating a sales order the SP and SH are same.
    at the time of delivery we might have a chance to change the SH here all the addational SH will be assigned to original SP.
    so for changing SH we will go once again to VA02 and change the SH, but at the time when we created a sales order SP and SH are same and they have attracted VAT @ 14 %.
    when you are changing only SH, then if VAT is applicable then every thing is ok i can proceed by changing the SH and creating condition record and relevant taxes will trigger there in sales order first and then in billing next.
    if CST 2% is applicable for the new changed SH then its an issue to me.
    I want your valuable sugggestions experts
    balajia

    relevant taxes will trigger there in sales order first and then in billing next
    Once any subsequent document is generated for a sale order, then even if you change the SH, tax will not be redetermined in sale order, since it will become grey.  Of course, the revised tax structure will flow to your billing which is subject to your copy control in VTFL where if you maintain "G" for the field Pricing Type.
    if CST 2% is applicable for the new changed SH then its an issue to me
    The above explanation holds good for this also.
    Needless to mention, in such circumstances, I prefer to have sale orders based on SH so that such manual intervention can be avoided.
    G. Lakshmipathi

Maybe you are looking for

  • Playing a sequence of video files

    Dear all, I'm trying to use JMF to play a sequence of video files, i.e. one after the other. The program I have written creates multiple players, one for each video file. It then realizes and prefetches them all. Then the program starts the first pla

  • Oltp systems-R/3

    what is R/3? in what way it is referred to as an OLAP system while we extract data from it and load it to BW?

  • How can I give White background Color to a TreeNode?

    How can I give White background Color to a TreeNode? Class kMyTreeViewNodeWidgetBoss, kTreeNodeWidgetBoss, // IID_ICONTROLVIEW, kMyCustomTreeNodeControlViewImpl, IID_IMPSTRVSHADOWEVENTHANDLER, kTreeNodeEventHandlerImpl, IID_IEVENTHANDLER, kMPSTreeVie

  • Flash CC crashes frequently

    Every time I click certain tools (Mainly the brush), the program crashes for no reason, does anyone know how to fix this problem? All the other tools seem to work fine and don't cause it to crash

  • PhotoshopElements 11

    I've downloaded a copy of my Photoshop Elements 11 to a new PC running windows 8.1.  Its broken down into three 3 downoad files.  PhotoshopElements_11_LS15.7z PhotoshopElements_11_WWEFDJ(1) PhotoshopElements_11_WWEFDJ I unclear on how to proceed.  I