Problem when creating a sales order using BAPI_SALESORDER_CREATEFROMDAT2

Hello All,
I am working on a requirement where i  need to create a new sales order from old sales order (Not all the items of the old sales order are to be copied) i am doing this by getting the data using BAPISDORDER_GETDETAILEDLIST to get the old sales order details and send them to BAPI_SALESORDER_CREATEFROMDAT2.
My problem is that i when i send the condition also the system in addition to the conditions sent to the BAPI is also automatically proposing the condition types . So the final result is that the sales order ends up having the condition types twice .
For example VPRS AZWR are visible twice in the sales order.
Any inputs to solve the problem will be definitely rewarded.
Thanks in advance.
Regards,
Sowmya.

Hello All,
I am working on a requirement where i  need to create a new sales order from old sales order (Not all the items of the old sales order are to be copied) i am doing this by getting the data using BAPISDORDER_GETDETAILEDLIST to get the old sales order details and send them to BAPI_SALESORDER_CREATEFROMDAT2.
My problem is that i when i send the condition also the system in addition to the conditions sent to the BAPI is also automatically proposing the condition types . So the final result is that the sales order ends up having the condition types twice .
For example VPRS AZWR are visible twice in the sales order.
Any inputs to solve the problem will be definitely rewarded.
Thanks in advance.
Regards,
Sowmya.

Similar Messages

  • Sale Order Item Quantity Not Populating When Create A Sale Order Using BAPI

    I am having a problem when creating a sale order using BAPI
    BAPI_SALESORDER_CREATEFROMDAT2
    Problem is that sale order item quantity field is not populating
    code is as follows
    ORDER_ITEMS_IN-ITM_NUMBER = '0010'.
    ORDER_ITEMS_IN-MATERIAL = '000000000010000262'.
    ORDER_ITEMS_IN-TARGET_QU = 'LB'.
    ORDER_ITEMS_IN-TARGET_QTY = 1.

    Hi,
    Try populating ORDER_SCHEDULES_IN table in the bapi field REQ_QTY.
    Regds,
    Rudra

  • Price is not being updated when creating a sales order using DTW oOrders

    Hello experts,
    When I create a sales Order using DTW (oOrders), the information in the input files document.csv and document_lines.csv is updated with no problem, except the price. The price is being ignored from the input files.
    Is there something that I must considered when trying to update the price of a sales order using the DTW?
    The field "price" was mapped in the source and target fields in DTW.
    Here is the document_lines.csv
    RecordKey,LineNum,AccountCode,Address,ItemCode,LineTotal,Price,Quantity,ShipDate,WarehouseCode,TaxCode
    RecordKey,LineNum,AccountCode,Address,ItemCode,LineTotal,Price,Quantity,ShipDate,WarehouseCode,TaxCode
    1,1,_SYS00000000059, ,30PA08-0360-25,1,11.2,3,20110702,V08,A5
    1,2,_SYS00000000059, ,30PA08-0707-25,1,15.2,3,20110702,V08,A5
    1,3,_SYS00000000059, ,30PA08-0707-22,1,18.3,3,20110702,V08,A5
    And the document.csv:
    RecordKey,DocEntry,CardCode,DocDate,DocDueDate,DocTotal
    RecordKey,DocEntry,CardCode,DocDate,DocDueDate,DocTotal
    1, ,c-6167,20110702,20110702,2
    Thank you for your help
    Jorge Manzo

    Hi,
    Try to re-create your dtw using my template,and use text tab when saving your template.
    SO-Header
    RecordKey     CardCode     CardName     Comments     DocDate     DocDueDate     DocNum
    RecordKey     CardCode     CardName     Comments     DocDate     DocDueDate     DocNum
    1     24-25 MANUFACTU     24-25 MANUFACTURING          4/5/2010     4/15/2010     11142
    SO-LINE
    RecordKey     linenum     itemcode     qty     uom      PriceAfterVAT      Price     SalesPersonCode
    RecordKey     linenum     itemcode     qty     uom      PriceAfterVAT      Price     SalesPersonCode
    1     0     SHAFT HEX 7/8"     1     pc     4536     4050     CRIS
    Note : Line -(LINE NUM and QTY is important upon computation of Price if SO is ITEM TYPE Document.
    hope this will help you!
    Regards,
    Darius

  • Problem when creating a sales order with reference by BAPI

    I am facing one problem when creating Sales Order.
    <b>The scenario is like this while creating SO With reference to an Order type, a new SO will be automatically created with a diff order Type</b>.
    I am using "BAPI_SALESORDER_CREATEFROMDAT2".
    I am calling this BAPI in USEREXIT_REFRESH_DOCUMENT.
    Am I using the right exit to call this Bapi ?
    <b>Problems are like :
    1. Ref Sales Order creating without Sales Unit .
    2. "Object Status does not exist" error msg is coming for Header and Item level(when clicking the status tab and then object status pushbutton).</b> But if testing the bapi from SE37 in test sequence....no such problem persists.
    As for example in case of sales unit,in the debugging mode i have seen that BAPI uses a perform to fill the values in the VBAP structure.But after that when it come back to the main program VBAP remains blank.This ocuurs when the BAPI is called from the exit whereas  if tested from SE37, VBAP retains the value.
    Can u suggest in this ? This is very very urgent............
    Thx in Adv.........................

    Thanks........
    Your suggestion was a great help to me.I have used a custom FM and called it in <b>starting new task</b>.
    Since i am a university fresher working in SAP for nearly 1 year.....can you please explain me the difference between <b>in update task</b> and <b>starting new task</b>.Why the problem was occuring for which you have suggested to call a custom function module.
    what is V1 update and V2 update?Is it attached with asynchronous ans synchronous update.It would be a great help to me if you kindly clear my confusions....
    thanks in advance.

  • Is it possible to use variant configuration (with a Non-SAP solution) when creating ERP sales orders in SAP CRM WebUI

    Hello,
    our customer plans to use a Non-SAP solution for variant configuration (Camos) in SAP ERP (ECC 6.0) and in SAP CRM 7.0 EHP1 as well.
    ERP sales orders (and ERP quotations) should be created in SAP CRM (CRM WebUI).
    Is it possible to use variant configuration (with an external variant configuration tool) when creating ERP sales orders and quotations in the SAP CRM WebUI or do we have to implement SAP IPC for this?
    Thanks in advance.
    Regards,
    AEV

    Dear AEV,
    I think LORD (lean orders) should work with variant configuration as well. In the note 1236015 there is not restriction listed. However you need lord2 activated in ECC, and ECC system should be on EHP4.
    Best regards
    Rene

  • Quantity update into sales order using BAPI_SALESORDER_CREATEFROMDAT2

    Hi All,
    I am able to create a sales order using the BAPI "BAPI_SALESORDER_CREATEFROMDAT2".
    But even after assinging the Target_quntity and the Target_quantity_units, the values are not getting updated into the Sales order, but the sales order gets created .
    Did anyone of you had a similare problem, how was it solved.
    cold some one please help me out on this.
    Regards

    Hi
    I had used below code (using <b>BAPI_SALESORDER_CREATEFROMDAT1</b>)..but never faced any problem.. you can try the same...
    Regards,
    Raj
    REPORT  z_sd_salesorder_create
            NO STANDARD PAGE HEADING
            LINE-SIZE 150
            MESSAGE-ID zz.
                  S T R U C T U R E  D E C L A R A T I O N S             *
    TYPES: BEGIN OF x_ppl,
            ppl_order(18),   " ppl Orderno
            auart(4),         " Sales Doc Type
            vkorg(4),         " Sales Organization
            vtweg(2),         " Distribution Channel
            spart(2),         " Division
            div(3),           " Division
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(18),        " Item Matnr#
            uom(3),           " UOM
            qty(15),          " Qty
           kschl(4),         " Pricing condiiton type
           kbetr(11),        " Rate
           END OF x_ppl.
    TYPES: BEGIN OF x_file,
            loc(30),          " Location
            div(3),           " Division
            ppl_order(18),   " ppl Orderno
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(20),        " Item Matnr#
            qty(15),          " Qty
            uom(3),           " UOM
           kbetr(11),        " Rate
           discount(5),      " Discount
           END OF x_file.
    TYPES: BEGIN OF x_output,
            ppl_order(18),       " ppl Orderno
            mesg(130),            " Mesg Success/Error
           END OF x_output.
    TYPES: BEGIN OF x_werks,
            name2(30),                " Location
            werks TYPE werks_ext,     " Plant
           END OF x_werks.
    TYPES: BEGIN OF x_info,
            vkorg TYPE vkorg ,   " Sales org
            vtweg TYPE vtweg,    " Dist channel
            werks TYPE werks_ext," Plant
            spart TYPE spart,    " Storage Loc
           END OF x_info.
    TYPES: BEGIN OF x_material,
            ppl_prdid(20),      " ppl Prd id
            matnr TYPE matnr,    " Material (SAP)
           END OF x_material.
           I N T E R N A L    T A B L E    D E C L A R A T I O N S       *
    DATA: it_file  TYPE STANDARD TABLE OF x_file  WITH HEADER LINE." File Data
    DATA: it_data  TYPE STANDARD TABLE OF x_ppl  WITH HEADER LINE." ppl File
    DATA: it_out TYPE STANDARD TABLE OF x_output WITH HEADER LINE. " Outcome
    DATA: it_werks TYPE STANDARD TABLE OF x_werks WITH HEADER LINE.    " Plant
    DATA: it_info TYPE STANDARD TABLE OF x_info WITH HEADER LINE.      " Othr Info
    DATA: it_matnr TYPE STANDARD TABLE OF x_material WITH HEADER LINE. " Material Info
    DATA: it_item TYPE STANDARD TABLE OF bapiitemin WITH HEADER LINE.  "Order Itm data
    DATA: it_partner TYPE STANDARD TABLE OF bapipartnr WITH HEADER LINE. "Order Partner data
               V A R I A B L E S      D E C L A R A T I O N S            *
    DATA  : v_correct  TYPE i,
            v_error    TYPE i,
            v_total    TYPE i,
            v_return   LIKE bapireturn1,
            v_index    LIKE sy-tabix.
    *- Return values
    DATA: it_orderh TYPE bapisdhead, "Order Hdr data
          order TYPE bapivbeln-vbeln,
          soldto TYPE bapisoldto,
          shipto TYPE bapishipto,
          return TYPE bapireturn1.
    DATA: hdate   TYPE sy-datum.
                    U S E R   I N P U T S   S C R E E N                  *
    SELECTION-SCREEN: BEGIN OF BLOCK blk01 WITH FRAME TITLE text-t01.
    PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY. " File name
    SELECTION-SCREEN END OF BLOCK blk01.
                      S E L E C T I O N    S C R E E N                   *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM get_file.
                    S t a r t    o f    S e l e c t i o n                *
    START-OF-SELECTION.
      PERFORM get_upload.
      PERFORM validate_data.        " Validate the data
      PERFORM data_swap.            " Prepare the data for processing
      IF NOT it_data[] IS INITIAL.
        PERFORM get_update.           " Create SalesOrders
      ELSE.
        MESSAGE i001(zz) WITH text-001.
        STOP.
      ENDIF.
                    E n d    o f    S e l e c t i o n                    *
    END-OF-SELECTION.
      IF NOT it_data[] IS INITIAL.
        PERFORM get_write.
      ENDIF.
    *&      Form  get_file
          Get File name
    FORM get_file .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          program_name  = syst-repid
          mask          = '*'
        CHANGING
          file_name     = p_file
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_file
    *&      Form  get_upload
          to upload the file
    FORM get_upload .
      DATA l_file TYPE string.
      CLEAR: it_file, it_file[].
      l_file = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = it_file
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSEIF sy-subrc = 0.
        SORT it_file BY loc ppl_order.
      ENDIF.
    ENDFORM.                    " get_upload
    *&      Form  get_update
          Creating mapping Data in Z table
    FORM get_update .
      DATA: l_itemno(2) TYPE n,
            l_partner TYPE parvw,
            l_kunnr TYPE kunnr,
            l_matnr TYPE matnr,
            l_mesg TYPE string,
            l_kbetr TYPE p DECIMALS 2.
      DATA: l_in_qty LIKE vbap-zmeng,
            l_meins LIKE mara-meins,
            l_qty   LIKE vbap-zmeng.
      CLEAR: v_correct, v_error, v_total.
      SORT it_data BY ppl_order.
      LOOP AT it_data.
        CLEAR v_index.
        v_index = sy-tabix.
    *- New SalesOrder
        AT NEW ppl_order.
          READ TABLE it_data INDEX v_index.
          CLEAR: it_orderh, it_item, it_partner,
                 order, soldto, shipto, return,
                 it_item[], it_partner[].
          v_total = v_total + 1.  "Increment Total SalesOrders counter
          CLEAR l_itemno.
          l_itemno = '10'.
    *- Covert date fields into Internal format
          CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
            EXPORTING
              datum = it_data-date
              dtype = 'DATS'
            IMPORTING
              idate = it_data-date.
    *- Populate SalesOrder header data.
          CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
            EXPORTING
              input  = it_data-auart
            IMPORTING
              output = it_data-auart.
          it_orderh-doc_type   = it_data-auart.
          it_orderh-sales_org  = it_data-vkorg.
          it_orderh-distr_chan = it_data-vtweg.
          it_orderh-division   = it_data-spart.
          it_orderh-purch_no   = 'DEPOT'.
          it_orderh-price_date = it_data-date.      "Doc Dt
          it_orderh-req_date_h = it_data-date.      "Del.Dt
          it_orderh-purch_no_s = it_data-ppl_order.
    *- Partner data
          CLEAR: l_partner, l_kunnr.
    *- Convert Partner type into internal format
          l_partner = 'SP'.  "SoldTo Party
          CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'
            EXPORTING
              input  = l_partner
            IMPORTING
              output = l_partner.
    *- Convert Customer into internal format
          l_kunnr = it_data-kunnr.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = l_kunnr
            IMPORTING
              output = l_kunnr.
          it_partner-partn_role = l_partner.
          it_partner-partn_numb = l_kunnr.
          APPEND it_partner.
          CLEAR it_partner.
        ENDAT.
    *- Item data
        it_item-itm_number = l_itemno.
    *- Convert material number into internal format
        CLEAR l_matnr.
        l_matnr = it_data-matnr.
        CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
          EXPORTING
            input        = l_matnr
          IMPORTING
            output       = l_matnr
          EXCEPTIONS
            length_error = 1
            OTHERS       = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        it_item-material  = l_matnr.
    *- Call FM to get new qty based on SAP UOM
        CLEAR: l_meins, l_qty, l_in_qty.
        l_in_qty = it_data-qty.
        CALL FUNCTION 'Z_GET_QTY_FROM_UOM'
          EXPORTING
            matnr     = it_item-material
            in_meins  = it_data-uom
            in_qty    = l_in_qty
          IMPORTING
            out_meins = l_meins
            quantity  = l_qty.
        IF sy-subrc = 0.
          it_data-qty = l_qty.
          it_data-uom = l_meins.
        ENDIF.
        it_data-qty = it_data-qty * 1000.
        it_item-req_qty = it_data-qty.
        it_item-sales_unit = it_data-uom.
        it_item-req_date   = it_data-date.
    *- Pricing data
       it_item-cond_type = it_data-kschl.  "Pricing condition
       CLEAR l_kbetr.
       l_kbetr = it_data-kbetr / 10. "Price (Rate)
       it_item-cond_value = l_kbetr.
        APPEND it_item.
        CLEAR  it_item.
    *- Increment Item counter.
        l_itemno = l_itemno + 10.
    *- At end of SalesOrder
        AT END OF ppl_order.
          READ TABLE it_data INDEX v_index.
    *- Call the BAPI for SalesOrder creation
          CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
            EXPORTING
              order_header_in = it_orderh
            IMPORTING
              salesdocument   = order
              sold_to_party   = soldto
              ship_to_party   = shipto
              return          = return
            TABLES
              order_items_in  = it_item
              order_partners  = it_partner.
          IF sy-subrc = 0.
            COMMIT WORK.
          ENDIF.
          v_return = return+0(1).
          IF v_return = 'E'.
            v_error = v_error + 1.
            CLEAR l_mesg.
            l_mesg = return.
            CONDENSE l_mesg.
          ELSE.
            v_correct = v_correct + 1.
            CLEAR l_mesg.
            CONCATENATE 'Salesorder'(007) order 'successfully created.'(008)
            INTO l_mesg SEPARATED BY space.
            CONDENSE l_mesg.
          ENDIF.
    *- Populate the output table
          CLEAR it_out.
          it_out-ppl_order = it_data-ppl_order.
          it_out-mesg = l_mesg.
          APPEND it_out.
          CLEAR it_out.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_update
    *&      Form  get_write
          Write the results
    FORM get_write .
      WRITE:/ 'Total Number of Records :'(002), v_total COLOR 1.
      WRITE:/ 'Total Correct Records   :'(003), v_correct COLOR 3.
      WRITE:/ 'Total Error Records     :'(004), v_error COLOR 6.
      SKIP 3.
      IF NOT it_out[] IS INITIAL.
        WRITE:/5 'ppl Order #'(005),
              28 'Message'(006).
      ENDIF.
      SKIP 1.
      LOOP AT it_out.
        WRITE:/5  it_out-ppl_order,
               28 it_out-mesg.
      ENDLOOP.
    ENDFORM.                    " get_write
    *&      Form  validate_data
          Validate the data
    FORM validate_data .
      DATA: l_bstkde TYPE bstkd_e.
      LOOP AT it_file.
        SELECT bstkd_e INTO l_bstkde
         UP TO 1 ROWS
         FROM vbkd
         WHERE bstkd_e = it_file-ppl_order.
        ENDSELECT.
        IF sy-subrc = 0.  " This ppl Order is already been created in SAP, so delete record
          DELETE it_file.
        ENDIF.
      ENDLOOP.
      SORT it_file BY ppl_order.
    ENDFORM.                    " validate_data
    *&      Form  data_swap
          Prepare the data for processing
    FORM data_swap .
      CLEAR: it_werks, it_info, it_matnr, it_data,
             it_werks[], it_info[], it_matnr[], it_data[].
      IF NOT it_file[] IS INITIAL.
    *- Get the plant from location
        SELECT name2
               werks
          INTO CORRESPONDING FIELDS OF TABLE it_werks
        FROM t001w FOR ALL ENTRIES IN it_file
        WHERE name2 = it_file-loc.
        IF sy-subrc = 0.
          SORT it_werks BY name2 werks.
    *- Get the Sales Org, Division and Distribution Channel
          IF NOT it_werks[] IS INITIAL.
            SELECT vkorg
                   vtweg
                   werks
            INTO CORRESPONDING FIELDS OF TABLE it_info
            FROM tvkwz FOR ALL ENTRIES IN it_werks
            WHERE werks = it_werks-werks.
            IF sy-subrc =  0.
              LOOP AT it_info.
                it_info-spart = '99'.
                MODIFY it_info INDEX sy-tabix.
              ENDLOOP.
              SORT it_info BY vkorg vtweg werks.
            ENDIF.
          ENDIF.
        ENDIF.
    *- Get material from ppl material
        SELECT ppl_prdid
               matnr
          FROM zppl_master
          INTO TABLE it_matnr FOR ALL ENTRIES IN it_file
          WHERE ppl_prdid = it_file-matnr.
        IF sy-subrc = 0.
          SORT it_matnr BY ppl_prdid matnr.
        ENDIF.
      ENDIF.
    *- Update the data in it_data
      LOOP AT it_file.
        CLEAR it_data.
       it_data-auart = 'OR'.
        it_data-auart = 'OR'.  " CHANGED BY Jo ON 3103005
        READ TABLE it_werks WITH KEY name2 = it_file-loc BINARY SEARCH.
        IF sy-subrc = 0.
          READ TABLE it_info WITH KEY werks = it_werks-werks BINARY SEARCH.
          IF sy-subrc = 0.
            it_data-vkorg = it_info-vkorg.
            it_data-vtweg = it_info-vtweg.
          ENDIF.
        ENDIF.
    *- Material
        READ TABLE it_matnr WITH KEY ppl_prdid = it_file-matnr BINARY SEARCH.
        IF sy-subrc = 0.
          it_data-matnr = it_matnr-matnr.
        ENDIF.
        it_data-ppl_order = it_file-ppl_order.
        it_data-date  = it_file-date.
        CONCATENATE it_file-kunnr it_file-loc+1(2) INTO it_data-kunnr.
        it_data-qty   = it_file-qty.
        it_data-uom   = it_file-uom.
       it_data-kbetr = it_file-kbetr.
    *- Pricing condition
       it_data-kschl = 'PR00'.
        CASE it_file-div.
          WHEN 'BRN'.
            it_data-div = '04'.
          WHEN 'GEN'.
            it_data-div = '03'.
          WHEN 'IVF'.
            it_data-div = '02'.
          WHEN 'OPH'.
            it_data-div = '01'.
        ENDCASE.
        it_data-spart = it_data-div.
        APPEND it_data.
        CLEAR  it_data.
      ENDLOOP.
    ENDFORM.                    " data_swap

  • Creating a Sales Order using Web Dynpro

    Hi SDN,
      I want to create a Sales Order using Web Dynpro application. For that i have used "Bapi_Salesorder_Createfromdat2" as a adaptive RFC model. Every thing is fine and i could able to create a sales order for a single line item. But my intension is to create a sales order for multiple line items. So in the "Intialview" i have used a "Table" UI element to pass multiple line items. When i execute this application i could pass only single line item from this table. The table UI contol is not allowing to enter the second line item in the second row of the table. Can any one suggest me to solve this problem.
    Thanks in advance.
    Regards
    Basha

    Hi Basha,
    You need to create new element for the model node manually. For example: Create button "New item" and in action handler put someting like described here:
    Add row to table
    How to add more values in a Table in WD appl
    How to add a row to table dynamically?
    How to add a column to a table dynamically.
    add row to table bound to rfc model
    Best regards, Maksim Rashchynski.

  • FM SD_SALESDOCUMENT_CREATE  on creating a sales order using reference

    I create a sales order using a reference order number.On displaying it in VA02, and giving document flow, the reference document which I used to create the sales order gets displayed.
    A program/fm u2018Xu2019 is called on giving document flow (which takes the reference order number I used as input )
    Now if that u2018Xu2019 is getting the data of the reference order I used from some table u201CT_Yu201D.This table u201CT_Yu201D must be set during sales order creation itself. So, some program which is called during creation of sales order gets the reference order number I used as input and puts it in that table u201CT_Yu201D.
    My assumption is that SD_SALESDOCUMENT_CREATE is the function module handling that part. If it is not for that, then what is its function.
    *****If it is handling that part, which structure which this FM gets as input contains that order number which I used as reference?
    There are 3 bapiu2019s called on sales order creation, BAPI_SALESORDER_CREATEFROMDAT2, BAPI_SALESORDER_CREATEFROMDAT1, BAPI_SALESORDER_CREATEFROMDATA.
    Only one BAPI calls SD_SALESDOCUMENT_CREATE namely BAPI_SALESORDER_CREATEFROMDAT2
    *****Why does the FM SD_SALESDOCUMENT_CREATE not get triggered when I set a breakpoint in it during sales order creation?

    Please search in SDN so many thread related to create sales order

  • Automatic creation of intercompany PO when creating a Sales Order

    Hi Experts
    Is there a standard way of triggering an intercompany PO when creating a sales order to the final customer (or the other way around, triggering a sales order to the end customer upon creation of an intercompany PO)? Scenario: business has setup a logistics company (company code X), which its purpose is to deliver goods to the final customer (home customers). However, sales orders are created from seperate chain of stores which belong to another company code (company code Y). This chain of stores have one sales organisation (since there is over 1000 stores under a chain). I need a way to represent that a sale originated from a store/plant belonging to company Y to end customer A. Also, I need a billing document (intercompany) from company code X to store/plant beloning to company Y.
    Issues: in the intercompany config (assign intern customer numbers to sales org) - is there a way to assign a customer number at site/plant level so that when creating an intercompany billing it can be picked instead of the one assigned to the sales org and where can this be specified in the sales order (remember: in my scenario there are multiple stores/plants that belong to one sales organisation and it is not possible to use one customer number linked to the sales organisation.)
    Desired results:
    Sales order from store/plant YY belonging to company code Y to end customer A
    Intercompany billing from plant XX belonging to company code X to store/plant YY
    End customer billing from store/plant YY to end customer A
    Thank you in advance for your help.

    Hello Tsmash  
    I think you can acheive this with Regular Sales order + Inter Company STO combination.
    Maintain customer numbers for each of the Plants from Company Y for the sales area belonging to Company X.
    Then do the config for STO in MM using this menu path:
    SPRO/Materials Management/Purchasing/Purchase Order/Set up Stock Transport Order
    Here, in the activity 'Define Shipping Data for Plants',  enter each of the plant-customers and the Sales area belonging to Comany code Y. Carry out other activities in this area appropriately.
    Similarly set up Custom ( say Z1) Special Procurement type for Plant YY for stock transfer from XX using this menu path:
    SPRO/Production/Material Requirements Planning/Master Data/Define Special Procurement Type:
    Here maintain procurement type as F, Special procurement as U and plant as XX. You may need to repeat this config for each of the receiving plants (over 1000 stores under a chain)  from co code Y.
    In the material master MRP 2 for Plant YY,  maintain procurement type as F and Special Procurement as Z1.
    Sales order will be received under Co Code Y and sales area belonging to Y form customer A,
    Because of the MRP config, a PO (STO) requirement will be raised on Co code X and plant XX. XX will send the goods to YY via a STO delivery using the Shipping data from 'Set up STO' config,
    Plant YY will send the goods to A and bill that customer. Co Code X will raise an inter-comany bill on Co code Y.
    That's how it should work. Try it and revert with any issues.

  • Line item data is not saving while creating a Sales order using Interactive

    Hi all,
    I am creating a sales order Using Interactive forms. In the form i am having Header data and line item data.I had created two structures one for Header data and one for Line item data. For entering  the LINE ITEM DATA i had created a Dynamic table with Buttons ADD ROW and DELETE ROW.
    User will Add the Row or Delete the Row based on the requirement.
    My issue is When ever the user clicks the SUBMIT button after entering the header data and 3 line items data , Sales order has been created with only first line item and the remaining two line items are not created.
    My Interactive form is like below
    HEADER DATA
    DOC_TYPE
    SALES_ORG
    DIST_CHN
    DIVISION
    PURCH_NO
    PARTN_ROLE
    PART_NO
    LINE ITEM DATA
                             ITEM_NO      MATERIAL          PLANT          QTY        COND_TYPE            COND_VALUE
    ADD ROW
    DELETE ROW
                                                                                    SUBMIT
    My  code for the method ONACTIONCLICK is like below
    method ONACTIONCLICK .
    data:
          Node_Adobe       type ref to If_Wd_Context_Node,
          Node_Zsaleheader       type ref to If_Wd_Context_Node,
          Elem_Zsaleheader       type ref to If_Wd_Context_Element,
          Stru_Zsaleheader       type If_Main=>Element_Zsaleheader,
          Node_Zsaleitem       type ref to If_Wd_Context_Node,
          Elem_Zsaleitem       type ref to If_Wd_Context_Element,
          Stru_Zsaleitem       type If_Main=>Element_Zsaleitem.
      data: header_data type BAPISDHEAD.
      data: item_wa type BAPIITEMIN.
      data: item_data type table of BAPIITEMIN.
      data: partner_wa type BAPIPARTNR.
      data: partner_data type table of BAPIPARTNR.
      data: sales_order type BAPIVBELN-VBELN.
      data: Errorlog type BAPIRETURN1.
    navigate from <CONTEXT> to <ADOBE> via lead selection
      Node_Adobe = wd_Context->get_Child_Node( Name = IF_MAIN=>wdctx_Adobe ).
    navigate from <ADOBE> to <Zsaleheader> via lead selection
      Node_Zsaleheader = Node_Adobe->get_Child_Node( Name = IF_MAIN=>wdctx_Zsaleheader ).
      Node_Zsaleitem = Node_Adobe->get_Child_Node( Name = IF_MAIN=>wdctx_Zsaleitem ).
    get element via lead selection
      Elem_Zsaleheader = Node_Zsaleheader->get_Element(  ).
      Elem_Zsaleitem = Node_Zsaleitem->get_Element(  ).
    get all declared attributes
      Elem_Zsaleheader->get_Static_Attributes(
        importing
          Static_Attributes = Stru_Zsaleheader ).
      header_data-DOC_TYPE = Stru_Zsaleheader-DOC_TYPE.
      header_data-SALES_ORG = Stru_Zsaleheader-SALES_ORG.
      header_data-DISTR_CHAN   = Stru_Zsaleheader-DISTR_CHAN.
      header_data-DIVISION = Stru_Zsaleheader-DIVISION.
      header_data-PURCH_NO = Stru_Zsaleheader-PURCH_NO.
      partner_wa-PARTN_ROLE   = Stru_Zsaleheader-PARTN_ROLE.
      partner_wa-PARTN_NUMB = Stru_Zsaleheader-PARTN_NUMB.
       append partner_wa to partner_data.
        Elem_Zsaleitem->get_Static_Attributes(
        importing
          Static_Attributes = Stru_Zsaleitem ).
      item_wa-ITM_NUMBER = Stru_Zsaleitem-ITM_NUMBER.
      item_wa-MATERIAL   = Stru_Zsaleitem-MATERIAL.
      item_wa-PLANT = Stru_Zsaleitem-PLANT.
      item_wa-REQ_QTY = Stru_Zsaleitem-REQ_QTY.
      item_wa-COND_TYPE   = Stru_Zsaleitem-COND_TYPE.
      item_wa-COND_VALUE = Stru_Zsaleitem-COND_VALUE.
      append item_wa to item_data.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
      EXPORTING
        ORDER_HEADER_IN           = header_data
      WITHOUT_COMMIT            = ' '
      CONVERT_PARVW_AUART       = ' '
    IMPORTING
       SALESDOCUMENT             = sales_order
      SOLD_TO_PARTY             =
      SHIP_TO_PARTY             =
      BILLING_PARTY             =
       RETURN                    = errorlog
      TABLES
        ORDER_ITEMS_IN            = item_data
        ORDER_PARTNERS            = partner_data
      ORDER_ITEMS_OUT           =
      ORDER_CFGS_REF            =
      ORDER_CFGS_INST           =
      ORDER_CFGS_PART_OF        =
      ORDER_CFGS_VALUE          =
      ORDER_CCARD               =
      ORDER_CFGS_BLOB           =
      ORDER_SCHEDULE_EX         =
    endmethod.
    PLEASE SUGGEST ME IF ANY CODE CHANGE IS REQUIRED
    Thanks in advance
    Ajay

    Hi,
    The item data is not read because, the dynamically added rows should also reflect back to the Web Dynpro context. When the user clicks on Add Row, use the Onsubmit event to add a empty line to internal table and then bind it to the context. And if the user removes a row, remove a row from internal table and bind it back to the context.
    You may refer this article.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/802f0ed1-a17a-2c10-7db4-d515a5b047ed
    Regards,
    Runal

  • Error while creating the sales order using Proxy

    Hi Folks,
    I am trying to create a Sales Order using Proxy via BAPI "BAPI_SALESORDER_CREATEFROMDAT2" :
    and i got this type of standard error message
    <Message>FB call: insufficient parameters</Message>
    few days back only i used the same bapi for creating the Sales Order and did it successfully...using the same parameters
    I don't have any clue about this type error .
    Kindly guide .
    Regards,

    Hi Nikhil,
    How refreshing the cache and restart the server will help ?
    basically i am testing the scenario at R/3 end only by generating XML template in SPROXY.
    My ECC 6.0 is on sp 12....I am not sure is it configuration related error or a bug ? as i have used the same code in ECC 6.0 with sp 09.
    regards,

  • How to create the sales order using BAPI's ....?

    Hi Guru's,
    could you please provide how to create the sales order using BAPI's .....i need step by step process and please provide the details from scratch....basically  i don't have basic knowledge on this....please provide required inputs ....:)
    thanks in advance
    Srinivas......

    Hi Guru's thanks for your inouts and your valuble time...
    please find the program logic below...
    *& Report  ZAREPAS30
    REPORT  zarepas30.
    DATA : gs_vbeln                   TYPE  vbak-vbeln,
           gs_order_header_in         TYPE  bapisdhd1,
           gs_order_header_inx        TYPE  bapisdhd1x,
           gt_order_items_in          TYPE  STANDARD TABLE OF bapisditm,
           gwa_itab1                  TYPE  bapisditm,
           gt_order_items_inx         TYPE  STANDARD TABLE OF bapisditmx,
           gwa_itab2                  TYPE  bapisditmx,
           gt_order_partners          TYPE  STANDARD TABLE OF bapiparnr,
           gwa_itab3                  TYPE  bapiparnr,
           gt_return                  TYPE  STANDARD TABLE OF bapiret2,
           gwa_itab4                  TYPE  bapiret2.
    Sales document type
      PARAMETERS: p_auart TYPE auart OBLIGATORY.
    Sales organization
      PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    Distribution channel
      PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    Division.
      PARAMETERS: p_spart TYPE spart OBLIGATORY.
    Requested Delivery Date
      PARAMETERS: p_edatu  TYPE edatu OBLIGATORY.
    Sold-to
      PARAMETERS: p_sold  TYPE kunnr OBLIGATORY.
    Ship-to
      PARAMETERS: p_ship  TYPE kunnr OBLIGATORY.
    Material
      PARAMETERS: p_matnr TYPE matnr   OBLIGATORY.
    Quantity.
      PARAMETERS: p_menge TYPE kwmeng  OBLIGATORY.
    Plant
      PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    Start-of-selection.
      START-OF-SELECTION.
    Header data
    Sales document type
      gs_order_header_in-doc_type = p_auart.
      gs_order_header_inx-doc_type = 'X'.
    Sales organization
      gs_order_header_in-sales_org = p_vkorg.
      gs_order_header_inx-sales_org = 'X'.
    Distribution channel
      gs_order_header_in-distr_chan  = p_vtweg.
      gs_order_header_inx-distr_chan = 'X'.
    Division
      gs_order_header_in-division = p_spart.
      gs_order_header_inx-division = 'X'.
    Reguested Delivery Date
      gs_order_header_in-req_date_h = p_edatu.
      gs_order_header_inx-req_date_h = 'X'.
      gs_order_header_inx-updateflag = 'I'.
    Partner data
    Sold to
      gwa_itab3-partn_role = 'AG'.
      gwa_itab3-partn_numb = p_sold.
      APPEND gwa_itab3 TO  gt_order_partners .
    ship to
      gwa_itab3-partn_role = 'WE'.
      gwa_itab3-partn_numb = p_ship.
      APPEND gwa_itab3 TO  gt_order_partners .
    ITEM DATA
      gwa_itab2-updateflag = 'I'.
    Line item number.
      gwa_itab1-itm_number = '000010'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    Line item number.
      gwa_itab1-itm_number = '000020'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
        order_header_in               = gs_order_header_in
        ORDER_HEADER_INX              = gs_order_header_inx
      IMPORTING
        SALESDOCUMENT                 = gs_vbeln
      tables
        RETURN                        = gt_return
        ORDER_ITEMS_IN                = gt_order_items_in
        ORDER_ITEMS_INX               = gt_order_items_inx
        order_partners                = gt_order_partners.
    Check the return table.
      LOOP AT gt_return into gwa_itab4 WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error occured while creating sales order '.
      ELSE.
    Commit the work.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        WRITE: / 'Document ', gs_vbeln, ' created'.
      ENDIF.

  • Error in GTS when creating a sales order

    Hello All:
    Let me first say that I have researched the forums and web for my answer to no avail...there is not a lot of information out there for GTS issues. 
    When creating a sales order in ECC 600; I am receiving errors...I have looked at SLG1 in order to get more information on these errors.  I have validated my config in GQ0 and it appears to be correct.  Here is my errors I am receiving:
    Legal Control: Item Type Mapping not Maintained
    Item Category: ZTAE
    Item Category: ZTAQ
    Legal Control: Partn. Function Mapping not Maintained
    Partner Function: AG
    Partner Function: AP
    Partner Function: CI
    Partner Function: EN
    Partner Function: RE
    Partner Function: RG
    Partner Function: SP
    Partner Function: WE
    Legal Control: Mapping of Org. Units not Maintained For Fore
    Company Code: 1000
    Legal Control: Mapping of Org. Units not Maintained For Lega
    Plant: 1000
    I have looked under the Org Structure for these errors and think my configuration is correct.  I have checked under the following:
    In SPRO I have done the following Config under Org Structure:
    Define Foreign Trade Organizations
    Assign Company Code At Feeder System
    Define Legal Units
    Assign Legal Unit to Foreigne Trade
    Assigned Plant at Feeder System
    In Spro I have done the following Config under Partner Structure:
    Define Partner Functions
    Define Groups of Partner Functions
    Assign Partner Functions at Feeder system
    In SpRO under Compliance Management I have done the following Config under document structure:
    Define Doc Types
    Assign Doc types at feeder system
    Define item categories
    Assign item categories at feeder system
    It is obvious I am missing something....Please help...it would be greatly appreciated....

    Hi Dave
    Thanks for replying. 
    For Business Partners the error I am getting in SLG1 is the follwoing:
    Sub Object text
    Mapping of API to Customs Shipment - Arrival
    Program
    /SAPSLL/SAPLCORE_APPLOG_SERV
    @5C\QError@     
    The system was unable to determine an FT organiz. for company code 1000
    The system was unable to determine a legal unit for plant 1000
    No mapping information exists for partner function AG
    Another error for Business Partner:
    sub object text
    Business Partner Distribution
    Program
    /SAPSLL/SAPLCORE_APPLOG_SERV
    @5C\QError@     
    Please use another function to maintain the SPACE version of the address
    For Item Categories
    SubObect TextMapping of API to Customs Shipment - Arrival
    Program
    /SAPSLL/SAPLCORE_APPLOG_SERV
    @5C\QError@     
    No mapping information exists for item type ZTAQ
    The system was unable to determine a legal unit for plant 1000
    No mapping information exists for partner function AG
    Also we are using GTS 7.2 but upgrading to GTS 10 and I am trying to create our testing client for a to test after upgrade
    Edited by: Kim Blair on Sep 9, 2011 4:57 PM
    Edited by: Kim Blair on Sep 9, 2011 4:58 PM

  • How to create a sales document using  BAPI_SALESORDER_CREATEFROMDAT2

    Hai i was un able to create a sales order using the BAPI can you help me out

    Sample Code:
              clear:   l_order_header,
                       l_salesdocument,
                       l_order_partners,
                       l_order_items,
                       l_order_schdl.
              refresh: it_order_items,
                       it_order_partners,
                       it_order_schdl,
                       it_return.
    ???????? get from material ...
            Order header
              l_order_header-doc_type          = 'ZQBV'.
              l_order_header-distr_chan        = '10'.
              l_order_header-division          = '00'.
              if g_qals-werk eq '1100'.
                l_order_header-sales_org         = '1000'.
              else.
                if g_qals-werk eq '3100'.
                  l_order_header-sales_org         = '3000'.
                else.
                  message i001(00) with text-005.
                endif.
              endif.
              l_order_header-purch_no_c        = g_qals-prueflos.  " <= lot
            Partner data
              l_order_partners-partn_role      = 'AG'.
              l_order_partners-partn_numb      = g_qals-kunnr.
              append l_order_partners to it_order_partners.
            Order items => only one
              l_order_items-itm_number         = 10.
              l_order_items-material           = g_qals-matnr.
              l_order_items-target_qty         = 1.
              append l_order_items to it_order_items.
            Schedules for quantity
              l_order_schdl-itm_number         = 10.
              l_order_schdl-req_qty            = 1.        " <=  only 1 !
              append l_order_schdl to it_order_schdl.
            Conditions for value
              l_order_conditions-itm_number    = 10.
              l_order_conditions-cond_type     = 'PR00'.
              l_order_conditions-cond_value    = g_effort_sum.
              l_order_conditions-currency      = g_effort_unit.
              append l_order_conditions to it_order_conditions.
            BAPI to create sales order
              CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
                EXPORTING
               SALESDOCUMENTIN               =
                  ORDER_HEADER_IN               = l_order_header
               ORDER_HEADER_INX              =
               SENDER                        =
               BINARY_RELATIONSHIPTYPE       =
               INT_NUMBER_ASSIGNMENT         =
               BEHAVE_WHEN_ERROR             =
               LOGIC_SWITCH                  =
               TESTRUN                       =
               CONVERT                       = ' '
                IMPORTING
                  SALESDOCUMENT                 = l_salesdocument
                TABLES
                  RETURN                        = it_return
                  ORDER_ITEMS_IN                = it_order_items
               ORDER_ITEMS_INX               =
                  ORDER_PARTNERS                = it_order_partners
                  ORDER_SCHEDULES_IN            = it_order_schdl
               ORDER_SCHEDULES_INX           =
                  ORDER_CONDITIONS_IN           = it_order_conditions
               ORDER_CONDITIONS_INX          =
               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 l_salesdocument is initial.
              order successfully created
                message i001(00) with text-001 l_salesdocument.
    call function 'BAPI_TRANSACTION_COMMIT'.
              endif.
    Regards,
    Ravi

  • How to create a sales order using PO ALE Idoc

    Hi,
    I  have a purchase order in my ECC6 system, and output for this PO is ALE idoc.
    Now I want to create a Sales order using that Idoc in the same system,
    can anbody please tell the procedure
    sreeram

    Do NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
    Use BAPI_SALESORDER_CREATEFROMDAT1 .
    To build a reference to your contract you have to supply ORDER_HEADER_IN.
    Here´s a sample:
    MOVE:
    gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
    gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
    gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
    gs_vbak-auart TO ls_bapisdhd1-refdoctype.
    also gothrouh the links
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi

Maybe you are looking for