Skip to Content
author's profile photo Former Member
Former Member

BAPI_GOODSMVT_CREATE

Hello.

I am using BAPI BAPI_GOODSMVT_CREATE to make a goods entry movement.

One of the structures in this BAPI is for serial numbers.

Does anyone have an example how to use it?

Thank you

Nuno Silva

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 06:07 PM

    Hi Nuno,

    Please see the FM documentation.

    <i>Serial Number

    Description

    For more information on the individual parameter fields, see the data element documentation in the ABAP Dictionary.</i><i>Serial number

    Default

    If the XSAUT indicator is set in the table parameter GoodsmvtItem, the system automatically determines the serial numbers for an item.

    When creating a goods movement with serial numbers, various scenarios are possible:

    The XSAUT indicator is set:

    if all the serial numbers for an item are to be determined automatically

    if serial numbers have been preset for a partial quantity of an item, but the remaining serial numbers are determined automatically.

    The XSAUT indicator is not set:

    if the serial numbers are preset for the complete quantity of an item.

    if serial numbers are preset for only a partial quantity of an item. However, if you have not specified that the remaining serial numbers are to be determined automatically, an error occurs.

    an error occurs if the number of serial numbers exceeds the quantity for the item.</i>

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      here is with serial numbers...

      DATA: h_goodsmvt_header LIKE bapi2017_gm_head_01.

      DATA: h_goodsmvt_code LIKE bapi2017_gm_code.

      DATA: h_goodsmvt_item LIKE bapi2017_gm_item_create

      OCCURS 0 WITH HEADER LINE.

      DATA: h_goodsmvt_serialnumber LIKE bapi2017_gm_serialnumber

      OCCURS 0 WITH HEADER LINE.

      *Header data

      h_goodsmvt_header-pstng_date = pstng_date.

      h_goodsmvt_header-doc_date = doc_date.

      h_goodsmvt_header-HEADER_TXT = Header text

      h_goodsmvt_header-REF_DOC_NO = Ref Doc #

      *GM_Code 01: Goods receipt for purchase order'.

      h_goodsmvt_code = '01'.

      • Loop on Item materials

      LOOP AT p_order_goodsmvt WHERE NOT material IS INITIAL.

      h_goodsmvt_item-orderid = p_orderid.

      h_goodsmvt_item-mvt_ind = p_order_goodsmvt-mvt_ind.

      h_goodsmvt_item-move_type = p_order_goodsmvt-move_type.

      h_goodsmvt_item-plant = p_plant.

      h_goodsmvt_item-stge_loc = p_stge_loc.

      h_goodsmvt_item-customer = p_order_goodsmvt-customer.

      h_goodsmvt_item-PO_NUMBER = p_order_goodsmvt-PO_NUMBER.

      h_goodsmvt_item-PO_ITEM = p_order_goodsmvt-PO_ITEM.

      • If the there is an amount in the Position text fill it into

      • amount_lc

      if p_order_goodsmvt-item_text = '0.01'.

      h_goodsmvt_item-amount_lc = p_order_goodsmvt-item_text.

      endif.

      h_goodsmvt_item-spec_stock = p_order_goodsmvt-spec_stock.

      CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

      EXPORTING

      input = p_order_goodsmvt-material

      IMPORTING

      output = h_goodsmvt_item-material

      EXCEPTIONS

      length_error = 1

      OTHERS = 2.

      if sy-subrc <> 0.

      h_goodsmvt_item-material = p_order_goodsmvt-material.

      endif.

      h_goodsmvt_item-entry_qnt = p_order_goodsmvt-entry_qnt.

      h_goodsmvt_item-entry_uom = p_order_goodsmvt-entry_uom.

      h_goodsmvt_item-entry_uom_iso = p_order_goodsmvt-entry_uom_iso.

      APPEND h_goodsmvt_item.

      • To populate the serial numbers in case the part is serialized

      v_matitem = v_matitem + 1.

      • SHIFT p_order_goodsmvt-serialno LEFT DELETING LEADING '0'.

      IF NOT p_order_goodsmvt-serialno IS INITIAL.

      h_goodsmvt_serialnumber-matdoc_itm = v_matitem.

      h_goodsmvt_serialnumber-serialno = p_order_goodsmvt-serialno.

      append h_goodsmvt_serialnumber.

      ENDIF.

      ENDLOOP.

      call function 'BAPI_GOODSMVT_CREATE'

      exporting

      goodsmvt_header = h_goodsmvt_header

      goodsmvt_code = h_goodsmvt_code

      tables

      goodsmvt_item = h_goodsmvt_item

      goodsmvt_serialnumber = h_goodsmvt_serialnumber

      return = return_material.

      if return_material[] is initial.

      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

      EXPORTING

      WAIT = h_x.

      endif.

      Regards

      CNU

      Reward points to all helpful answers and close the thread when problem is solved.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 06:07 PM

    HI

    Check the below code for how to call BAPI_GOODSMVT_CREATE:

    • Header Data

    v_header-pstng_date = sy-datum.

    v_header-doc_date = sy-datum.

    • Code Group

    v_gm_code-gm_code = '03'.

    ******Mandatory fields passed into BAPI***

    CLEAR i_items[].

    wa_items-material = wa_mseg1-matnr.

    wa_items-plant = wa_mseg1-werks.

    wa_items-stge_loc = wa_mseg1-lgort.

    wa_items-move_type = wa_mseg1-bwart.

    wa_items-entry_qnt = wa_mseg1-lossquantity.

    wa_items-costcenter = 'SC120300'.

    APPEND wa_items TO i_items.

    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

    EXPORTING

    goodsmvt_header = v_header

    goodsmvt_code = v_gm_code

    • TESTRUN = ' '

    IMPORTING

    goodsmvt_headret = wa_headret

    materialdocument = wa_matdoc

    matdocumentyear = wa_matdocyr

    TABLES

    goodsmvt_item = i_items

    • GOODSMVT_SERIALNUMBER =

    return = i_return_goods .

    Regards

    CNU

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.