Maintain serial numbers for total quantity BAPI_GOODSMVT_CREATE  

loop at x_items into line_261.
    line_items-move_type line_261-MVT_TYPE.
    line_items-plant x_sap_plant.
    line_items-stge_loc line_261-LOCATION.
    line_items-MATERIAL line_261-mat.
    clear x_meins.
    select single meins into x_meins from mara where matnr line_261-mat.
    if sy-subrc EQ 0.
      line_items-entry_uom x_meins.
    endif.
    line_items-entry_qnt line_261-qty.
    line_items-orderid x_aufnr.
    collect line_items into t_items_261.
  endloop.
  loop at x_items into line_261 where SN NE space.
      read table t_items_261 into line_items with key material line_261-MAT.
      IF sy-subrc EQ 0.
        v_line sy-tabix.
        line_serial-matdoc_itm v_line.
        line_serial-serialno line_261-SN. “IF WRONG WILL GET ERROR MSG: Maintain serial numbers for total quantity 

        append line_serial to t_serial.
      ENDIF.
  endloop.

  w_header-pstng_date x_post_date.
  w_header-doc_date sy-datum.
  w_header-header_txt 'SPLIT ORDER 261'.
* call bapi
  CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

相关文章