Problem in Creating Sales Order From One DB to another DB

Hello All,
I am trying to create a Sales Order in another database from the current database based on the Purchase Order but while creating the sales order system is throwing an error " In "To Whse" enter valid values [ZAPp 0] "
My Code for Creating Sales Order in another DB are as follows :-
             '==== Connect To another SAP Company ====='
            '=====================================
            Dim oCompany_DB As New SAPbobsCOM.Company
            oCompany_DB.Server = "OSL_SERVER"
            oCompany_DB.LicenseServer = "OSL_SERVER"
            oCompany_DB.UseTrusted = False
            oCompany_DB.CompanyDB = Database_Name
            oCompany_DB.UserName = SAPUserName
            oCompany_DB.Password = SAPPassword
            oCompany_DB.DbUserName = DBUserName
            oCompany_DB.DbPassword = DBPassword
            oCompany_DB.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005
            lRetCode = oCompany_DB.Connect()
            If lRetCode <> 0 Then
                oCompany_DB.GetLastError(lErrCode, sErrMsg)
                If (lErrCode <> -4006) Then
                    Class_InterCmp_Main.SBO_Application.MessageBox(sErrMsg)
                End If
            End If
'===== Creating the Sales Order ====='
'================================
  Dim oOrder As SAPbobsCOM.Documents = oCompany_DB.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
            Dim DocDueDate As String = oRecord.Fields.Item("DocDueDate").Value
            oOrder.DocDueDate = DocDueDate
            oOrder.CardCode = Customer
  While Not oRecord.EoF
                Dim ItemCode As String = oRecord.Fields.Item("ItemCode").Value
                Dim WhsCode As String = oRecord.Fields.Item("WhsCode").Value
                Dim Quantity As Double = oRecord.Fields.Item("Quantity").Value
                Dim Price As Double = oRecord.Fields.Item("Price").Value
                Dim Discnt As Double = oRecord.Fields.Item("DiscPrcnt").Value
                Dim TaxCode As String = oRecord.Fields.Item("TaxCode").Value
                oOrder.Lines.ItemCode = ItemCode
                oOrder.Lines.WarehouseCode = WhsCode
                oOrder.Lines.Quantity = Quantity
                oOrder.Lines.Price = Price
                oOrder.Lines.DiscountPercent = Discnt
                oOrder.Lines.TaxCode = TaxCode
                oOrder.Lines.Add()
                oRecord.MoveNext()
            End While
            lRetCode = oOrder.Add
            '=== Check For Error if any ===='
            If lRetCode <> 0 Then
                oCompany_DB.GetLastError(lErrCode, sErrMsg)
                If (lErrCode <> -4006) Then
                    Class_InterCmp_Main.SBO_Application.MessageBox(sErrMsg)
                End If
            End If
            oCompany_DB.Disconnect()
When i execute the above code company gets connected but sales order not getting added in another company.
Thanks,
Amit

You can not do it the alternate way Kevin suggests, direct DB inserts are prohibited by SAP and can corrupt your DB, particularly because unlike what most people think, all SAP documents affect more than just their own tables (e.g. the numbering table, the history tables).
Are you getting any error message, or is it returning 0?
If it is returning 0, then check is the document actually going to the newly created database or maybe somehow going to old one.
If it isn't returning 0, what is the error code and message.
Edit:
Also I do see an error in your code. As it stands, you are adding an empty line to the end of every order. This can cause problems for SAP.
Dim counter As Integer = 0
If counter <> 0 Then 'Not equals 0, forum hides lt & gt symbols.
oOrder.Lines.Add()
End If
counter = counter + 1
oOrder.Lines.ItemCode = ItemCode
oOrder.Lines.WarehouseCode = WhsCode
oOrder.Lines.Quantity = Quantity
oOrder.Lines.Price = Price
oOrder.Lines.DiscountPercent = Discnt
oOrder.Lines.TaxCode = TaxCode
Edited by: njmog1 on May 9, 2011 10:14 AM

Similar Messages

  • Transfer of sales orders from one plant to another

    Dear all,
    My requirement is as follows:
    I have created some 500 sales orders (open) in one sales org+plant.
    Now due to plant shifting to other area, I want to transfer all the above open sales orders to another sales org+plant.
    One option is to create them manually. But that is time consuming and prone to errors.
    Second option is to upload thru LSMW. That too is very tedious.
    Third option is to extend/assign new plant to the old sales area and change the plant in the orders. But I want in the new sales org + new plant.
    Is there any other option by which I can transfer the above sales orders from one plant to another?
    Regards
    SAPshed

    Hi SAPshed,
    The problem is not the change of plant, which is standard functionality, but the change of sales organization.
    An awful lot of information depends on the Sales Organization: Company code (!!), customers, materials, prices, profit center, etc.
    SAP does not even admit creating a sales order in a Sales Organization A with reference to a sales order with a sales organization B.
    IMHO your best option is to try to maintain the current Sales Orders with the current Sales Organization and change the Sales Order in VA02 (your third option).
    If you are absolutely sure that all materials and customers are created for the new Sales Area in the same way and that prices (discounts) are the same, you might want to do a direct update to VBAK table to change the Sales Organization (nasty!), but be prepared for the consequences (no SAP support in case of problems, you are on your own).
    Therefore if you insist on a different Sales Organization, then option 2) will be your best best.
    Best Regards,
    Franck
    P.S. IMHO it is Best Practice to have a unique Sales Organization / Company Code.

  • Sales orders from one salesorg. to another in same ssystem

    Hi Guys,
               I got a requirement like we need to convert or recreate sales orders from one sales organization to another sales organization in the same system without having any impact on the existing system.
    Any one have idea how to do it and is there any standard program to do this? is there any standard procedure for that>?
    Thanks in advance.
    Ram sri

    Hi Ramgopal,
    I never had this scenario, but the main step would be
    Define 2 logical systems: a sender and a receiver
    Assign one of them to the client
    Set up distribution model
    Generate partner profiles
    Set up converter (not filter!) /Application Link Enabling (ALE)-> Modelling and Implementing Business Processes-> Converting Data Between Sender and Receiver
    Here you can set up conversion rule for your sales org field.
    All of this step could be done in transaction SALE.
    Regards,
    Peter

  • How to Add Sales order from one database to another database

    Hi All,
    I am trying to add sales order with sales order object.
    I have completed connectivity from one database to another database.
    but i am unable to post sales order with orders object.
    My code is
    ObjSales = objMain.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
                ObjSales.DocDate = Date.Parse(System.DateTime.Now().ToString("d"))
                ObjSales.DocDueDate = Date.Parse(System.DateTime.Now().ToString("d"))
                ObjSales.TaxDate = Date.Parse(System.DateTime.Now().ToString("d"))
                ObjSales.CardCode = "C0006"
               ObjSales.Series = 92
                ObjSales.PaymentGroupCode = 3
                ObjSales.Comments = "vivek"
               ObjSales.Lines.Add()
               ObjSales.Lines.SetCurrentLine(1)
               ObjSales.Lines.ItemCode = "5127"
               ObjSales.Lines.Quantity = 100
               ObjSales.Lines.UnitPrice = 10
               ObjSales.Lines.WarehouseCode = "01"
                ObjSales.Lines.TaxCode = "0"
                ObjSales.Lines.DiscountPercent = "0.00"
                ObjSales.DocTotal = 1000
                 If ObjSales.Add <> 0 Then
                   objMain.objApplication.SetStatusBarMessage("Sales or Not Posted", SAPbouiCOM.BoMessageTime.bmt_Short, True)
                   Exit Sub
                else
                  objMain.objUtilities.ShowSuccessMessage("Sales Order Posted successfully")
                End If
    The above code is executing successfully.But the Sales order is not getting added.
    Thanks in advance.

    Hi Vivek,
    If the code you posted is not throwing any errors, then the order really does get created. Apparently just not to both databases, am I correct ?
    vivek.Y wrote:
    > I have completed connectivity from one database to another database.
    That means that apparently you have not gotten this bit right.
    Generally speaking if you want to create an order into two databases, you first need to connect to both databases and create separate order objects for each database. So you need to do this bit twice; once for each database. Something like this:
    ObjSales1 = objMain.objUtilities1.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
    ObjSales2 = objMain.objUtilities2.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
    Then at the end you also need to add both objects separately:
    If ObjSales1.Add <> 0 Then
    etc.
    If ObjSales2.Add <> 0 Then
    etc
    Good luck,
    Johan

  • Sales Order from one SAP to another SAP system thru ALE

    I am trying to send a Sales order IDOC from one SAP system to another SAP system (basically from DEV to QAS). Will i be able to do this using ALE ? If so, how ? I don't want this Sales order to be posted as PO in QAS. I want it to stay as a sales order.

    hi,
    use BAPI SALESORDERCREATE
    ~linganna

  • Create Sales order from Internal Purchase Order using IDOC

    Hello Friends,
    I have requirement to create Sales Order from Internal Purchase Order Using IDOC.
    Backgorund, we have already configured IDOC orders05 to create Sales Order from external Purchase order from Inbound IDOC, and it is working fine.
    Now we have new requirement to create Sales Order from our own Purchase order, i.e. When PO is created in one plant corresponidng sales order automatically must needs to create in another Plant with respect PO.
    I m trying to design a solution for above problem as follows,
    1.create an Inbound Idoc from PO, by creatiing one new message type on PO save.
    2.Process that Inbound  IDOC same as it is from external PO.
    3.Once processed Sales order will create.
    Please help me in step 1. to create Inbound IDOC from PO.
    If you want any further clarification please write me.
    Thanks,
    Mahesh

    I had done a similar scenario before and we achieved it through SAP XI. The problem is with the control record. When we create a ORDERS IDOC from a PO the control record will be for outbound transmission. We sent the file to XI and XI resent it back with some data parsing and a new inbound control record. This way it went neat outbound and inbound.
    I'm not sure what kind of architecture you have. If you have to do it within your ECC/R/3, then you could create the outbound IDOC to a new port and write a fresh RFC to pick it up from the same folder and create a new control record for inbound processing.
    I haven't tried this; but there is a "processing w. trigger (inbound)" option on the outbound process code. May be you can explore into that a bit more.
    I'm sure there could be better approaches to handle this within ECC so if you stumble on any, do write back. I would like to know to update my knowledge .

  • Transfer sales orders from one compnay code to another

    Hi
    Is it possible to transfer pending sales order from one company code to another? if yes please let me know complete procedure.
    thanks
    Sanjay

    Hi,
    You cannot transfer the sales order like this.If your company is getting closed then you can keep a deadline date before which you can close all the open orders and after that you can start creating the orders in the new company code.
    If your delivery date is beyond the deadline date then you can reject the sales orders and create them with new G/L accounts from the new company code.
    For this,you have to assign your sales organisation to the new company code.
    Reward points if it helps.
    Regards
    Karan

  • BAPI:Create sales order from an existing open sales order for open items

    Dear All,
    Could any one suggest me any BAPI that can create sales order from an existing OPEN sales order for OPEN items. since we are closing all open orders and creating new orders with reference to existing open orders.   please suggest, its would be great help.
    Regards,
    Reddy

    hi suresh,
    we are changing tax procedure from formula to condition based, so this is the reason we have close all the open orders and recreate in TAXINN procedure, it is going to be large number of records( open orders), so....
    Regards,
    Reddy

  • Create sales order from multiple quotation

    Hi All,
    How we can create sales order from multiple quotation what is transaction code for this.
    Ahmed

    Hi Ahmed,
    There are two options.
    1. For creating Sales Order with ref to too many Quotations:
    Go to T. Code VA26 and enter the Doc Date or Quotation Valid to Date and Sold to party, Quotation Type to get all the outstanding Quotations for that particular Sold to Party. Then Select the required quotations and then select Follow-up actions button to create Single Sales Order.
    2. For less number of Quotations:
    You can simply go by referring each quotation by placing the cursor in alternate line item in sales order by selecting "Create with ref" button.
    Hope this will solve your problem.
    Ravi.

  • Problem while creating sales order using BAPI

    Hi all,
    i am creating a sales order from the purchase order data.
    when my client will send a PO in EDI format, my 3rd party edi tool will convert that edi formatted PO to text format. then i will upload that text formatted PO to my program then i will create a SO from those uploaded PO data using BAPI BAPI_SALESORDER_CREATEFROMDAT2.
      but,no sales order is being created.& also i am not getting any return message.by debugging also, i am not getting the error.plz suggest where i am doing mistake.below is the coding.
    DATA:
      gfilename LIKE rlgrap-filename.
    *--Internal tables
    DATA: BEGIN OF i_item OCCURS 50.    "Create Material Document Item
            INCLUDE STRUCTURE BAPISDITM .
    DATA: END OF i_item .
    DATA: BEGIN OF i_partner OCCURS 20.  "Return parameter
            INCLUDE STRUCTURE BAPIPARNR.
    DATA: END OF i_partner.
    DATA: BEGIN OF i_schedule OCCURS 20.  "Return parameter
            INCLUDE STRUCTURE BAPISCHDL .
    DATA: END OF i_schedule.
    DATA: BEGIN OF i_cond OCCURS 20.  "Return parameter
            INCLUDE STRUCTURE BAPICOND .
    DATA: END OF i_cond.
    DATA: BEGIN OF i_part OCCURS 0,     " Internal table for split data
            part(20),
          END OF i_part.
    DATA: BEGIN OF i_return OCCURS 20.  "Return parameter
            INCLUDE STRUCTURE bapiret2.
    DATA: END OF i_return.
    *-- Work areas
    DATA: BEGIN OF wa_header .       "sales Document Header Data
            INCLUDE STRUCTURE BAPISDHD1.
    DATA: END OF wa_header .
    *DATA: BEGIN OF wa_return .       "Output Structure
           INCLUDE STRUCTURE BAPIRET2.
    *DATA: END OF wa_return .
    DATA: begin of sorder.
         INCLUDE STRUCTURE BAPIVBELN.
    DATA: end of sorder.
    data:begin of t_upload,
         ebeln(10),  "PO no(seagate)
         aedat like sy-datum , "PO date
         bsart(4) , "PO type
         vdatu like sy-datum , "requested delivery date
         kunnr(10) , "customer no-sold-to-party
        kunak like vbak-kunnr, "bill-to-party
         name1_s(20), "name1 of sold-to-party
         name2_s(15), "name2 of sold-to-party
         land1_s(3), "country
         ort01_s(10),  "city
         regio_s(3), "region(state/province)
         pstlz_s(10), "postal code
         adrnr_s(10), "address
         bstkd_e(10), "end customer purchase order
         posex(6),     "end customer PO line no(item no)
         kdmat(18),     "end customer material no(part no)
         kunag(10),     "ship-to-party
         name1_c(20),   "name1 of ship-to-party
         name2_c(15),   "name2 of ship-to-party
         land1_c(3),   "country
         ort01_c(10),    "city
         regio_c(3),   "region(state/province)
         pstlz_c(10),   "postal code
         adrnr_c(10),   "address
         posnr(6), "item no(seagate PO line no)
         pstyv(4), "item category
         matnr(18), "material no(seagate 9 digit part no)
         zmeng(13), "Target quantity in sales unit
        vrkme like vbap-vrkme, "sales unit
         meins(3), "UOM
        posnr_tot like vbap-posnr,"Total no. of line items
         werks(4), "plant
        vstel like vbap-vstel, "shipping point
         empst(10), "receiving point
         shtyp(4), "shipment type
         route(6), "route
         vsbed(2), "shipping conds
        rkfkf like vbap-rkfkf, "method of billing for co/ppc orders
         zterm(4), "terms of payment key
         inco1(3), "F.O.B inco term1
         inco2(3), "F.O.B inco term2
         end of t_upload.
    Data: wa_upload like t_upload,
           i_upload like standard table of t_upload.
    Data:v_kunnr like kna1-kunnr,
          v_posnr like vbap-posnr,
          v_matnr like vbap-matnr,
          v_zmeng like vbap-zmeng,
          v_kunag like kna1-kunnr.
    *---Constants
    CONSTANTS: c_comma TYPE c VALUE ',',   " For splitting data at commas
               c_01(2) TYPE c VALUE '01',  " For movement code in Bapi
               c_b     TYPE c VALUE 'B',   " For mvt. Indicator in Bapi
               c_creat(5) TYPE c VALUE 'CREAT', " For button text
               c_clear(5) TYPE c VALUE 'CLEAR', " For clear button
               c_mvmt(4) TYPE c VALUE 'MVMT',
               c_ok(2)   TYPE c VALUE 'OK',
               c_error(5) TYPE c VALUE 'Error'.
    *--SELECTION SCREEN DESIGN--
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
    PARAMETERS:     
                p_auart LIKE vbak-auart, " order type
                p_vkorg LIKE vbak-vkorg, " sales org
                p_vtweg LIKE vbak-vtweg, " dist channel
                p_spart LIKE vbak-spart, " division
                p_vkgrp LIKE vbak-vkgrp, " sales group
                p_vkbur LIKE vbak-vkbur, "sales office
                p_file(256) default 'c:/saleorder.txt'.         "File name
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN PUSHBUTTON 15(10) v_create USER-COMMAND creat.
    SELECTION-SCREEN PUSHBUTTON 40(10) v_clear USER-COMMAND clear.
      INITIALIZATION -
    INITIALIZATION.
      v_create = c_creat .
      v_clear = c_clear.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    PERFORM selectfile USING p_file.
    *--AT SELECTION_SCREEN--
    AT SELECTION-SCREEN .
      IF sy-ucomm = c_clear.
        PERFORM f_clear.
    ELSE.
       IF sy-ucomm <> c_mvmt.
    **--- Validating the input data.
         PERFORM f_check_inputs.
        ELSEif sy-ucomm = c_creat.
    *--- Validating the input data.
          PERFORM f_check_inputs.
    *-- Uploading the PO data.
          PERFORM f_PO_upload.
    *---checking the PO data
         PERFORM f_check_upload_data.
    *---create sales order from PO data
        PERFORM f_Sales_order_create.
        ENDIF.
    FORM f_PO_upload.
    gfilename = p_file.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                filename                = gfilename
                filetype                = 'DAT'
           TABLES
                data_tab                = i_upload
           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
                OTHERS                  = 10.
      IF sy-subrc <> 0.
        MESSAGE i398(00) WITH '(WS_UPLOAD)'
        ' Errors occured with exception '
         sy-subrc.
      ENDIF.
    ENDFORM.                    " f_PO_upload
    *&      Form  selectfile
          text
         -->P_P_FILE  text
    FORM selectfile CHANGING value(filename) TYPE c.
    CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                def_filename     = gfilename
                def_path         = 'C:\'
                mask             = ',*.txt.'
                mode             = 'O'
                title            = 'Select File Name'
           IMPORTING
                filename         = filename
           EXCEPTIONS
                inv_winsys       = 1
                no_batch         = 2
                selection_cancel = 3
                selection_error  = 4
                OTHERS           = 5.
    ENDFORM.                    " selectfile
    FORM f_Sales_order_create.
      PERFORM f_fill_header.
      PERFORM f_fill_partner.
      PERFORM f_fill_item.
      PERFORM f_call_BAPI.
    ENDFORM.                    " f_Sales_order_create
    *&      Form  f_fill_header
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_header.
    move p_auart to wa_header-doc_type.
    move p_vkorg to wa_header-sales_org.
    move p_vtweg to wa_header-distr_chan.
    move p_spart to wa_header-division.
    move p_vkgrp to wa_header-sales_grp.
    move p_vkbur to wa_header-sales_off.
    Read table i_upload into wa_upload index 1.
    move wa_upload-ebeln to wa_header-purch_no_c.
    move wa_upload-aedat to wa_header-purch_date.
    move wa_upload-bsart to wa_header-po_method.
    move wa_upload-vdatu to wa_header-req_date_h.
    move wa_upload-bstkd_e to wa_header-purch_no_s.
    *move wa_upload-route to wa_header-route.
    move wa_upload-vsbed to wa_header-ship_cond.
    move wa_upload-empst to wa_header-rec_point.
    move wa_upload-shtyp to wa_header-ship_type.
    move wa_upload-zterm to wa_header-pmnttrms.
    move wa_upload-inco1 to wa_header-incoterms1.
    move wa_upload-inco2 to wa_header-incoterms2.
    ENDFORM.                    " f_fill_header
    *&      Form  f_fill_partner
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_partner.
    if not wa_upload-kunnr is initial.
    select single kunnr from kna1 into v_kunnr
                where kunnr = wa_upload-kunnr.
    if sy-subrc <> 0.
    Message E014 with 'customer does not exist'.
    else.
    move 'AG' to i_partner-partn_role.
    move wa_upload-kunnr to i_partner-partn_numb.
    move wa_upload-land1_s to i_partner-country.
    move wa_upload-name1_s to i_partner-name.
    move wa_upload-name2_s to i_partner-name_2.
    move wa_upload-ort01_s to i_partner-city.
    move wa_upload-regio_s to i_partner-region.
    move wa_upload-pstlz_s to i_partner-postl_code.
    move wa_upload-adrnr_s to i_partner-address.
    append i_partner.
    endif.
    endif.
    if not wa_upload-kunag is initial.
    select single kunnr from kna1 into v_kunag
                where kunnr = wa_upload-kunag.
    if sy-subrc <> 0.
    Message E015 with 'end customer does not exist'.
    else.
    move 'WE' to i_partner-partn_role.
    move wa_upload-kunag to i_partner-partn_numb.
    move wa_upload-land1_c to i_partner-country.
    move wa_upload-name1_c to i_partner-name.
    move wa_upload-name2_c to i_partner-name_2.
    move wa_upload-ort01_c to i_partner-city.
    move wa_upload-regio_c to i_partner-region.
    move wa_upload-pstlz_c to i_partner-postl_code.
    move wa_upload-adrnr_c to i_partner-address.
    append i_partner.
    endif.
    endif.
    ENDFORM.                    " f_fill_partner
    *&      Form  f_fill_item
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_item.
    loop at i_upload into wa_upload.
    if not wa_upload-matnr is initial.
    select single  maramatnr msegmenge into (v_matnr, v_zmeng) from
                       mara inner join mseg on maramatnr = msegmatnr
                       where mara~matnr = wa_upload-matnr.
    if sy-subrc <> 0.
    Message E016 with 'material no does not exist'.
    elseif v_zmeng LT wa_upload-zmeng.
    Message E017 with 'order quantity is greater than the quantity present'.
      endif.
    endif.
    move wa_upload-posnr to i_item-itm_number.
    move wa_upload-pstyv to i_item-item_categ.
    move wa_upload-matnr to i_item-material.
    move wa_upload-zmeng to i_item-target_qty.
    move wa_upload-meins to i_item-target_qu.
    move wa_upload-werks to i_item-plant.
    *move wa_upload-meins to wa_vbap-meins.
    *move wa_upload-posnr_tot to wa_vbap-posnr_tot.
    move wa_upload-posex to i_item-po_itm_no.
    move wa_upload-kdmat to i_item-cust_mat22.
    move wa_upload-inco1 to i_item-incoterms1.
    move wa_upload-inco2 to i_item-incoterms2.
    move wa_upload-zterm to i_item-pmnttrms.
    move wa_upload-empst to i_item-rec_point.
    move wa_upload-shtyp to i_item-ship_type.
    move wa_upload-route to i_item-route.
    append i_item.
    PERFORM f_fill_schedule_line.
    PERFORM f_fill_conditions.
    ENDLOOP.
    ENDFORM.                    " f_fill_item
    *&      Form  f_fill_schedule_line
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_schedule_line.
    move wa_upload-matnr to i_schedule-itm_number.
    move sy-datum to i_schedule-req_date.
    move wa_upload-zmeng to i_schedule-req_qty.
    append i_schedule.
    ENDFORM.                    " f_fill_schedule_line
    *&      Form  f_fill_conditions
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_conditions.
    move wa_upload-matnr to i_cond-itm_number.
    move sy-datum to i_cond-conpricdat.
    append i_cond.
    ENDFORM.                    " f_fill_conditions
    *&      Form  f_clear
          text
    -->  p1        text
    <--  p2        text
    FORM f_clear.
    clear:p_auart,
          p_vkorg,
          p_vtweg,
          p_spart,
          p_vkgrp,
          p_vkbur.
    ENDFORM.                    " f_clear
    *&      Form  f_call_BAPI
          text
    -->  p1        text
    <--  p2        text
    FORM f_call_BAPI.
    clear:i_item,i_partner,i_schedule.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
      SALESDOCUMENTIN               =
        ORDER_HEADER_IN               = wa_header
      ORDER_HEADER_INX              =
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
       SALESDOCUMENT                  = sorder
      TABLES
      RETURN                        =
       ORDER_ITEMS_IN                 = i_item
      ORDER_ITEMS_INX               =
        ORDER_PARTNERS                = i_partner
       ORDER_SCHEDULES_IN             = i_schedule
      ORDER_SCHEDULES_INX           =
      ORDER_CONDITIONS_IN            = i_cond.
      ORDER_CFGS_REF                =
      ORDER_CFGS_INST               =
      ORDER_CFGS_PART_OF            =
      ORDER_CFGS_VALUE              =
      ORDER_CFGS_BLOB               =
      ORDER_CFGS_VK                 =
      ORDER_CFGS_REFINST            =
      ORDER_CCARD                   =
      ORDER_TEXT                    =
      ORDER_KEYS                    =
      EXTENSIONIN                   =
      PARTNERADDRESSES              =
    if not ( sorder-vbeln is initial ).
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    write: /'Order number:', sorder.
    else.
    loop at i_return.
    write: / i_return-id, i_return-number, i_return-message(80).
    endloop.
    *write: /'Error'.
    endif.
    *loop at i_return.
    *write: / i_return-id, i_return-number, i_return-message(80).
    *endloop.
    ENDFORM.                    " f_call_BAPI

    HI
      Pricing will be carried basing on the pricing
    procedure.
    Case1: Prices will be carried out automatically if
    necessary condition records are maintained for the
    condition type.
      For this you can go to Sales Order-> Item Conditions
    In the screen you can click on command button Analysis,
    which gives you the list of condition types associated
    to the pricing procedure. By clicking on the condition
    type you can know the action that has taken place.
    Case2: Manually forcing prices for Items.
      To do this, you have to populate ORDER_CONDITIONS_IN &
    ORDER_CONDITIONS_INX. Also note to identify the item
    numbers, you manually pass the item number for each item
    in the sales order, use the same item number for
    populating conditions.
      Parameters required:
    ORDER_CONDITIONS_IN:
      ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
    ORDER_CONDITIONS_INX:
      ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
       Hope the above info helps you. Do revert back if you
    need more info.
    Kind Regards
    Eswar

  • Error determining posting period(infostructure S008,Variant Z2,RC3) while creating Sales orders from Inbound IDOCS

    Hello,
    I am getting this Error message"error determining posting period(infostructure S008,Variant Z2,RC3)" while creating Sales order from Inbound Idocs in the IDOC,which is affecting sales order creation.
    While viewing this Info structure S008, I could see no records have been maintained. Wanted to know the reasons behind this Hard error?
    Is it something related to Date Field used in the Update Rules for this Infostructure which is causing this posting period error?
    Appreciate your inputs on this.
    Thanks and Regards
    Mohammed Roshan

    Thank you Jelena,I checked the Ship. Delivery dates in the IDOC which are for Current Fiscal Year- 20140703 and 20140711,Could there be any other reason for this error?
    Could it be an issue with e Update rule in this Infostructire S008
    Secondly when we try change the update rule thru MC25 for this Infostructure S008,It gives a message"
    "Maintenance of SAP standard updates not allowed"
    Kindly advice
    Thanks and Regards
    Mohammed Roshan

  • Creating sales order from contract ISA R/3 Edition

    Hi Forum,
    Our scenario are
    1 - customer select product from catalog and place order from internet
    2 - sometimes, customer already have a contract with us (created earlier manually on SAP) and want to create sales order from internet referencing a SAP-contract.
    For scenario No.1 - we can use standard SAP
    For scenario No.2 - is there any standard way to do so? or we have to do customization?
    Any suggestion are welcome.
    Thanks a million.!!

    Hello
    "Contract Processing" is not supported out-of-the-box in ISA R/3 edition.
    However, you have a good news. The OSS Note [788245 |https://service.sap.com/sap/support/notes/788245]- "ISA R/3 4.0: contract processing", explains how to implement this feature on a project basis.
    We have implemented this feature successfully at few customers.
    Hope this helps.
    Easwar
    http://www.parxlns.com

  • Problem in creating Sales Order

    Hi All,
    We have 3 Document types ZS01,ZS02 and ZS03 for creating <b>Sales Order</b>. We have written one program to create Sales Order for document type 'ZS01'.
    Our requirement is ,we should allow to create sales order of doc.type ZS01 <b>thru that 'z' program only</b>,we should not use ZS01 type to create sales order via VA01.So, we have restricted sales order creation using 'ZS01' thr' VA01 by authorisation profile.So in my 'z' program i couldn't call VA01 to create sales order.So I tried using BAPI,it is giving me the error <b>"No maintenance authorization for document type ZS01".</b>
    Please guide or suggest me some alternative method to create sales order.
    Thanks & Regards,
    Sudipto.

    Hi Sudipto,
    There is no direct method of by passing a role, but u can try creating sales order thru  FM BAPI_SALESORDER_CREATEFROMDAT2 with reference to a SO that is already created with ZSO1, or you might call the Z report program internally from ur program to create the SO. 
    Hope that helps
    Anirban

  • A problem about create sales order with reference to contract.

    Hello,everyone,
    when I create sales order va01,there is user exit in MV45AFZB to check the vbkd-bstkd,unique and fixed  length.
    but there is no such in contract  creation va41.
    when I create a contract and copy the data to sales order ,the check code is prevent me from copying
    message error:the vbkd-bstkd check is wrong.
    how to solve the problem, if I have to use the check in sales order.

    The Simple thing may be put a check at contract stage it self, then whatever data is in contract will copy in sales order. So you wont face this problem.
    Thanks,
    Raja

  • FM to create Sales Order from reference billing document

    Hi,
    I need to create a sales order from a reference billing document. Please tell me if there is any function module/BAPI to do that.
    Thanks in advance for the help
    Regards,
    Varun

    Hi
    <b>SD_SALES_DOCUMENT_COPY</b> copy Sales Doc into new one with the required Sales Doc Type (VBAK-AUART) for further creating.
    <b>SD_SALES_DOCUMENT_SAVE</b> create Sales Doc from the copied document
    create subsequent document
    REPORT Z.
      data: w_auart like vbak-auart,  "current SalesDoc type
            w_auara like tvak-auara,  "Subsequent SalesDoc type
            w_vbak  like vbak.
      parameter p_vbeln like vbak-vbeln.
    at selection-screen on p_vbeln.
      SELECT SINGLE auart FROM vbak into w_auart
        WHERE vbeln = p_vbeln.
      if sy-subrc <> 0.
        message e398(00) with 'Sales Doc' p_vbeln 'not found'.
      endif.
    start-of-selection.
      SELECT SINGLE auara FROM tvak into w_auara
        WHERE auart = w_auart.
      if sy-subrc <> 0 or w_auara is initial.
        message e398(00) with 'Subsequent type not defined for' w_auart.
      else.
      1. copy
        CALL FUNCTION 'SD_SALES_DOCUMENT_COPY'
             EXPORTING
                  i_auarn       = w_auara
                  i_vbeln       = p_vbeln.
      2. paste
        CALL FUNCTION 'SD_SALES_DOCUMENT_SAVE'
             IMPORTING
                  evbak         = w_vbak.
      3. commit
        COMMIT WORK.
      4. report
        write: / 'Sales Doc', w_vbak-vbeln, 'created.'.
      endif.
    regards
    vinod

Maybe you are looking for

  • Safari (version 6.0.2) keeps crashing

    I would greatly appreciate anyone's help as I have grown terrribly frustrated with Safari crashing randomly on me. I have searched the forum and the internet for possible solutions and have tried some but I have not been able to solve the issue.  I a

  • Action on zoom event

    Hi I have developed a flash-RMA which shows some text. The RMA is embedded  in a pdf. I discovered that sometimes, when zooming in acrobat/reader  the text is not displayed correctly (i.e. linebreaks shift, somtimes the  last line of text drops out o

  • Flash player 10 not working on Mac

    Hi there, I am unable to use flash player on a Mac OSX 10.6.4.  I have a webcam on my laptop but for some reason flash enabled sites are unable to detect the webcam.  The message I receive is "no camera detected."  I've tried reinstalling flash playe

  • Transferring Ipad videos (home not purchased) to PC ?

    How do i upload my home videos from my ipad to my PC ( windows vista) ? When I transfer my photos from the ipad using Windows photo gallery they all show up but the videos dont or dont play. I asked in the Apple store and he said to use itunes to go

  • IN Operator in Forms

    IN operator in forms Hi, In the Forms I'm declaring a cursor and the where clause has IN operator like.. declare cursor cur is select... where name in (:global.var_temp); --:global.var_temp = 'TOM','HARRY','SANDY' begin end; :global.var_temp is list