Transfer of Intercompany sales orders using LSMW

Hi
I have to Transfer the open intercompany sales orders using LSMW. Consider a scenario where customer places an order on sales org A with plant A. sales org A raises purchase order on Sales org B with plant B. The material moves from Plant B ie supplying plant to delivering plant A. THen it is delivered to custome from plant A. Can u please tell me whether i have to pass the suppying plant or it will be determined automatically. Similarly what about the purchase requisition no. Is it created automatically.
Thanks
regards
Tushar

Hi,
The purchase requisition is going to automatically created incase of a intercompany order  (ie nothing but the third party order).  In this case of orders the line item category in the sales order would be TAS. The intercompany sales order nothing different from a normal order during the creation of the order, after that the operations will be different from the normal standard order.  You can use the same LSMW which you have used for transfering normal standard orders.
The configs are going to be different in the system for intercompany sales orders compared to the standard sales orders. That is the problem of the functional consultant to take care.
Thanks,
Mahesh.

Similar Messages

  • Update the material quantity in the sales order using LSMW...

    Hi Guru's,
    I created one sales order using BAPI..now i wanted update the material quantity in the sales order using LSMW...
    could you please provide the step by step process....
    if anyone of you provide the program logic similar to requirement that would be helpfull to me...
    thanks in advance
    Srinivas....

    Hi Sri,
    Hope it may help you.
    First do the recording for VA02 transaction, in that give the existing sales order number
    and update the Quantity and save it. Remaining steps are same what we used(LSMW) to upload data to applications.
    Regards,
    Vishvesh
    if helpful, rewards it.

  • Sales order Using LSMW and BAPI BUS2032

    Hi Guys,
    I am trying to use LSMW for creating sales order through BAPI.
    Business Object      BUS2032
    Method               CREATEFROMDAT2          
    Message Type         SALESORDER_CREATEFROMDAT2
    Basic Type           SALESORDER_CREATEFROMDAT202
    I can do it using a BDC program.
    I want to know how the sales order flat file will look like (one header and multiple line item)if i am using LSMW with BAPI and how it is mapped for multiple line items.
    Thanks in Adv.
    Akhil

    See if you can get something out of this.
    One simple step by step example
    Complete the step one (you are using the correct BAPI )
    insetp 2(Maintain Source Structures) create source structures like with the header and details hierarchy                                                                               
    5  ZCFOF0021_HDR     Header                                              
               ZCFOF0021_PARTNER        Partner                                                                               
    ZCFOF0021_ITM            Item Detail                                                                               
    In Step 3(Maintain Source Fields) create the fields for all source structures like below example                                                                               
    5  ZCFOF0021_HDR   Header                        OLDNR         C(008)    Legacy JDE Sales Order Number                                                                               
    VKORG         C(004)    Sales Organization                                                                               
    VTWEG         C(002)    Distribution Channel                                                                               
    SPART         C(002)    Division                                                                               
    AUART         C(004)    Sales Document Type                                                                               
    VDATU         C(008)    Requested delivery date                                                                               
    BSTKD         C(020)    Customer purchase order number                                                                               
    BSARK         C(004)    Customer purchase order type                                                                               
    BSTDK         C(008)    Customer purchase order date                                                                               
    INCO1         C(003)    Incoterms (part 1)                                                                               
    INCO2         C(028)    Incoterms (part 2)                                                                               
    ZTERM         C(004)    Terms of payment key                                                                               
    LIFSK         C(002)    Delivery block (document header)                                                                               
    FAKSK         C(002)    Billing block in SD document                                                                               
    WAERK         C(005)    SD document currency                                                                               
    KURSK         C(009)    Exchange Rate for Pricing and Statistics                                                               
           AUTLF         C(001)    Complete delivery defined for each sales order                                                         
           VSBED         C(002)    Shipping conditions                                                                               
    ZOTC_PATNAME  C(035)    Patient Name                                                                               
    ZOTC_PATREFNO C(035)    Patient Reference Number                                                                               
    ZOTC_IMPDATE  C(008)     Implant Date                                                                               
    BNAME         C(030)    Branching name                                                                               
    TAXK1         C(001)    Alternative tax classification                                                                               
    5  ZCFOF0021_PARTNER         Partner                                                                               
    OLDNR        C(008)    Legacy JDE Sales Order Number                                                                               
    PARVW        C(002)    Partner function                                                                               
    KUNNR        C(010)    Sold To                                                                               
    NAME1        C(035)    Name 1                                                                               
    STRAS        C(035)    House number and street                                                                               
    STR_SUPPL1   C(040)    Street 2                                                                               
    LAND1        C(003)    Country Key                                                                               
    PSTLZ        C(010)    Postal Code                                                                               
    ORT01        C(035)    City                                                                               
    REGIO        C(003)    Region (State, Province, County)                                                                               
    AUART        C(004)     Sales Document Type                                                                               
    5  ZCFOF0021_ITM             Item Detail                                                                               
    OLDNR        C(008)    Legacy JDE Sales Order Number                                                                               
    MATNR        C(018)    Material Number                                                                               
    WERKS        C(004)    Plant                                                                               
    LGORT        C(004)    Storage Location                                                                               
    VRKME        C(003)    Sales unit                                                                               
    KSCHL2       C(004)    Condition type                                                                               
    KBETR2C      C(011)    Condition rate with decimal places and minus sign                                                    
              KWAER2       C(005)    Currency key                                                                               
    WMENGC       C(013)    Order qty in sales units - 00009001 corresponds to 9.001                                             
              CHARG        C(010)    Batch Number                                                                               
    In Step 4 (Maintain Structure Relations)  assign source structures to target strucutres like below                                                                               
    E1SALESORDER_CREATEFROMDAT2 Header Segment                                               <<<< ZCFOF0021_HDR     Header                                                                               
    E1BPSDHD1                   Communication Fields: Sales and Distribution Document Header <<<< ZCFOF0021_HDR     Header            
        E1BPSDHD1X                  Checkbox Fields for Sales and Distribution Document Header                                            
        E1BP_SENDER                 Logical System of Sender                                                                               
    E1BPSDLS                    SD Checkbox for the Logic Switch                                                                      
    5  E1BPSDITM                   Communication Fields: Sales and Distribution Document Item   <<<< ZCFOF0021_ITM     Item Detail                                                                               
    E1BPSDITM1                  Communication Fields: Sales and Distribution Document Item                                                                               
    E1BPSDITMX                  Communication Fields: Sales and Distribution Document Item                                            
        E1BPPARNR                   Communications Fields: SD Document Partner: WWW              <<<< ZCFOF0021_PARTNER Partner           
        E1BPSCHDL                   Communication Fields for Maintaining SD Doc. Schedule Lines  <<<< ZCFOF0021_ITM     Item Detail       
        E1BPSCHDLX                  Checkbox List for Maintaining SD Document Schedule Line                                               
        E1BPCOND                    Communication Fields for Maintaining Conditions in the Order <<<< ZCFOF0021_ITM     Item Detail       
        E1BPCONDX                   Communication Fields for Maintaining Conditions in the Order                                          
        E1BPCUCFG                   CU: Configuration Data                                                                               
    E1BPCUINS                   Instances of Several Configurations                                                                   
        E1BPCUPRT                   Part_of Entries of Several Configurations                                                             
        E1BPCUVAL                   Characteristic Values of Several Configurations                                                       
        E1BPCUBLB                   BLOB Internal Configuration Data (SCE)                                                                
        E1BPCUVK                    Variant Condition Keys in Configurations                                                              
        E1BPCUREF                   CU: Reference Order Item / Instance in Configuration                                                  
        E1BPCCARD                   Communication Table: Means of Payment Order/Billing Document                                          
        E1BPSDTEXT                  Communication Fields: SD Texts                                                                        
        E1BPSDKEY                   Key in Sales and Distribution Document                                                                
        E1BPPAREX                   Ref. Structure for BAPI Parameter EXTENSIONIN/EXTENSIONOUT   <<<< ZCFOF0021_ITM     Item Detail       
    5  E1BPADR1                    BAPI Reference Structure for Addresses (Org./Company)        <<<< ZCFOF0021_PARTNER Partner                                                                               
    E1BPADR11                   BAPI Reference Structure for Addresses (Org./Company)        <<<< ZCFOF0021_PARTNER Partner       
    In Step 5(Maintain Field Mapping and Conversion Rules) assign source fields to target fields
    Map each filed to the target fields.

  • How to create Billing Plan in sales order using Function module /BAPI

    hi,
    How to create Billing Plan in sales order using Function module /BAPI
    i hv check few FM such
    BILLING_SCHEDULE_READ
    BILLING_SCHEDULE_GET_NUMBER
    BILLING_SCHEDULE_SAVE
    But unable to create billing plan for a sales order.....any other method to create???

    Hi,
    Use this link.
    Create sales order with billing plan via LSMW and BAPI BUS2032
    BAPI or Function to update Billing Plan in Sales Order Items
    Hope this will help you.
    Regards,
    Vijay

  • Creating sales order using ' BAPI_SALESORDER_CREATEFROMDAT1'

    Hi ,
    i have a problem in creating sales order using ' BAPI_SALESORDER_CREATEFROMDAT1 '  .
    order number is created and every thing unless the order quantity isn't created for material item .
    my inputs are .
    in "ORDER_HEADER_IN"
    (DOC_TYPE , SALES_ORG , DISTR_CHAN , DIVISION ,SALES_OFF )
    in " ORDER_ITEMS_IN"
    (MATERIAL ,PLANT ,REQ_QTY  )
    in "ORDER_PARTNERS"
    (PARTN_ROLE , PARTN_NUMB)
    so the order created but as i say the the order quqntity isn't created for the material  so the "net value and maertial net valve )
    aren't calcoluted .
    << Moderator message - Everyone's problem is important. But the answers in the forum are provided by volunteers. Please do not ask for help quickly. >>
    waiting .
    thanks for all
    Edited by: Rob Burbank on Jan 7, 2011 4:28 PM

    Hi Mr. Ahmed Tohamy,
    my point is just create a schedule line with each item line. The relevant code we used was (excerpt)
    perform bapi_map_filled using:
          lv_matnr      'MATERIAL'   space
            changing ls_in    ls_inx,
          lv_tax_class1 'TAX_CLASS1' gc_true
            changing ls_in    ls_inx,
          lv_qty        'TARGET_QTY' space
            changing ls_in    ls_inx, "QTY to item line
          lv_qty        'REQ_QTY'    space
            changing ls_schdl ls_schdlx,"QTY to schedule line
          lv_itm_number 'ITM_NUMBER' space
            changing ls_in    ls_dummy,
          lv_itm_number 'ITM_NUMBER' space
            changing ls_schdl ls_dummy,
          lv_ref_doc_ca 'REF_DOC_CA' space
            changing ls_in    ls_inx,
          lv_orderid    'ORDERID'    space
            changing ls_in    ls_inx,
          lv_ref_doc    'REF_DOC'    space
            changing ls_in    ls_inx.
        append:
          ls_in       to pt_order_items_in,
          ls_inx      to pt_order_items_inx,
          ls_schdl    to pt_order_schdl,
          ls_schdlx   to pt_order_schdlx.
    Here the quantity is put to item line and schedule line, we always mark the correspoing X structure fields:
    *&      Form  bapi_map_filled
    *       if the value passed is not initial, it is moved to the field
    *       and the corresponding (BAPI-) X-field is marked
    *       if no x-structure is required, a dummy structure is passed
    *       if p_initial parameter is filled, initial fields will be marked
    *       in x-structure. Purpose: transfer of initial values to BAPI
    form bapi_map_filled using    p_value      type any
                                  p_fieldname  type fieldname
                                  p_initial    type flag
                         changing p_structure  type any
                                  p_structurex type any.
      field-symbols:
        <any> type any,
        <c>   type c.
      check:
         not ( p_value is initial and p_initial is initial ).
      assign:
        component p_fieldname of structure p_structure to <any>,
        component p_fieldname of structure p_structurex to <c>.
      <any> = p_value.
      check <c> is assigned.
      <c> = gc_true.
    endform.                    " bapi_map_filled
    Also, we did something to create conditions (i.e. tax) but I think that was project-specific.
    We used BAPI_SALESORDER_CREATEFROMDAT2, I do not know about BAPI_SALESORDER_CREATEFROMDAT1.
    Regards,
    Clemens

  • Transfer goods from sales order to own unrestricte stock

    Hello,
    does someone knows a way to transfer goods from sales order stock to own unrestricted stock.
    MB1B is not good, because I have to transfer each material separately with 411E.
    I want to transfer all materials in one step.
    Thx a lot!

    Hi,
    Create a LSMW and transfer
    Regards,
    Vikas

  • Unable to process intercompany sales order

    Unable to process intercompany Sales Order. The error message refers to the requirement to include inco-terms. although these terms are normally only included for imports. then why incoterm if intercompany sales with in same country?

    Hello Colleague,
    I regret to tell you that there is no standard way to change the       
    incoterm field as optional field. However, there is work around which  
    can be done by using SE51 -screen painter. To proceed further, please  
    refer to your local consultant as they might know your company system  
    requirement better.                                                    
    Regards
    Ruy Castro

  • Issue in creating sales order using BAPI's...?

    Hi Guru's,
    i had generated the sales order using the BAPI..but could please guide me how to declare the data declaratin same fields as globally and how to move internal table and how to append ....
    thanks in advance...
    REPORT z_bapi_salesorder_create.
    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.
    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.
    Data declarations.
    DATA: v_vbeln            LIKE vbak-vbeln.
    DATA: header             LIKE bapisdhead1.
    DATA: headerx            LIKE bapisdhead1x.
    DATA: item               LIKE bapisditem  OCCURS 0 WITH HEADER LINE.
    DATA: itemx              LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner            LIKE bapipartnr  OCCURS 0 WITH HEADER LINE.
    DATA: return             LIKE bapiret2    OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx   TYPE STANDARD TABLE OF bapischdlx
                             WITH HEADER LINE.
    DATA: lt_schedules_in    TYPE STANDARD TABLE OF bapischdl
                             WITH HEADER LINE.
    Start-of-selection.
    START-OF-SELECTION.
    Header data
    Sales document type
      header-doc_type = p_auart.
      headerx-doc_type = 'X'.
    Sales organization
      header-sales_org = p_vkorg.
      headerx-sales_org = 'X'.
    Distribution channel
      header-distr_chan  = p_vtweg.
      headerx-distr_chan = 'X'.
    Division
      header-division = p_spart.
      headerx-division = 'X'.
      headerx-updateflag = 'I'.
    Partner data
    Sold to
      partner-partn_role = 'AG'.
      partner-partn_numb = p_sold.
      APPEND partner.
    Ship to
      partner-partn_role = 'WE'.
      partner-partn_numb = p_ship.
      APPEND partner.
    ITEM DATA
      itemx-updateflag = 'I'.
    Line item number.
      item-itm_number = '000010'.
      itemx-itm_number = 'X'.
    Material
      item-material = p_matnr.
      itemx-material = 'X'.
    Plant
      item-plant    = p_plant.
      itemx-plant   = 'X'.
    Quantity
      item-target_qty = p_menge.
      itemx-target_qty = 'X'.
      APPEND item.
      APPEND itemx.
      Fill schedule lines
      lt_schedules_in-itm_number = '000010'.
      lt_schedules_in-sched_line = '0001'.
      lt_schedules_in-req_qty    = p_menge.
      APPEND lt_schedules_in.
      Fill schedule line flags
      lt_schedules_inx-itm_number  = '000010'.
      lt_schedules_inx-sched_line  = '0001'.
      lt_schedules_inx-updateflag  = 'X'.
      lt_schedules_inx-req_qty     = 'X'.
      APPEND lt_schedules_inx.
    Call the BAPI to create the sales order.
      CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
        EXPORTING
          sales_header_in     = header
          sales_header_inx    = headerx
        IMPORTING
          salesdocument_ex    = v_vbeln
        TABLES
          return              = return
          sales_items_in      = item
          sales_items_inx     = itemx
          sales_schedules_in  = lt_schedules_in
          sales_schedules_inx = lt_schedules_inx
          sales_partners      = partner.
    Check the return table.
      LOOP AT return WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error in creating document'.
      ELSE.
    Commit the work.
       COMMIT WORK AND WAIT.
         call FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        WRITE: / 'Document ', v_vbeln, ' created'.
      ENDIF.

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

  • Create sales order using  IBE_Quote_W1_PVT.SUBMITQUOTEWRAPPER

    Hi,
    I am trying to create an sales order using following api. which creates cart from shopping cart.
    SET serveroutput ON
    DECLARE
    P_API_VERSION_NUMBER NUMBER;
    P_INIT_MSG_LIST VARCHAR2(200);
    P_COMMIT VARCHAR2(200);
    X_RETURN_STATUS VARCHAR2(200);
    X_MSG_COUNT NUMBER;
    X_MSG_DATA VARCHAR2(200);
    P_QUOTE_HEADERID NUMBER;
    P_LAST_UPDATE_DATE DATE;
    P_SHAREE_NUMBER NUMBER;
    P_SHAREE_PARTY_ID NUMBER;
    P_SHAREE_ACCOUNT_ID NUMBER;
    P_SC_BOOK_FLAG VARCHAR2(200);
    P_SC_RESERVE_FLAG VARCHAR2(200);
    P_SC_CALCULATE_PRICE VARCHAR2(200);
    P_SC_SERVER_ID NUMBER;
    P_SC_CC_BY_FAX VARCHAR2(200);
    P_CUSTOMER_COMMENTS VARCHAR2(200);
    P_REASON_CODE VARCHAR2(200);
    P_SALESREP_EMAIL_ID VARCHAR2(200);
    P_MINISITE_ID NUMBER;
    X_LAST_UPDATE_DATE DATE;
    X_ORDER_NUMBER NUMBER;
    X_ORDER_HEADER_ID NUMBER;
    X_ORDER_REQUEST_ID NUMBER;
    X_CONTRACT_ID NUMBER;
    X_STATUS VARCHAR2(200);
    X_HOLD_FLAG VARCHAR2(200);
    BEGIN
    P_API_VERSION_NUMBER := 1;
    P_INIT_MSG_LIST := FND_API.G_TRUE;
    P_COMMIT := FND_API.G_FALSE;
    P_QUOTE_HEADERID := 18534;
    P_LAST_UPDATE_DATE := to_date('2012-10-01 04:33:45','YYYY-MM-DD HH24:MI:SS');
    P_SHAREE_NUMBER := FND_API.G_MISS_NUM ;
    P_SHAREE_PARTY_ID := FND_API.G_MISS_NUM ;
    P_SHAREE_ACCOUNT_ID := FND_API.G_MISS_NUM ;
    P_SC_BOOK_FLAG := FND_API.G_MISS_CHAR;
    P_SC_RESERVE_FLAG := FND_API.G_FALSE;
    P_SC_CALCULATE_PRICE := FND_API.G_FALSE;
    P_SC_SERVER_ID := -1;
    P_SC_CC_BY_FAX := FND_API.G_FALSE;
    P_CUSTOMER_COMMENTS := FND_API.G_MISS_CHAR;
    P_REASON_CODE := FND_API.G_MISS_CHAR;
    P_SALESREP_EMAIL_ID := FND_API.G_MISS_CHAR;
    P_MINISITE_ID := 10660;
    IBE_Quote_W1_PVT.SUBMITQUOTEWRAPPER(
    P_API_VERSION_NUMBER => P_API_VERSION_NUMBER,
    P_INIT_MSG_LIST => P_INIT_MSG_LIST,
    P_COMMIT => P_COMMIT,
    X_RETURN_STATUS => X_RETURN_STATUS,
    X_MSG_COUNT => X_MSG_COUNT,
    X_MSG_DATA => X_MSG_DATA,
    P_QUOTE_HEADERID => P_QUOTE_HEADERID,
    P_LAST_UPDATE_DATE => P_LAST_UPDATE_DATE,
    P_SHAREE_NUMBER => P_SHAREE_NUMBER,
    P_SHAREE_PARTY_ID => P_SHAREE_PARTY_ID,
    P_SHAREE_ACCOUNT_ID => P_SHAREE_ACCOUNT_ID,
    P_SC_BOOK_FLAG => P_SC_BOOK_FLAG,
    P_SC_RESERVE_FLAG => P_SC_RESERVE_FLAG,
    P_SC_CALCULATE_PRICE => P_SC_CALCULATE_PRICE,
    P_SC_SERVER_ID => P_SC_SERVER_ID,
    P_SC_CC_BY_FAX => P_SC_CC_BY_FAX,
    P_CUSTOMER_COMMENTS => P_CUSTOMER_COMMENTS,
    P_REASON_CODE => P_REASON_CODE,
    P_SALESREP_EMAIL_ID => P_SALESREP_EMAIL_ID,
    P_MINISITE_ID => P_MINISITE_ID,
    X_LAST_UPDATE_DATE => X_LAST_UPDATE_DATE,
    X_ORDER_NUMBER => X_ORDER_NUMBER,
    X_ORDER_HEADER_ID => X_ORDER_HEADER_ID,
    X_ORDER_REQUEST_ID => X_ORDER_REQUEST_ID,
    X_CONTRACT_ID => X_CONTRACT_ID,
    X_STATUS => X_STATUS,
    X_HOLD_FLAG => X_HOLD_FLAG
    DBMS_OUTPUT.PUT_LINE('X_RETURN_STATUS = ' || X_RETURN_STATUS);
    DBMS_OUTPUT.PUT_LINE('X_MSG_COUNT = ' || X_MSG_COUNT);
    DBMS_OUTPUT.PUT_LINE('X_MSG_DATA = ' || X_MSG_DATA);
    DBMS_OUTPUT.PUT_LINE('X_LAST_UPDATE_DATE = ' || X_LAST_UPDATE_DATE);
    DBMS_OUTPUT.PUT_LINE('X_ORDER_NUMBER = ' || X_ORDER_NUMBER);
    DBMS_OUTPUT.PUT_LINE('X_ORDER_HEADER_ID = ' || X_ORDER_HEADER_ID);
    DBMS_OUTPUT.PUT_LINE('X_ORDER_REQUEST_ID = ' || X_ORDER_REQUEST_ID);
    DBMS_OUTPUT.PUT_LINE('X_CONTRACT_ID = ' || X_CONTRACT_ID);
    DBMS_OUTPUT.PUT_LINE('X_STATUS = ' || X_STATUS);
    DBMS_OUTPUT.PUT_LINE('X_HOLD_FLAG = ' || X_HOLD_FLAG);
    END;
    When i use this from a OA_HTML jsp the sales order is created . But when i use it from the sql developer
    i got following error
    X_RETURN_STATUS = E
    X_MSG_COUNT = 1
    X_MSG_DATA = You do not have access to this cart.
    X_LAST_UPDATE_DATE =
    X_ORDER_NUMBER = 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
    X_ORDER_HEADER_ID = 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
    X_ORDER_REQUEST_ID = 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
    X_CONTRACT_ID = 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
    X_STATUS =
    I checked logs for both .
    For working one log is ie. using jsp
    01-OCT-2012:01:24:46 IBE IBE_UTIL.enable_debug_new p_check_profile is N
    01-OCT-2012:01:24:46 IBE IBE_UTIL.enable_debug_new p_check_profile is N
    01-OCT-2012:01:24:46 IBE Begin validate_user_update10/01/2012:01:24:46
    01-OCT-2012:01:24:46 IBE Incoming party_id is 423832
    01-OCT-2012:01:24:46 IBE Incoming cust_account_id is 140757
    01-OCT-2012:01:24:46 IBE Incoming quote_header_id is 18529
    01-OCT-2012:01:24:46 IBE User id obtained from environment is: -1
    01-OCT-2012:01:24:46 IBE p_save_type is :6
    01-OCT-2012:01:24:46 IBE Entered Validation...T
    01-OCT-2012:01:24:46 IBE no sharee number
    01-OCT-2012:01:24:46 IBE quote_source_code of cart passed in=IStore Account
    01-OCT-2012:01:24:46 IBE In validating Owner flow: 423832,140757 10/01/2012:01:24:46
    01-OCT-2012:01:24:46 IBE Validate_user_update: Before Last update date validation,p_last_update_date= 01-10-12
    01-OCT-2012:01:24:46 IBE Validate_user_update: Last update date validation START
    01-OCT-2012:01:24:46 IBE Validate_user_update: l_last_update_date=
    01-OCT-2012:01:24:46 IBE Validate_user_update: p_last_update_date=10/01/2012:00:22:07
    01-OCT-2012:01:24:46 IBE Validate_user_update: Last update date validation END
    01-OCT-2012:01:24:46 IBE Before calling validate_quote10/01/2012:01:24:46
    01-OCT-2012:01:24:46 IBE Begin Validate_quote10/01/2012:01:24:46
    01-OCT-2012:01:24:46 IBE Validate_quote: Validation for one-click start
    01-OCT-2012:01:24:46 IBE End validate_quote10/01/2012:01:24:46
    01-OCT-2012:01:24:46 IBE End validate_user_update10/01/2012:01:24:46
    but for the failure it is.
    01-OCT-2012:01:20:53 IBE IBE_UTIL.enable_debug_new p_check_profile is N
    01-OCT-2012:01:20:53 IBE IBE_UTIL.enable_debug_new p_check_profile is N
    01-OCT-2012:01:20:53 IBE Begin validate_user_update10/01/2012:01:20:53
    01-OCT-2012:01:20:53 IBE Incoming party_id is 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
    01-OCT-2012:01:20:53 IBE Incoming cust_account_id is 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
    01-OCT-2012:01:20:53 IBE Incoming quote_header_id is 18529
    01-OCT-2012:01:20:53 IBE User id obtained from environment is: -1
    01-OCT-2012:01:20:53 IBE p_save_type is :6
    01-OCT-2012:01:20:53 IBE Entered Validation...T
    01-OCT-2012:01:20:53 IBE no sharee number
    01-OCT-2012:01:20:53 IBE quote_source_code of cart passed in=IStore Account
    01-OCT-2012:01:20:53 IBE Owner flow with env. userid: 10/01/2012:01:20:53
    01-OCT-2012:01:20:53 IBE partyId::quotehdrId(9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125,18529)
    01-OCT-2012:01:20:53 IBE End:Expected exception:IBE_Quote_Misc_pvt.validate_user_update
    From this u can see that party id and account is fetched when using jsp. but direct running of procedure not getting these values.
    is there sql api running when accessing through jsp . so that these values are got from session.
    Thanks
    Mark

    Hi,
    I have passed that too . still getting same error.
    IBE_Quote_W1_PVT.SUBMITQUOTEWRAPPER calls IBE_Quote_Checkout_Pvt.submitQuote
    which calls another package
    PROCEDURE Validate_User_Update(
    p_api_version_number IN NUMBER := 1.0
    ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
    ,p_quote_header_id IN NUMBER
    ,p_party_id IN NUMBER := FND_API.G_MISS_NUM
    ,p_cust_account_id IN NUMBER := FND_API.G_MISS_NUM
    ,p_quote_retrieval_number IN NUMBER := FND_API.G_MISS_NUM
    ,p_validate_user IN VARCHAR2 := FND_API.G_FALSE
    ,p_privilege_type_code IN VARCHAR2 := 'F'
    ,p_save_type IN NUMBER := FND_API.G_MISS_NUM
    ,p_last_update_date IN DATE := FND_API.G_MISS_DATE
    ,x_return_status OUT NOCOPY VARCHAR2
    ,x_msg_count OUT NOCOPY NUMBER
    ,x_msg_data OUT NOCOPY VARCHAR2)
    in it like this
    IBE_Quote_Misc_pvt.Validate_User_Update(
         p_init_msg_list => FND_API.G_TRUE
         ,p_quote_header_id => p_quote_Header_Id
         ,p_quote_retrieval_number => p_sharee_number
         ,p_validate_user     => FND_API.G_TRUE
         ,p_privilege_type_code => 'A'
    ,p_save_type => PLACE_ORDER
    ,p_last_update_date => p_last_update_date
    ,x_return_status => x_return_status
    ,x_msg_count => x_msg_count
    ,x_msg_data => x_msg_data
    from this u can see that there no value passed for party id and account id .
    Thanks
    Mark

  • 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

  • Problem regarding the creation of sales order using bapi.

    Hai all,
    I am creating sales order using bapi but i am, get following error messages :
    TYPE ID  NUMBER MESSAGE
    E       VP   112       Please enter sold-to party or ship-to party
    E       V4   219       Sales document  was not changed
    I have entered all the parameters.
    my program is as follows :
    *& Report  ZSD_SALES_ORDER
    REPORT  ZSD_SALES_ORDER.
        Tables
    *table definitions
    TABLES:vbak,      "Sales Document: Header Data
            knvv,     "Customer Master Sales Data
            mara,     "General Material Data
            t001l,    "Plants/Branches
            mvke,     "Sales Data for Material
            vbap,     "Sales Document: Item Data
            konv.     "Conditions (Transaction Data)
        Types
    *type for upload data
    TYPES :BEGIN OF ty_upload,
           matnr(20) TYPE c,                  " Old material number
           quantity(20) TYPE c,               " Cumulative order quantity in sales units
    VALUE TYPE       BAPIKWERT1,
          value(20) TYPE c,                  " Condition value
                 value TYPE konv-kwert,                  " Condition value
    END OF ty_upload.
    *type for final output table
    TYPES :BEGIN OF ty_main,
               bismt  TYPE mara-bismt,    "Old material number
               matnr  TYPE vbap-matnr,    "Material Number
               kunnr  TYPE vbak-kunnr,    "customer number
               auart  TYPE vbak-auart,    "Sales Document Type
               vkorg  TYPE vbak-vkorg,    "Sales Organization
               vtweg  TYPE vbak-vtweg,    "Distribution Channel
               spart  TYPE vbak-spart,    "Division
               vbeln  TYPE vbak-vbeln,    "Sales document
               werks  TYPE marc-werks,    " Plant
               lgort  TYPE mard-lgort,    "Storage Location
               posnr  TYPE vbap-posnr,    "Sales Document Item
               parvw  TYPE vbpa-parvw,    "Partner function
               kwmeng TYPE vbap-kwmeng,   "Cumulative order quantity in sales units
               kschl  TYPE konv-kschl,    "Condition type
              kwert  TYPE konv-kwert,    "Condition value
    KWERT TYPE       BAPIKWERT1,
              kwert(20)  TYPE c,    "Condition value
               waers  TYPE konv-waers,    "Currency
         END OF ty_main.
    *type for old material number
    TYPES: BEGIN OF ty_matnr,
           matnr TYPE mara-matnr,
           bismt TYPE mara-bismt,
           END OF ty_matnr.
    *type for order number
    TYPES :BEGIN OF ty_output,
           vbeln  TYPE vbak-vbeln,       "Sales Document
         END OF ty_output.
        Constants                Begin with C_                           *
    CONSTANTS:
    c_zpmu(4) TYPE c VALUE 'ZPMU',
    c_zpmm(4) TYPE c VALUE 'ZPMM'.
    DATA: c_ch(1) TYPE c VALUE 'X'.
        Data                     Begin with W_                           *
    *global data for validations
    DATA: w_count TYPE i,
          w_vkorg TYPE vbak-vkorg,
          w_vtweg TYPE vbak-vtweg,
          w_spart TYPE vbak-spart,
          w_werks TYPE t001l-werks,
          w_check TYPE c,
          w_itemno TYPE posnr_va,
         W_COND TYPE C.
          w_cond(3) TYPE c.
        Internal tables          Begin with IT_                          *
    *internal table definitions
    DATA : it_upload TYPE STANDARD TABLE OF ty_upload ,
           wa_upload TYPE ty_upload.
    DATA : it_main TYPE STANDARD TABLE OF ty_main,
           wa_main TYPE ty_main.
    DATA: it_matnr TYPE STANDARD TABLE OF ty_matnr,
          wa_matnr TYPE ty_matnr.
    DATA : it_output TYPE STANDARD TABLE OF ty_output.
    Internal table for BAPI.
    DATA: it_bapisdhd1  TYPE STANDARD TABLE OF bapisdhd1,        "Sales and Distribution Document Header
          wa_bapisdhd1 TYPE bapisdhd1.
    DATA: it_bapisditm  TYPE STANDARD TABLE OF bapisditm ,       "Sales and Distribution Document Item
          wa_bapisditm TYPE bapisditm.
    DATA: it_bapiparnr  TYPE STANDARD TABLE OF bapiparnr,        "SD Document Partner: WWW
          wa_bapiparnr TYPE bapiparnr.
    DATA: it_bapischdl  TYPE STANDARD TABLE OF bapischdl,       "Schedule Lines
          wa_bapischdl TYPE bapischdl.
    DATA: it_bapicond TYPE STANDARD TABLE OF bapicond,       "Communication Fields for Maintaining Conditions in the Order
          wa_bapicond TYPE bapicond.
    DATA: it_bapiret2 TYPE STANDARD TABLE OF bapiret2,        "Return Parameter
          wa_bapiret2 TYPE bapiret2.
          Parameters              Begin with PR_                        *
    *selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME .
    PARAMETERS: pr_vkorg TYPE vbak-vkorg OBLIGATORY,
                pr_vtweg TYPE vbak-vtweg  OBLIGATORY,
                pr_spart TYPE vbak-spart  OBLIGATORY,
                pr_kunnr TYPE kna1-kunnr  OBLIGATORY,
                pr_werks TYPE marc-werks  OBLIGATORY,
                pr_lgort TYPE mard-lgort  OBLIGATORY.
    PARAMETERS: pr_auart TYPE vbak-auart OBLIGATORY,
               PR_AUGRU TYPE VBAK-AUGRU OBLIGATORY.
                            pr_augru TYPE vbak-augru.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME.
    PARAMETERS : pr_file TYPE ibipparms-path OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk2.
          At selection-screen                                           *
    AT SELECTION-SCREEN.
      PERFORM f006_validate_vkorg.
      PERFORM f007_validate_vtweg.
      PERFORM f008_validate_spart.
      PERFORM f009_validate_kunnr.
      PERFORM f010_validate_werks.
      PERFORM f011_validate_lgort.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pr_file.
    *for f4 help----
      PERFORM f003_f4_help.
          S T A R T   O F   S E L E C T I O N                           *
    START-OF-SELECTION.
    *for material ,quantity and value upload
      PERFORM f001_upload_file.
    *get data
      PERFORM  f003_get_data.
    *for check the data
      PERFORM f002_check_data .
      PERFORM f004_process.
    *for posting
      PERFORM f005_posting.
    END-OF-SELECTION.
          E N D       O F   S E L E C T I O N                           *
    *&      Form  f001_upload_file
          upload file
    FORM f001_upload_file .
      DATA : lw_fname TYPE string.
      CLEAR lw_fname.
      lw_fname = pr_file.
      REFRESH it_upload.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lw_fname
          filetype                = 'ASC'
          has_field_separator     = c_ch
        TABLES
          data_tab                = it_upload
        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.
      ENDIF.
      LOOP AT it_upload INTO wa_upload.
       wa_upload-value = ( wa_upload-value ) / 10.
       MODIFY it_upload FROM wa_upload.
      ENDLOOP.
    ENDFORM.                    "F001_UPLOAD_FILE
    *&      Form  f003_f4_help
          f4 help
    FORM f003_f4_help .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = pr_file.
    ENDFORM.                    " f003_f4_help
    *&      Form  check_data
          text
    FORM f002_check_data .
      DATA: lw_lines TYPE i.
      DESCRIBE TABLE it_main LINES lw_lines.
      IF lw_lines LE 0.
        RETURN.
      ENDIF.
      SELECT a~matnr
             a~bismt FROM mara AS a INNER JOIN mvke AS b
                   ON amatnr = bmatnr
                   INTO CORRESPONDING FIELDS OF TABLE it_matnr
                   FOR ALL ENTRIES IN it_main
                   WHERE a~bismt = it_main-bismt.
      IF sy-subrc = 0.
        LOOP AT it_main INTO wa_main.
          CLEAR : wa_matnr.
          READ TABLE it_matnr INTO wa_matnr WITH KEY bismt = wa_main-bismt.
          IF sy-subrc = 0.
            MOVE: wa_matnr-matnr TO wa_main-matnr.
          ENDIF.
          MODIFY it_main FROM wa_main TRANSPORTING matnr WHERE bismt = wa_main-bismt.
        ENDLOOP.
      ELSE.
       MESSAGE e000(zmsd) WITH  text-001.
      ENDIF.
    ENDFORM.                    "CHECK_DATA
    *&      Form  F009_validate_vkorg
          text
    FORM f006_validate_vkorg .
      CLEAR w_vkorg.
      SELECT SINGLE vkorg
          INTO w_vkorg FROM tvko
          WHERE vkorg EQ pr_vkorg.
      IF sy-subrc <> 0.
        MESSAGE e000(zmsd) WITH text-012 pr_vkorg.
      ENDIF.
    ENDFORM.                    " F009_validate_vkorg
    *&      Form  f007_validate_vtweg
          text
    FORM f007_validate_vtweg .
      CLEAR:w_vtweg.
      SELECT SINGLE vtweg
           INTO w_vtweg FROM tvtw
           WHERE vtweg EQ pr_vtweg.
      IF sy-subrc <> 0.
        MESSAGE e089(zmsd).
      ENDIF.
    ENDFORM.                    " f007_validate_vtweg
    *&      Form  f008_validate_spart
          text
    FORM f008_validate_spart .
      CLEAR:w_spart.
      SELECT SINGLE spart
            INTO w_spart FROM tspa
            WHERE spart EQ pr_spart.
      IF sy-subrc <> 0.
        MESSAGE e087(zmsd).
      ENDIF.
    ENDFORM.                    " f008_validate_spart
    *&      Form  F010_validate_kunnr
          text
    FORM f009_validate_kunnr .
      DATA: l_kunnr TYPE kunnr.
      CLEAR: w_vkorg, w_vtweg,w_spart.
      SELECT  SINGLE  kunnr FROM  knvv
             INTO l_kunnr
             WHERE  kunnr  = pr_kunnr
             AND    vkorg  = pr_vkorg
             AND    vtweg  = pr_vtweg
             AND    spart  = pr_spart.
      IF sy-subrc <> 0.
       MESSAGE e000(zmsd) WITH text-010 pr_kunnr text-011 pr_vkorg  .
      ENDIF.
    ENDFORM.                    " F010_validate_kunnr
    *&      Form  f010_validate_werks
          text
    FORM f010_validate_werks .
      CLEAR:w_werks.
      SELECT SINGLE werks
            INTO w_werks FROM t001w
            WHERE werks EQ pr_werks.
      IF sy-subrc <> 0.
        MESSAGE e088(zmsd).
      ENDIF.
    ENDFORM.                    " f010_validate_werks
    *&      Form  F011_validate_lgort
          text
    FORM f011_validate_lgort .
      CLEAR:w_werks .
      SELECT   SINGLE werks  FROM  t001l
             INTO w_werks
             WHERE  werks  = pr_werks
             AND    lgort  = pr_lgort.
      IF sy-subrc <> 0.
        MESSAGE e000(zmsd) WITH text-007 pr_lgort text-008 pr_werks .
      ENDIF.
    ENDFORM.                    " F011_validate_lgort
    *&      Form  f003_get_data
          text
    FORM f003_get_data .
      CLEAR wa_main.
      REFRESH it_main.
      LOOP AT it_upload INTO wa_upload.
        CLEAR : wa_main.
        MOVE: wa_upload-matnr     TO  wa_main-bismt,
              wa_upload-quantity  TO  wa_main-kwmeng,
              wa_upload-value     TO  wa_main-kwert,
              pr_vkorg            TO  wa_main-vkorg,
              pr_vtweg            TO  wa_main-vtweg,
              pr_spart            TO  wa_main-spart,
              pr_kunnr            TO  wa_main-kunnr,
              pr_werks            TO  wa_main-werks,
              pr_lgort            TO  wa_main-lgort.
        APPEND wa_main TO it_main.
      ENDLOOP.
    ENDFORM.                    " f003_get_data
    *&      Form  f004_process
          text
    FORM f004_process .
    CLEAR w_check.
    LOOP AT it_main INTO wa_main.
       IF wa_main-matnr = ''.
         WRITE:/ text-006,
                     wa_main-bismt.
         w_check = 1.
       ENDIF.
       IF wa_main-kwmeng = 0.
         WRITE:/ text-005,
                 wa_main-bismt.
         w_check = 1.
       ENDIF.
       IF    pr_auart <> 'ZM01'.
         IF wa_main-kwert IS INITIAL.
           WRITE:/ text-004,
                    wa_main-bismt.
           w_check = 1.
         ENDIF.
       ENDIF.
    ENDLOOP.
    ENDFORM.                    " f004_process
    *&      Form  f005_posting
          text
    FORM f005_posting .
      CLEAR: w_itemno,
             w_cond.
      w_itemno = 10.
      w_cond = 1.
    IF w_check = '' OR w_check = 1.
      wa_bapisdhd1-doc_type = pr_auart.
      wa_bapisdhd1-ord_reason = pr_augru.
      LOOP AT it_main INTO wa_main.
        IF w_cond = 1.
          CLEAR: it_bapiret2,
                 it_bapisditm,
                 it_bapiparnr,
                 it_bapischdl,
                 it_bapicond.
          REFRESH:it_bapiret2,
                  it_bapisditm,
                  it_bapiparnr,
                  it_bapischdl,
                  it_bapicond.
          MOVE: wa_main-vkorg TO wa_bapisdhd1-sales_org,
                wa_main-vtweg TO wa_bapisdhd1-distr_chan,
                wa_main-spart TO wa_bapisdhd1-division.
          wa_bapisdhd1-wbs_eleM = 'Y561.1'.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
            EXPORTING
              INPUT         = pr_kunnr
           IMPORTING
             OUTPUT        = pr_kunnr.
          wa_bapisdhd1-PURCH_NO_S = pr_kunnr.
          wa_bapisdhd1-PURCH_NO_C = pr_kunnr.
        ENDIF.
        MOVE: w_itemno TO wa_bapisditm-itm_number,
               wa_main-matnr TO wa_bapisditm-material,
              wa_main-BISMT TO wa_bapisditm-material,
              wa_main-werks TO wa_bapisditm-plant,
              wa_main-lgort TO wa_bapisditm-store_loc.
                           wa_bapisditm-target_qty = '10'.
        wa_bapisditm-PURCH_NO_S = pr_kunnr.
        wa_bapisditm-PURCH_NO_C = pr_kunnr.
        APPEND wa_bapisditm TO it_bapisditm.
        IF w_cond = 1.
          wa_bapiparnr-partn_numb = pr_kunnr.
          wa_bapiparnr-itm_number = 10.
            wa_bapiparnr-partn_role = 'SP'.
          APPEND wa_bapiparnr TO it_bapiparnr.
          wa_bapiparnr-partn_role = 'AG'.
          APPEND wa_bapiparnr TO it_bapiparnr.
          CLEAR wa_bapiparnr-partn_role.
                   wa_bapiparnr-partn_numb = pr_kunnr.
          wa_bapiparnr-partn_role = 'RE'.
          APPEND wa_bapiparnr TO it_bapiparnr.
          CLEAR wa_bapiparnr-partn_role.
                   wa_bapiparnr-partn_numb = pr_kunnr.
          wa_bapiparnr-partn_role = 'RG'.
          APPEND wa_bapiparnr TO it_bapiparnr.
          CLEAR wa_bapiparnr-partn_role.
                   wa_bapiparnr-partn_numb = pr_kunnr.
          wa_bapiparnr-partn_role = 'WE'.
          APPEND wa_bapiparnr TO it_bapiparnr.
        ENDIF.
        wa_bapischdl-itm_number = w_itemno.
        wa_bapischdl-req_qty    = wa_main-kwmeng.
         wa_bapischdl-PURCH_NO_S = pr_kunnr.
        APPEND wa_bapischdl TO it_bapischdl.
        wa_bapicond-itm_number = w_itemno.
        wa_bapicond-cond_type  = 'ZECL'.
         IF    ( wa_bapisdhd1-doc_type = 'ZPMU' ) OR ( wa_bapisdhd1-doc_type = 'ZPMM' ).
           wa_bapicond-cond_type  = 'ZVAL'.
         ELSE.
           wa_bapicond-cond_type  = 'ZMRP'.       "+PK12122006
         ENDIF.
        wa_bapicond-cond_value = wa_main-kwert.
        APPEND wa_bapicond TO it_bapicond.
        w_itemno = w_itemno + 10.
        w_cond   = w_cond + 1.
      ENDLOOP.
      data : SALESDOCUMENTIN like BAPIVBELN-VBELN.
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
          order_header_in     = wa_bapisdhd1
        IMPORTING
          salesdocument       = SALESDOCUMENTIN
        TABLES
          return              = it_bapiret2
          order_items_in      = it_bapisditm
          order_partners      = it_bapiparnr
          order_schedules_in  = it_bapischdl
          order_conditions_in = it_bapicond.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = c_ch.
    ENDIF.
      LOOP AT it_bapiret2 INTO wa_bapiret2.
        DATA : w_err(100) TYPE c,
        w_matnr TYPE matnr.
        IF wa_bapiret2-type = 'E' AND wa_bapiret2-id = 'V1' AND wa_bapiret2-number = 392.
          UNPACK wa_bapiret2-message_v1 TO w_matnr.
          READ TABLE it_matnr INTO wa_matnr WITH KEY matnr = w_matnr.
          IF sy-subrc EQ 0.
            CONCATENATE text-013 wa_matnr-bismt INTO w_err SEPARATED BY space.
            MESSAGE w_err TYPE 'S'.
          ENDIF.
        ENDIF.
        IF WA_BAPIRET2-TYPE = 'S'.  " Comment
          WRITE: 40 TEXT-009, WA_BAPIRET2-MESSAGE_V2+0(10).
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " f005_posting
    I have given all the necessary parameters. it is telling that error is in parameter
    sales_header_in.
    I have checked it.
    i have assigned purch_no_s and purch_no_c of the structure BAPISDHD1(ORDER_HEADER_IN)
    in the bapi with customer number.
    and also i have assigned the partnumber of the structure BAPIPARNR ORDER_PARTNERS
    in the bapi with customer number.
    but still , it is diplaying the error message, please enter the sold to or ship to party number.
    how to resolve this error.
    this is urgent requirement.
    points will be awarded.
    thanking u in advance,
    a.srinivas.

    Hi,
    Did u have a look at the standard programs which make use of BAPI_SALESORDER_CREATEFROMDAT1
    Heres a list...
    LWSSOU08                     
    MV45WF0S                     
    MWWMJF21_BAPI_SALESORDER_CREAT
    RBUS2032                    
    Regards,
    Tanveer.
    <b>Please mark helpful answers</b>

  • 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

  • How to update sales orders using B1WS in SAP 8.8 PL18

    Hello all.
    We are having a problem updating sales orders using Sap Business One Web Service ( B1WS ).
    We are running SBO 8.8 PL18, MS-SQL 2008, and all is fine when using the SBO client.
    But when it comes to updating sales orders through B1WS we just cannot get it to work.
    We can add new orders easily without problems. Updating orders always gives this error:
    \[ORDR.PayDuMonth\]\[line: 0\] , 'Field cannot be updated (ODBC -1029)'
    We have checked and verified multiple times that our setup is correct.
    Also the WDSL files are verified.
    We can update orders just fine using the sboclient.
    And using B1WS we can basically do everything, besides updating.
    We have also tried this on different company db's, so we are quite sure this is not
    something related to some general setting we missed, but who knows?
    We have tried different ways to "assemble" the order before updating, but it always
    ends with the above error.
    Here is an example of one of the tests, where we load an order by docentry,
    increment the quantity of all open lines by '1', and then try to update it.
            protected void Page_Load(object sender, EventArgs e)
                // First we login
                string sessionId = "";
                LoginService.LoginService l_login = new LoginService.LoginService();
                LoginService.LoginDatabaseType l_dbtype = LoginService.LoginDatabaseType.dst_MSSQL2008;
                LoginService.LoginLanguage _lang = LoginService.LoginLanguage.ln_English;
                string _server = "SAP-8_8PL18";
                string _licserver = "SAP-8_8PL18:30000";
                string _db = "my_test_company";
                string _user = "manager";
                string _pass = "********";
                try
                    sessionId = l_login.Login(_server, _db, l_dbtype, true, _user, _pass,
                               _lang, true, _licserver);
                catch (Exception ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                if (sessionId == "")
                    Response.Clear();
                    Response.Write("No sessionId");
                    Response.End();
                // We are logged in and have a sessionId
                // Now load a valid open order by docentry
                try
                    OrdersServiceRef.OrdersService orderService = new OrdersServiceRef.OrdersService();
                    orderService.MsgHeaderValue = new OrdersServiceRef.MsgHeader();
                    orderService.MsgHeaderValue.SessionID = sessionId;
                    orderService.MsgHeaderValue.ServiceName = OrdersServiceRef.MsgHeaderServiceName.OrdersService;
                    orderService.MsgHeaderValue.ServiceNameSpecified = true;
                    OrdersServiceRef.DocumentParams docParams = new OrdersServiceRef.DocumentParams();
                    docParams.DocEntry = 31; // Docentry of a known open order
                    docParams.DocEntrySpecified = true;
                    OrdersServiceRef.Document order = orderService.GetByParams(docParams);
                    OrdersServiceRef.DocumentDocumentLine line = null;
                    for (int i = 0; i < order.DocumentLines.Length; i++)
                        line = order.DocumentLines<i>;
                        if (line.LineStatus == OrdersServiceRef.DocumentDocumentLineLineStatus.bost_Open)
                            line.Quantity += 1;
                    orderService.Update(order);
                catch (System.Web.Services.Protocols.SoapException ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                catch (Exception ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                Response.Clear();
                Response.Write("All OK");
                Response.End();
    I hope that someone has an idea as to why this happens.
    The customer often changes quantity or adds lines on their orders,
    and the only way to solve it so far has been to make a new order and
    close the old one.
    Thanks in advance
    J. Thomsen

    Hi,
    Welcome you post on the forum.
    Have you checked if you only update a specific line instead of a loop?
    Thanks,
    Gordon

  • 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,

Maybe you are looking for