Skip to Content
0
Former Member
Mar 23, 2007 at 01:25 PM

'BAPI_SALESORDER_CREATEFROMDAT2' Comp_quant.

37 Views

Hello, there.

I'm trying to create order, with some positions. I've populated field comp_quant as follows, but after sucessfull returning, Quantity field stays null. Please give me some direction to solve this problem.

**************************************************************************

  LOOP AT it_bapi.
    CLEAR gt_order_items_inx.
    CLEAR gt_order_items_in.
    gt_order_items_inx-updateflag = 'I'.
*Matnr
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
      EXPORTING
        input  = it_bapi-mabnr
      IMPORTING
        output = gt_order_items_in-material.
    gt_order_items_inx-material = 'X'.
*Item Position
    gt_order_items_in-itm_number  = sy-tabix * 10.
    gt_order_items_inx-itm_number = 'X'.
*Quantity
    gt_order_items_in-comp_quant = it_bapi-kwmeng.
    gt_order_items_inx-comp_quant = 'X'.
    gt_order_items_inx-target_qty = 'X'.


    APPEND gt_order_items_in.
    APPEND gt_order_items_inx.
  ENDLOOP.
**************************************************************************
*Description

  gt_order_text-itm_number = ''.
  gt_order_text-text_id    = '0002'.
  gt_order_text-langu      = sy-langu.
  gt_order_text-format_col = '*'.
  gt_order_text-text_line  = ctext.
  APPEND gt_order_text.

**************************************************************************

  CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
      order_header_in     = gs_order_header_in
      testrun             = testrun
    IMPORTING
      salesdocument       = gv_salesdocument
    TABLES
      return              = messtab[]
      order_items_in      = gt_order_items_in[]
      order_items_inx     = gt_order_items_inx[]
      order_partners      = gt_order_partners[]
      order_text          = gt_order_text[].