BAPI_GOODSMVT_CREATE help

hi guys,  i have 10 lines in my internal table. i want to create two stock movements.First movement will consist of the first 5 lines and the second movement,the rest 5 lines.I am getting an error message for the second movement  'Impossible to execute MF MB_CREATE_GOODS_MOVEMENT.can anyone please help me on this?

Hi
Check it. hope it will help you.
Pls reward if help.
REPORT ZRICH_0001 .
Structures for BAPI
DATA: GM_HEADER  TYPE BAPI2017_GM_HEAD_01.
DATA: GM_CODE    TYPE BAPI2017_GM_CODE.
DATA: GM_HEADRET TYPE BAPI2017_GM_HEAD_RET.
DATA: GM_ITEM    TYPE TABLE OF
                 BAPI2017_GM_ITEM_CREATE WITH HEADER LINE.
DATA: GM_RETURN  TYPE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: GM_RETMTD  TYPE BAPI2017_GM_HEAD_RET-MAT_DOC.
CLEAR: GM_RETURN, GM_RETMTD. REFRESH GM_RETURN.
Setup BAPI header data.
GM_HEADER-PSTNG_DATE = SY-DATUM.
GM_HEADER-DOC_DATE   = SY-DATUM.
GM_CODE-GM_CODE      = '04'.                                " MB1A
Write 971 movement to table
CLEAR GM_ITEM.
MOVE '412'                 TO GM_ITEM-MOVE_TYPE     .
MOVE 'Q'                 TO GM_ITEM-SPEC_STOCK.
MOVE '3800533484'  TO GM_ITEM-MATERIAL.
MOVE '1'     TO GM_ITEM-ENTRY_QNT.
*MOVE 'PC'    TO GM_ITEM-ENTRY_UOM.
MOVE '1060'  TO GM_ITEM-PLANT.
MOVE '0007'  TO GM_ITEM-STGE_LOC.
*MOVE '0901'   TO GM_ITEM-MOVE_REAS.
MOVE 'P203601001' TO GM_ITEM-WBS_ELEM.
MOVE 'P203601001' TO GM_ITEM-VAL_WBS_ELEM.
APPEND GM_ITEM.
Call goods movement BAPI
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
     EXPORTING
          GOODSMVT_HEADER  = GM_HEADER
          GOODSMVT_CODE    = GM_CODE
     IMPORTING
          GOODSMVT_HEADRET = GM_HEADRET
          MATERIALDOCUMENT = GM_RETMTD
     TABLES
          GOODSMVT_ITEM    = GM_ITEM
          RETURN           = GM_RETURN.
IF NOT GM_RETMTD IS INITIAL.
  COMMIT WORK AND WAIT.
  CALL FUNCTION 'DEQUEUE_ALL'.
ELSE.
  COMMIT WORK AND WAIT.
  CALL FUNCTION 'DEQUEUE_ALL'.
ENDIF.
WRITE:/ GM_RETMTD.
LOOP AT GM_RETURN.
  WRITE:/ GM_RETURN.
ENDLOOP.
check the BAPI_GOODSMVT_CREATE.
Functionality
You can use this method to create a material document for a goods movement.
You can only create one material document each time you call up the method.
You can use a simulation function before posting the goods movement to check how the data is updated in the database. The standard system is configured so that the goods movement is posted immediately without simulating beforehand.
Ensure that you transfer the data in the same way as it is run in the database, for example,
Material number 18-figure with leading zeros
Batches with uppercase letters
Note that for all transactions/events listed below, the posting date is entered in the header data of the material document. In the BAPI2017_GM_HEAD_01 interface, fill the PSTNG_DATE (import structure GOODSMVT_HEADER) field.
Notes
Authorization check check
In the MM Inventory Management component, the method does not execute any authorization checks.
Note that during a posting of a goods movement, depending on the business transaction of the system, authorization objects of other applications can also be checked.
Transfer
The following information about the material document that is to be created is transferred to the method:
a structure with header data
a structure with the code for the movement
a table with the item data
a table with the serial numbers
The posting is carried out in the SAP R/3 via the MB_CREATE_GOODS_MOVEMENT function module.
Confirmations
Messages are returned in the Return parameter. The parameter documentation shows the return codes and their meanings.
Further Information
The method can only carry out your function if no error messages were generated in the Return table. This is the case if the header data and all the items were processed successfully.
Transaction control is not implemented. The calling program therefore has to execute the Commit Work itself after this method has been successfully called (in other words, if no errors were reported in the Return parameter).
Which fields have to be filled during the various transactions/ events?
The following sample scenarios demonstrate which fields have to be filled for which business transactions/events (code).
There are the following types of transactions/events:
1. GM_Code 01: Goods receipt for purchase order
2. GM_Code 02: Goods receipt for production order
3. GM_Code 03: Goods issue
4. GM_Code 04: Transfer posting
5. GM_Code 05: Other goods receipts
6. GM_Code 06: Reversal of goods movements
7. GM_Code 07: Subsequent adjustment to a subcontract order
Entering the movement indicator
Depending on the transaction, you must enter the following in the movement indicator:
GM_Code 01 (Goods receipt for purchase order): B
GM_Code 02 (Goods receipt for production order): F
For all other transactions, you leave the field blank.
For 1: GM_Code 01: Goods receipt for purchase order
Purchase order known
The following fields have to be filled:
Purchase order
Purchase order item
Movement type
Movement indicator
Quantity in unit of entry
ISO code unit of measurement for unit of entry or
quantity proposal
The following fields may have to be filled in some cases (incomplete listing):
Shelf life expiration date (if it has been configured like this in the system)
Reason for movement (if it has been configured like this in the system)
Batch (if the material is handled in batches and batch numbers are not assigned automatically)
Storage location (if a storage location has not been specified in the purchase order item)
The following fields can be filled (incomplete listing):
Stock type
Item text
Unloading point
Delivery completed indicator
You cannot fill the following fields (incomplete listing):
Account assignment fields (account assignment is adopted from the purchase order)
Reservation
Receiving/issuing material
Receiving/issuing plant
Receiving/issuing storage location
In the case of a purchase order item with the "subcontracting" item category, only the GR item in the interface is to be transferred. The system automatically determines GI items.
Purchase order unknown: Shipping notification known
The following fields have to be filled:
Delivery
Delivery item
Movement type
Other fields, such as those under "Purchase order known". The system determines the relevant purchase order item via the delivery/delivery item.
Purchase order unknown: Purchase order should be created automatically
The following fields have to be filled:
Material number
Plant
Storage location
Vendor
Movement type
Movement indicator
Quantity in unit of entry
ISO code unit of measurement for unit of entry
The following fields may have to be filled in some cases (incomplete listing):
Shelf life expiration date (if it has been configured like this in the system)
Reason for movement (if it has been configured like this in the system)
Batch (if the material is handled in batches and batches are not assigned automatically)
The following fields can be filled (incomplete listing):
Stock type
Item text
Unloading point
You cannot fill the following fields (incomplete listing):
Account assignment fields (automatic creation of purchase order items with account assignment is not supported)
Reservation
Receiving/issuing material
Receiving/issuing plant
Receiving/issuing storage location
Purchase order unknown: A purchase order should not be created
The following fields have to be filled:
Material number
Plant
Storage location
Vendor
Movement type
Movement indicator
Quantity in unit of entry
ISO code unit of measurement for unit of entry
The following fields may have to be filled in some cases (incomplete listing):
Shelf life expiration date (if it has been configured like this)
Reason for movement (if it has been configured like this)
Batch (if the material is handled in batches and automatic assignment of batch numbers is not set)
The following fields can be filled (incomplete listing):
Special stock indicator
Item text
Unloading point
Goods recipient
The following fields cannot be filled (incomplete listing):
Account assignment fields (automatic creation of purchase order items with account assignment is not supported)
Reservation
Receiving/issuing material
Receiving/issuing plant
Receiving/issuing storage location
Receiving/issuing batch
The input combinations listed above for the GM_CODE 01 can be combined within an input table so that they can be posted in a material document. Items can also be posted for different purchase orders, provided that all the purchase orders refer to the same vendor.
Transfer of subcontracting components
During the posting of the ordered material of a subcontract order with movement type 101, for the transfer of the subcontracting components, the filled unique identification of the document line (LINE_ID) is also required.
More information on LINE_ID and PARENT_ID
The following fields have to be filled for the components:
Unique identification of the document line
Identification of the immediately superior line
Material number
Plant
Storage location
Quantity in unit of entry
The following fields can be filled for the components:
All other fields in the method that are included in this list.
The following fields cannot be filled for the components:
All fields that are not included in the list above. The movement indicator must be initial.
Additional fields in goods-receipt-based invoice verification
When you post a goods receipt to purchase order with movement type 102, an issue with reference to a previously posted goods issue, the following fields must also be transferred:
REF_DOC_IT (LFPOS): Item of a reference document
REF_DOC (LFBNR): Document number of a reference document
REF_DOC_YR (LFBJA): Fiscal year of a reference document
Only when you transfer these fields is it guaranteed that the reference to the original goods movement stay the same.
For 2 GM_Code 02: Goods receipt for production order
The following fields have to be filled:
Order
Movement type
Movement indicator
Quantity in unit of entry
ISO code unit of measurement for unit of entry or
quantity proposal
The following fields may have to be filled in some cases (incomplete listing):
Shelf life expiration date (if the system has been configured like this)
Reason for movement (if the system has been configured like this)
Batch (if the material is handled in batches and automatic batch number assignment is not set)
Storage location (if storage location has not been specified in the order)
The following fields can be filled (incomplete listing):
Order item (co-product)
Stock type
Item text
Unloading point
"Delivery completed" indicator
The following fields cannot be filled (incomplete listing):
Account assignment fields (the account assignments are adopted from the purchase order)
Reservation
Receiving/issuing material
Receiving/issuing plant
Receiving/issuing storage location
Receiving/issuing batch
For 3 GM_Code 03: Goods issue
Goods issue without reference to a reservation
The following fields have to be filled:
Material number
Plant
Storage location
Movement type
Movement indicator
Quantity in unit of entry
ISO code unit of measurement for unit of entry
The following fields may have to be filled in some cases (incomplete listing):
Special stock (e.g. sales order, project, vendor etc.)
Shelf life expiration date (if the system is configured like this)
Reason for movement (if the system has been configured like this)
Batch (if the material is handled in batches and automatic batch number assignment is not set)
Account assignment fields
The following fields can be filled (incomplete listing):
Special stock indicator
Item text
Unloading point
Goods recipient
The following fields cannot be filled (incomplete listing):
Reservation
Receiving/issuing material
Receiving/issuing plant
Receiving/issuing storage location
Receiving/issuing batch
Goods issue with reference to a reservation
The following fields have to be filled:
Reservation number
Reservation item
Record type of the reservation
Movement indicator
Quantity in unit of entry
ISO code unit of measurement for unit of entry
The following fields may have to be filled in some cases (incomplete listing):
Shelf life expiration date (if this has been configured in the system)
Reason for movement (if this has been configured in the system)
Batch (if the material is handled in batches and automatic batch number assignment is not set)
Storage location (if not planned in the reservation)
The following fields can be filled (incomplete listing):
Special stock indicator
Item text
Unloading point
Goods recipient
The following fields cannot be filled (incomplete listing):
Movement type
Material
Plant
Account assignment fields
For 4 GM_Code 04: Transfer posting
Transfer posting without reference to a reservation
The following fields have to be filled:
Material number
Plant
Storage location
Movement type
Movement indicator
Quantity in unit of entry
ISO code unit of measurement for unit of entry
The following fields may have to be filled in some cases (incomplete listing):
Receiving material
Receiving plant
Receiving storage location
Receiving batch (if material is handled in batches and you want to change batches)
Receiving/issuing special stock (e.g. sales order, project, vendor etc.)
Shelf life expiration date (if this has been configured in the system)
Reason for movement (if this has been configured in the system)
Batch (if the material is handled in batches and automatic batch number assignment is not set)
The following fields can be filled (incomplete listing):
Special stock indicator
Item text
Account assignment fields (for automatic posting lines: Expense/income from stock transfer)
The following fields cannot be filled (incomplete listing):
Reservation
Transfer posting with reference to a reservation
See goods issue with reference to a reservation
For 5 GM_Code 05: Other goods receipts
Other goods receipt without reference to a reservation
See goods issue without reference to a reservation
Other goods receipt with reference to a reservation
See goods issue with reference to a reservation
For 6 GM_Code 06: Reversal of goods movements
You can use the Cancel method to reverse goods movements. But you may also want to cancel a goods movement without referring to a material document (see the Cancel method).
If you want to work without referring to the document, you have to fill the field BAPI_GM_ITEM_CREATE-XSTOB in the interface (import table GOODSMVT_ITEM). In this case, the system converts the movement type assigned in the interface to the reversal movement type. Alternatively, you can set the reversal movement type in the interface. In this case, the BAPI_GM_ITEM_CREATE_XSTOB field must be transferred blank.
If you want to cancel a goods movement with reference to a reservation (without using the Cancel method) you can only transfer the field BAPI_GM_ITEM_CREATE_XSTOB if it is filled. Movement types are not transferred when you post with reference to a reservation, as the movement type is contained in the reservation item.
For 7. GM_Code 07: Subsequent adjustment to a subcontract order
Ordered material of subcontract order
The following fields have to be filled:
Unique identification of document line (can be assigned to anything)
Posting date in document header
Document number of purchasing document
Item number of purchasing document
Material number check
Plant check
Movement type (select movement type 121)
Movement indicator (must be O)
Further entries are not allowed. The entry quantity for the ordered material of a subcontract order must be zero.
Components
The following fields have to be filled:
Unique identification of document line (can be assigned to anything)
Identification of the immediately superior line
Plant
Material number check
Quantity in unit of entry; can also be negative
The following fields can be filled:
Storage location
All other fields in the method that are included in this list.
The following fields may not be filled:
All fields that are not in the list above. The movement indicator must be blank.
More information on LINE_ID and PARENT_ID
Additional fields in goods-receipt-based invoice verification
When you post a subsequent adjustment, the following fields must also be transferred:
REF_DOC_IT (LFPOS): Item of a reference document
REF_DOC (LFBNR): Document number of a reference document
REF_DOC_YR (LFBJA): Fiscal year of a reference document
Only when you transfer these fields is it guaranteed that the reference to the original goods movement stays the same.

Similar Messages

  • Urgent help in BAPI_GOODSMVT_CREATE

    REPORT ztest.
    DATA: gmove_header LIKE bapi2017_gm_head_01,
    gmove_code LIKE bapi2017_gm_code.
    DATA: BEGIN OF gmove_line OCCURS 0.
    INCLUDE STRUCTURE bapi2017_gm_item_create.
    DATA: END OF gmove_line.
    DATA: headret LIKE bapi2017_gm_head_ret,
    matdoc TYPE bapi2017_gm_head_ret-mat_doc,
    docyear TYPE bapi2017_gm_head_ret-doc_year.
    DATA: BEGIN OF return OCCURS 0.
    INCLUDE STRUCTURE bapiret2.
    DATA: END OF return.
    gmove_header-pstng_date = sy-datum.
    gmove_header-doc_date = sy-datum.
    gmove_header-pr_uname = sy-uname.
    gmove_code-gm_code = '01'.
    loop at itab.
    gmove_line-move_type = '101'.
    gmove_line-plant = itab-werks.         " '5000'.
    gmove_line-mvt_ind = 'B'.
    gmove_line-po_number = itab-ebeln. " 2200000015
    gmove_line-po_item = itab-ebelp      " 10.
    gmove_line-entry_qnt = itab-qty.      " 1.
    gmove_line-entry_uom = 'EA'.
    gmove_line-stge_loc = itab-lgort.      " '5003'.
    APPEND gmove_line.
    endloop.
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
    GOODSMVT_HEADER = gmove_header
    GOODSMVT_CODE = gmove_code
    IMPORTING
    GOODSMVT_HEADRET = headret
    MATERIALDOCUMENT = matdoc
    MATDOCUMENTYEAR = docyear
    TABLES
    GOODSMVT_ITEM = gmove_line
    RETURN = return.
    COMMIT WORK AND WAIT.
    When I check the "return" it say's "No goods receipt possible for purchase order 2200000015 00010".
    but iam able to do a GR using MIGO,
    can anyone help me in this issue,
    waiting to reward with points,
    Thanks in advance,
    Prem.

    Use This.
      CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
             EXPORTING
                  GOODSMVT_HEADER  = IHEAD
                  GOODSMVT_CODE    = ICODE
                  TESTRUN          = ' '
             IMPORTING
                  MATERIALDOCUMENT = IMATNUM
                  MATDOCUMENTYEAR  = IMATYR
             TABLES
                  GOODSMVT_ITEM    = IITEM
                  RETURN           = IRETURN.
        IF IRETURN IS INITIAL.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               EXPORTING
                    WAIT   = 'X'
               IMPORTING
                    RETURN = IRETURN.
          MESSAGE S006(RB) WITH 'Doc.No' IMATNUM 'Year' IMATYR.
          LOOP AT IRETURN.
            WRITE :/ IRETURN-MESSAGE.
          ENDLOOP.
      ENDIF.

  • BAPI_GOODSMVT_CREATE not working. help me...

    Hai,
    (Its an user exit. when saving the CO11N this should work).
    I am using BAPI_GOODSMVT_CREATE for CO11N transaction for posting the scrap material to the relevant material for MB1C and movement type 531. When i am doing this , i am getting an error saying that "Function module MB_CREATE_GOODS_MOVEMENT cannot be
    executed".
    Please help me..
    thanks.
    Ashok

    in  source code of the bapi function module bapi_goodsmvt create ..................u will find  MB_CREATE_GOODS_MOVEMENT [ this is again a function module] .........might be the problem is with  MB_CREATE_GOODS_MOVEMENT ......
    go to se37 open the MB_CREATE_GOODS_MOVEMENT  and see weather this function module is active or not...................

  • Need help for BAPI_GOODSMVT_CREATE

    Hello,
    I am using the BAPI, BAPI_GOODSMVT_CREATE to generate a material document for goods issue against a Stock Transfer Order(movement type 351). The GM_CODE passed to the BAPI for this is 04.
    My doubt is, when a material document is created using this BAPI with this GM_CODE, the transaction code shown in the MIGO display of the material document generated is MB1B. But when we do the goods issue manually against a STO, the transaction code shown in MIGO display is MIGO_GI.
    Why there is a change in transaction code when we do it using a BAPI and manually? Whether this change is acceptable and if not what should I do to change it?
    Regards,
    Abijith

    Transaction code of GM_CODE is picked from configuration table T158G (MMIM: Possible Codes for BAPI Goods Movement). See line number 53 of BAPI
    select single * from t158g where gmcode = goodsmvt_code.

  • Help with BAPI_GOODSMVT_CREATE

    I am trying to post a goods receipt from a PO using BAPI_GOODSMVT_CREATE.  The material document gets created, but no output form gets generated.  If I do the goods receipt through MB01, everything works correctly.  I have gv_bapi2017_gm_head-ver_gr_gi_slip = '1' and gt_bapi2017_gm_item-nb_slips = 1.  Any thoughts?

    HI,
    See the below program, you may get solutions,
    <b>BAPI_GOODSMVT_CREATE to post Goods Movement :-</b>
    * BAPI TO Upload Inventory Data
    * GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
    *                      02 - MB31 - Goods Receipts for Prod Order
    *                      03 - MB1A - Goods Issue
    *                      04 - MB1B - Transfer Posting
    *                      05 - MB1C - Enter Other Goods Receipt
    *                      06 - MB11
    * Domain: KZBEW - Movement Indicator
    *      Goods movement w/o reference
    *  B - Goods movement for purchase order
    *  F - Goods movement for production order
    *  L - Goods movement for delivery note
    *  K - Goods movement for kanban requirement (WM - internal only)
    *  O - Subsequent adjustment of "material-provided" consumption
    *  W - Subsequent adjustment of proportion/product unit material
    report zbapi_goodsmovement.
    parameters: p-file like rlgrap-filename default
                                     'c:sapdataTEST.txt'.
    parameters: e-file like rlgrap-filename default
                                     'c:sapdatagdsmvterror.txt'.
    parameters: xpost like sy-datum default sy-datum.
    data: begin of gmhead.
            include structure bapi2017_gm_head_01.
    data: end of gmhead.
    data: begin of gmcode.
            include structure bapi2017_gm_code.
    data: end of gmcode.
    data: begin of mthead.
            include structure bapi2017_gm_head_ret.
    data: end of mthead.
    data: begin of itab occurs 100.
            include structure bapi2017_gm_item_create.
    data: end of itab.
    data: begin of errmsg occurs 10.
            include structure bapiret2.
    data: end of errmsg.
    data: wmenge like iseg-menge,
          errflag.
    data: begin of pcitab occurs 100,
            ext_doc(10),           "External Document Number
            mvt_type(3),           "Movement Type
            doc_date(8),           "Document Date
            post_date(8),          "Posting Date
            plant(4),              "Plant
            material(18),          "Material Number
            qty(13),               "Quantity
            recv_loc(4),           "Receiving Location
            issue_loc(4),          "Issuing Location
            pur_doc(10),           "Purchase Document No
            po_item(3),            "Purchase Document Item No
            del_no(10),            "Delivery Purchase Order Number
            del_item(3),           "Delivery Item
            prod_doc(10),          "Production Document No
            scrap_reason(10),      "Scrap Reason
            upd_sta(1),            "Update Status
          end of pcitab.
    call function 'WS_UPLOAD'
      exporting
        filename                      = p-file
        filetype                      = 'DAT'
    * IMPORTING
    *   FILELENGTH                    =
      tables
        data_tab                      = pcitab
    * EXCEPTIONS
    *   FILE_OPEN_ERROR               = 1
    *   FILE_READ_ERROR               = 2
    *   NO_BATCH                      = 3
    *   GUI_REFUSE_FILETRANSFER       = 4
    *   INVALID_TYPE                  = 5
    *   OTHERS                        = 6
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      exit.
    endif.
    gmhead-pstng_date = sy-datum.
    gmhead-doc_date = sy-datum.
    gmhead-pr_uname = sy-uname.
    gmcode-gm_code = '01'.   "01 - MB01 - Goods Receipts for Purchase Order
    loop at pcitab.
      itab-move_type  = pcitab-mvt_type.
      itab-mvt_ind    = 'B'.
      itab-plant      = pcitab-plant.
      itab-material   = pcitab-material.
      itab-entry_qnt  = pcitab-qty.
      itab-move_stloc = pcitab-recv_loc.
      itab-stge_loc   = pcitab-issue_loc.
      itab-po_number  = pcitab-pur_doc.
      itab-po_item    = pcitab-po_item.
      concatenate pcitab-del_no pcitab-del_item into itab-item_text.
      itab-move_reas  = pcitab-scrap_reason.
      append itab.
    endloop.
    loop at itab.
      write:/ itab-material, itab-plant, itab-stge_loc,
              itab-move_type, itab-entry_qnt, itab-entry_uom,
              itab-entry_uom_iso, itab-po_number, itab-po_item,
                                                  pcitab-ext_doc.
    endloop.
    call function 'BAPI_GOODSMVT_CREATE'
      exporting
        goodsmvt_header             = gmhead
        goodsmvt_code               = gmcode
    *   TESTRUN                     = ' '
    * IMPORTING
        goodsmvt_headret            = mthead
    *   MATERIALDOCUMENT            =
    *   MATDOCUMENTYEAR             =
      tables
        goodsmvt_item               = itab
    *   GOODSMVT_SERIALNUMBER       =
        return                      = errmsg
    clear errflag.
    loop at errmsg.
      if errmsg-type eq 'E'.
        write:/'Error in function', errmsg-message.
        errflag = 'X'.
      else.
        write:/ errmsg-message.
      endif.
    endloop.
    if errflag is initial.
      commit work and wait.
      if sy-subrc ne 0.
        write:/ 'Error in updating'.
        exit.
      else.
        write:/ mthead-mat_doc, mthead-doc_year.
        perform upd_sta.
      endif.
    endif.
    *       FORM UPD_STA                                                  *
    form upd_sta.
      loop at pcitab.
        pcitab-upd_sta = 'X'.
        modify pcitab.
      endloop.
      call function 'WS_DOWNLOAD'
        exporting
          filename                      = p-file
          filetype                      = 'DAT'
    * IMPORTING
    *   FILELENGTH                    =
        tables
          data_tab                      = pcitab
    * EXCEPTIONS
    *   FILE_OPEN_ERROR               = 1
    *   FILE_READ_ERROR               = 2
    *   NO_BATCH                      = 3
    *   GUI_REFUSE_FILETRANSFER       = 4
    *   INVALID_TYPE                  = 5
    *   OTHERS                        = 6
    endform.
    Regards
    Sudheer

  • Help in BAPI_GOODSMVT_CREATE

    Hi frnds,
    I m facing problem while calling bapi BAPI_GOODSMVT_CREATE in my badi , i m passing all the required parameter, and after that perform commit operation,
    but it is giving error message as follows,
    The function module MB_CREATE_GOODS_MOVEMENT is called up for the  
    second time. After it was called up the first time, the function   
    module MB_POST_GOODS_MOVEMENT was called, but a COMMIT WORK was not
    carried out in the calling program.                                
    As running the two function modules again would result in the      
    database being incorrectly updated, processing is terminated.      
    System Response Procedure Please ensure that a COMMIT WORK is set  
    after you call up the function module MB_POST_GOODS_MOVEMENT.      
    Thanks and Regards,
    Mahesh.

    Hi,
         iF you are working for IS-OIL Reqirement there is no BAPI will work as per  OSS note 607156.
    Please go thru
    17.02.2007 Page 1 of 4
    SAP Note Number 607156
    Goods movements in IS OIL: MB_CREATE_GOODS_MOVEMENT
    Note Language: English Version: 3 Validity: Valid from 23.01.2006
    Summary
    Symptom
    WARNING: This is an IS-OIL / IS-MINE-specific note. If you DON'T *
    have IS-OIL / IS-MINE installed on your system, this note does *
    not apply to you. If this note is applied and you do not have *
    IS-OIL / IS-MINE installed, you could cause serious damage to *
    your system. *
    This note provides information on how function module
    MB_CREATE_GOODS_MOVEMENT is used in IS-Oil systems in conjunction with
    IS-Oil materials (that is, those materials that carry a UoM group in the
    oil-specific view in the material master data, MARA-CMETH = 1 or 2).
    A ) In general, in the case of goods movements for IS-Oil materials, the
    additional quantities for these materials must be posted in parallel for
    every goods movement. The additional stock levels must also be updated
    using these quantity values.
    There are two possible ways to do this:
    a) The additional quantities and parameters are passed to
    function module MB_CREATE_GOODS_MOVEMENT through the following IS-Oil
    specific table parameters:
    T_MS1INT STRUCTURE MSEGO1 OPTIONAL
    T_MS2INT STRUCTURE MSEGO2 OPTIONAL
    b) The additional quantities are CALCULATED and posted through function
    module
    MB_CREATE_GOODS_MOVEMENT and processed using the default parameters
    that are determined for each line item that contains an IS-Oil material.
    In general, SAP does NOT support the second way (b) for calling function
    module MB_CREATE_GOODS_MOVEMENT. In the past there have been some
    exceptions to this to ensure seamless integration of important
    business processes used in the oil & gas industry.
    With 4.6C Service Pack 2, these exceptions are delivered as entries
    in an SAP table:
    Table TOIBCALC_INTRN is delivered with 8 entries that enable
    posting of IS-Oil material movements through function module
    MB_CREATE_GOODS_MOVEMENT, without passing the additional quantities
    (and parameters) through the interface of MB_CREATE_GOODS_MOVEMENT.
    The entries delivered with table TOIBCALC_INTRN are:
    PROG1 EVENT1 PROG2 EVENT2
    RM06ELLB POST_GOODS_ISSUE RM06ELLB ATUSER-COMMAND
    SAPLCOCI COCI_CONFIRM_MATERIAL_CONS
    SAPLCOCI COCI_CONFIRM_MATERIAL_PROD
    SAPLCOFW CO_FW_GOODS_MOVEMENTS_BY_AFFW
    17.02.2007 Page 2 of 4
    SAP Note Number 607156
    Goods movements in IS OIL: MB_CREATE_GOODS_MOVEMENT
    SAPLCORF CO_RU_GOODS_MOVEMENT
    SAPLWPUE POS_SALES_DOCUMENT_PROCESS
    SAPLWPUE POS_SALES_TURNOVER_PROCESS
    SAPMQEVA BUCHE_BESTAENDE
    NOCALC BLTIME_SET
    D X
    D X
    D X
    D X
    D X
    X X
    X X
    D X
    The call stack of a calling program is analyzed (PROG1, EVENT1, PROG2,
    EVENT2) and if it is found in the table as a valid entry, the
    additional quantities are calculated, either in the background
    (NOCALC = X) or whereby the classic dialog box appears on the screen
    (NOCALC = D). The posting time is either left unchanged
    (BLTIME_SET = INITIAL) or determined based on the logic that can be
    found in include OI_LMBWLFOI_HPM (BLTIME_SET = X).
    B) SAP core BAPI using function module MB_CREATE_GOODS_MOVEMENT:
    SAP has - so far - not enhanced all core BAPIs to enable the processing
    of additional industry solution specific (IS-OIL) data fields.
    (see SAP Note 365386 for important details).
    However, due to the fact that some core BAPIs use function module
    MB_CREATE_GOODS_MOVEMENT from different calling applilcations, the
    customer may observe that with one BAPI, postings for IS-Oil materials
    are possible, yet with another BAPI, the postings are rejected.
    Example:
    You can execute the BAPI BAPI_PRODORDCONF_CREATE_HDR using an IS-Oil
    material but not BAPI BAPI_GOODSMVT_CREATE.
    Since BAPI BAPI_PRODORDCONF_CREATE_HDR calls function module
    CO_RU_GOODS_MOVEMENT, which is contained in table TOIBCALC_INTRN,
    the posting is based on the default data and additional quantities
    are calculated. In this case, you have to set the conversion mode to
    'Background', otherwise a 'Dynpro not found' error causes a short dump
    (because the entry MOCALC is set to 'D' for dialog).
    As a result of this, the system has been designed to run as it does. In
    general, customers are advised to proceed as outlined in SAP Note 365386.
    On a case by case basis, customers can use table TOIBCALC_INTRN
    and either remove, change, or add entries to achieve consistent
    system behavior.
    17.02.2007 Page 3 of 4
    SAP Note Number 607156
    Goods movements in IS OIL: MB_CREATE_GOODS_MOVEMENT
    With note 736980, the announcement of a new BAPI GoodsMovementOil is made, and
    new BAPI methods are delivered which enable goods movement postings for IS-OIL
    materials.
    More Terms
    o General keywords: add-on, IS-Oil, industry solution,...
    o Problem-specific key words: BAPI, HPM, QCI, additional quantities
    Cause and Prerequisites
    Solution
    Although it is possible to post goods movements for IS-Oil materials (as
    above), SAP does not currently support any core
    BAPIs for posting goods movements with IS-Oil materials.
    Calculating additional quantities in the background is not seen as a
    a general solution.
    On a case by case basis, customers can use table TOIBCALC_INTRN
    and either remove, change, or add entries to achieve consistent
    system behavior.
    Header Data
    Release Status: Released for Customer
    Released on: 23.01.2006 13:26:07
    Priority: Recommendations/additional info
    Category: Consulting
    Main Component IS-OIL-DS-HPM Hydrocarbon Product Management
    Valid Releases
    Software Component Release From
    Release
    To Release and
    Subsequent
    IS-OIL 46C 46C 46C
    IS-OIL 472 472 472
    Related Notes
    17.02.2007 Page 4 of 4
    SAP Note Number 607156
    Goods movements in IS OIL: MB_CREATE_GOODS_MOVEMENT
    Number Short Text
    870106 IS-OIL TDP LI21 postings from WM to MM
    736980 Enhancement of BAPI GoodsMovement for IS OIL
    546569 FAQ : HPM - Hydrocarbon Product Management
    <b>Reward points</b>
    Regards

  • Help - BAPI_GOODSMVT_CREATE on an Inbound Delivery - R/3 4.7

    Can anyone recommend how to get BAPI_GOODSMVT_CREATE working for an INBOUND delivery? I'm in R/3 4.7 and this BAPI does not update the delivery status or the delivery document flow for INBOUND deliveries. I have BAPI_GOODSMVT_CREATE working partially - it successfully creates the goods receipt and the P.O. doc flow is being updated.
    Also, I am executing the COMMIT statement once directly after the FM call.
    It seems the BAPI is not intended to do this functionality.  How have you handled this scenario?

    Dear all
    Bapi BAPI_GOODSMVT_CREATE could be used to post goods receipt against inbound delivery but in consequence no Delivery document flow is updated. This is official SAP explaination.
    But there is solution to accomplish it. After posting goods movements you should update Inbound Delivery using fm SD_DELIVERY_UPDATE.
    Check following coding:
    form process_0112.
      clear post_status.
      post_status-delivery = wa_likp-vbeln.
    * posting
      perform post_goodsreceipt     changing post_status.
      perform post_delivery_hist    changing post_status.
      perform post_transferorder    changing post_status.
    * reversal posting if necessary
      perform reverse_goodsreceipt  changing post_status.
      perform reverse_delivery_hist changing post_status.
    * display message in case of error
      perform issue_message         changing post_status.
    * leave transaction
      leave to transaction sy-tcode.
    endform.                    " process_0112
    form post_goodsreceipt changing post_status structure post_status.
    * DATA DECLARATION
    * material document header
      data: begin of it_head.
              include structure bapi2017_gm_head_01.
      data: end of it_head.
    * T158G special code
      data: begin of it_code.
              include structure bapi2017_gm_code.
      data: end of it_code.
    * material document returned data
      data: begin of it_rthead.
              include structure bapi2017_gm_head_ret.
      data: end of it_rthead.
    * material document items
      data: begin of it_pos occurs 100.
              include structure bapi2017_gm_item_create.
      data: end of it_pos.
    * error table
      data: begin of it_errmsg occurs 10.
              include structure bapiret2.
      data: end of it_errmsg.
    * return data
      data: post_mat_doc  type bapi2017_gm_head_ret-mat_doc,
            post_doc_year type bapi2017_gm_head_ret-doc_year.
    * FILL DATA
    * material document header
      it_head-pstng_date  = sy-datum.           
      it_head-doc_date    = sy-datum.           
      it_head-header_txt  = 'RF'.               
      it_head-pr_uname    = sy-uname.
    * T158G code
      it_code-gm_code     = '01'.
    * material document items
      loop at it_lips into wa_lips where posnr <> space.
        it_pos-mvt_ind              = 'B'.
        it_pos-deliv_numb_to_search = wa_lips-vbeln.
        it_pos-deliv_item_to_search = wa_lips-posnr.
        it_pos-po_number            = wa_lips-vgbel.
        it_pos-po_item              = wa_lips-vgpos.
        it_pos-move_type            = '985'.
        it_pos-entry_qnt            = wa_lips-rv_lfimg.
        append it_pos.
      endloop.
    * CALL BAPI
      refresh: it_errmsg.
      call function 'BAPI_GOODSMVT_CREATE'
        exporting
          goodsmvt_header             = it_head
          goodsmvt_code               = it_code
        importing
          materialdocument            = post_mat_doc
          matdocumentyear             = post_doc_year
        tables
          goodsmvt_item               = it_pos
          return                      = it_errmsg.
    * check result
      if post_mat_doc is initial.
        post_status-post_mat_doc  = space.
        post_status-post_doc_year = space.
        rollback work.
      else.
        post_status-post_mat_doc  = post_mat_doc.
        post_status-post_doc_year = post_doc_year.
        commit work and wait.
      endif.
    endform.                    " post_goodsreceipt
    form post_delivery_hist changing post_status structure post_status.
    * DATA DECLARATION
      data: it_vbfa    like vbfa occurs 0,
            wa_vbfa    like vbfa.
    * CHECK IF UPDATE DELIVERY IS ESSENTIAL
      check not post_status-post_mat_doc  is initial
      and   not post_status-post_doc_year is initial.
    * POPULATE TABLE
      loop at it_lips into wa_lips where posnr <> space.
        clear wa_vbfa.
        wa_vbfa-vbelv = wa_lips-vbeln.
        wa_vbfa-posnv = wa_lips-posnr.
        wa_vbfa-vbeln = post_status-post_mat_doc.
        wa_vbfa-vbtyp_n = 'R'.
        wa_vbfa-vbtyp_v = '7'.
        wa_vbfa-plmin   = '+'.
        select single zeile waers menge dmbtr meins matnr bwart
          from mseg
            into (wa_vbfa-posnn, wa_vbfa-waers,
                  wa_vbfa-rfmng, wa_vbfa-rfwrt,
                  wa_vbfa-meins, wa_vbfa-matnr,
                  wa_vbfa-bwart)
              where mblnr = post_status-post_mat_doc
                and mjahr = post_status-post_doc_year
                and ebeln = wa_lips-vgbel
                and ebelp = wa_lips-vgpos.
        append wa_vbfa to it_vbfa.
      endloop.
    * UPDATE DELIVERY
      data:    begin of yvbfa occurs 0.
                 include structure vbfavb.
      data:    end of yvbfa.
      data:    begin of xvbfa occurs 0.
                 include structure vbfavb.
      data:    end of xvbfa.
      data:    begin of xvttk occurs 0.
                 include structure vttkvb.
      data:    end of xvttk.
      sort it_vbfa by mandt vbelv posnv vbeln posnn vbtyp_n.
      loop at it_vbfa into xvbfa.
        xvbfa-rfmng_flt = xvbfa-rfmng.
        xvbfa-updkz = 'I'.
        append xvbfa.
        at end of vbelv.
          call function 'SD_DELIVERY_UPDATE'
               exporting
                    i_vbtyp          = '7'
                    nicht_sperren    = 'Y'
                    no_imseg_refresh = 'X'
               tables
                    zxvbfa        = xvbfa
                    zyvbfa        = yvbfa
                    zxvttk        = xvttk
               exceptions
                    others        = 1.
          if sy-subrc <> 0.
            exit.
          endif.
          refresh xvbfa.
        endat.
      endloop.
    * check result
      if sy-subrc <> 0.
        post_status-post_deli_hist  = 'R'.
        rollback work.
      else.
        post_status-post_deli_hist  = 'C'.
        commit work and wait.
      endif.
    endform.                    " post_delivery_hist

  • Help to use BAPI_GOODSMVT_CREATE in BAdI MB_DOCUMENT_BADI

    Hi frnds ,
      I want use BAPI_GOODSMVT_CREATE in BAdI MB_DOCUMENT_BADI,
    can any one have any code related this ?
    i have also writeen my code but it is giving error that itab is not an inatertable occurs n misiing , but when i  m creting internal table with occurs staement it is not suppoertd by OO concept.
    Dont worry about points.
    Mahesh.

    Hello
    Use the syntax
    data : itab type table of <xmseg> with header line.
    regards

  • Help with use bapi_Goodsmvt_create

    I follow the ducument of bapi_Goodsmvt_create
    GM_Code 01
    using
    Purchase order  '4500014500'
    Purchase order item  '10'
    Movement type    '101'
    Movement indicator  'B'  (according to the ducument)
    return error "Special Stock B not supported"  WHY?
    Best Regards
    Message was edited by: Sheng Wang

    Hi !!!
      I'm trying to do the same, transaction mb01, movement 101, order purchase.... i fill the next fields:
       MATERIAL
       PLANT   
       STGE_LOC
       STCK_TYPE
       ENTRY_QNT
       PO_NUMBER
       PO_ITEM 
       The system, show the next message:
        E, M7, NUM. 256. 
       Update control movement type incorrect entry (101)
       I don't know if this is a problem of information that
       i give o is a problem of configuratión or i need use
       other bapi for do this.
        You can use this bapi ?
       Can you share your code ?
         Thanks,
        Best Regards !!

  • Error while posting a document using  the  BAPI_GOODSMVT_CREATE

    Hi,
    i was trying to post the Goods Receipt document ( Tcode MB1C) using the bapi  BAPI_GOODSMVT_CREATE
    i am passing the item details and Serial number details.
    the error triggered was Maintain Serial Numbers for Total Quantity
    but i am passing the quantity as 1 ( in item data) and passing one serial number.
    is this error because of data problem or am i missing to pass the value to  some dependent parameter..?
    Please help me out.
    Thanks in advance.
    Sriram

    Hi David,
    i was tring to pass the same.
    in item table we have we have four item details ( below)
    RES_ITEM - Item Number of Reservation/Dependent Requirement
    ORDER_ITNO - Order Item Number
    S_ORD_ITEM - Item Number in Sales Order ( length mismatch with serial  item number)
    PO_ITEM  - Item Number of Purchasing Document ( length mismatch with serial  item number)
    out 4 , 2 are ruled out because of length mismatch. and in the reaming two are
    RES_ITEM - Item Number of Reservation/Dependent Requirement
    ORDER_ITNO - Order Item Number
    this is a Goods receipt document, please let me know which field is required to map with item number in the above two.
    Regards,
    Sriram.

  • Error in Bapi_GoodsMvt_Create using Purchase order

    Hi Friends,
    I am using Bapi_goodsmvt_create for Goods Receipts against Purchase order.
    The below code i have given for Goods receipts
    It shows the error like
    ID : 8J
    Err No.:182
    Message : Entry 4500000344 00040 0000 not valid; correct entry
    Please help me to correct this error.
    Thanks
    Shankar
    ===================================
    Heading Structure
    st_gm_code-gm_code          = '01'.
    st_gm_header-pstng_date = '20070930'.
    st_gm_header-doc_date = '20070930'.
    st_gm_header-gr_gi_slip_no = '970015'.
    st_gm_header-bill_of_lading = '527213'.
    st_gm_header-header_txt = 'AIR'.
    st_gm_header-ref_doc_no = '4500000344'.
    Tables - ITEM CREATE.
    itab_afs_gm_itemx-plant = '2000'.
    itab_afs_gm_itemx-deliv_numb = '80100121'.
    itab_afs_gm_itemx-stge_loc = '2110'.
    itab_afs_gm_itemx-move_stloc = '2110'.
    itab_afs_gm_itemx-po_number = '4500000344'.
    itab_afs_gm_itemx-po_item = '00040'.
    itab_afs_gm_itemx-vendor = '0000650003'.
    itab_afs_gm_itemx-vendrbatch = 'ABC123'.
    itab_afs_gm_itemx-move_type = '101'.
    itab_afs_gm_itemx-mvt_ind = 'B'.
    itab_afs_gm_itemx-material = '000000000030000227'.
    itab_afs_gm_itemx-entry_qnt = 10.
    APPEND itab_afs_gm_itemx .
    ****&& Grid values
    gr_afs-matdoc_itm     = '0001'.
    gr_afs-grid_value = '205'.
    gr_afs-withdrawn_sku = 'X'. "Final issue at sku level
    gr_afs-stock_cat = '0000000001000366'.
    APPEND gr_afs.
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        goodsmvt_header           = st_gm_header
        goodsmvt_code             = st_gm_code
      TESTRUN                     = ' '
    IMPORTING
       goodsmvt_headret           = st_gm_headret
       materialdocument            = mat_doc
       matdocumentyear             =  doc_year
      TABLES
        goodsmvt_item             = itab_afs_gm_itemx
       afs_goodsmvt_sku           = gr_afs
        return                    = bapi_return.
    IF sy-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.
    CLEAR itab_afs_gm_itemx.
    REFRESH itab_afs_gm_itemx.
    CLEAR gr_afs.
    REFRESH gr_afs.

    Hi,
    Here is some sample code from one of my programs, which does a 551 movement type. This should get you started. Just check the RETURN table for messages, they should tell you what you are missing.
    code
    Structures for BAPI
    data: gm_header type bapi2017_gm_head_01.
    data: gm_code type bapi2017_gm_code.
    data: gm_headret type bapi2017_gm_head_ret.
    data: gm_item type table of
    bapi2017_gm_item_create with header line.
    data: gm_return type bapiret2 occurs 0.
    data: gm_retmtd type bapi2017_gm_head_ret-mat_doc.
    clear: gm_return, gm_retmtd. refresh gm_return.
    Setup BAPI header data.
    gm_header-pstng_date = sy-datum.
    gm_header-doc_date = sy-datum.
    gm_code-gm_code = '06'. " MB11
    Write 551 movement to table
    clear gm_item.
    move '551' to gm_item-move_type .
    move '000000000040001234' to gm_item-material.
    move '1' to gm_item-entry_qnt.
    move 'EA' to gm_item-entry_uom.
    move '0004' to gm_item-plant.
    move '4000' to gm_item-stge_loc.
    move '201' to gm_item-move_reas.
    Determine cost center per plant
    case xresb-werks.
    when '0004'.
    move '0000041430' to gm_item-costcenter.
    when '0006'.
    move '0000041630' to gm_item-costcenter.
    when '0007'.
    move '0000041731' to gm_item-costcenter.
    when '0008'.
    move '0000041830' to gm_item-costcenter.
    endcase.
    append gm_item.
    Call goods movement BAPI
    call function 'BAPI_GOODSMVT_CREATE'
    exporting
    goodsmvt_header = gm_header
    goodsmvt_code = gm_code
    importing
    goodsmvt_headret = gm_headret
    materialdocument = gm_retmtd
    tables
    goodsmvt_item = gm_item
    return = gm_return.
    call function 'BAPI_TRANSACTION_COMMIT'
    exporting
    wait = 'X'.
    [/code]
    Welcome to SDN! Please remember to award points for helpful answers and mark you post as solved when solved completely. Thanks.
    REgards,
    Raj.

  • Goods Receipt Report With 101 movement type using bapi_goodsmvt_create

    Dear Abapers,
            i am getting some problem, i got requirement like Goods Receipt Report with 101 movement type using
    bapi_goodsmvt_create and data should upload through excel sheet.
    still facing problems, i have searched sdn forum n sdn code also, but relevant answer i could not find.
    What are all the inputs i need to take and please give some valuable inputs to me.
    please do help ..... thanks for advance..
    Thanks & regards,
    Vinay.
    Moderator message : Spec dumping is not allowed, show the work you have already done. Thead locked.
    Edited by: Vinod Kumar on Sep 27, 2011 10:58 AM

    Dear Abapers,
            i am getting some problem, i got requirement like Goods Receipt Report with 101 movement type using
    bapi_goodsmvt_create and data should upload through excel sheet.
    still facing problems, i have searched sdn forum n sdn code also, but relevant answer i could not find.
    What are all the inputs i need to take and please give some valuable inputs to me.
    please do help ..... thanks for advance..
    Thanks & regards,
    Vinay.
    Moderator message : Spec dumping is not allowed, show the work you have already done. Thead locked.
    Edited by: Vinod Kumar on Sep 27, 2011 10:58 AM

  • BAPI_GOODSMVT_CREATE short dump while posting a GR for inbound delivery

    Dear Experts,
    I am using BAPI_GOODSMVT_CREATE to post a goods receipt for a PO using Inbound Delivery
    here is how I am populating bapi input parameters:
      lw_goodsmvt_code-gm_code = '01'.
      lw_goodsmvt_item-deliv_numb =  lw_inb_delivery_items-delivery.
      lw_goodsmvt_item-quantity = lw_inb_delivery_items-deliv_qty.
      lw_goodsmvt_item-entry_qnt = lw_goodsmvt_item-quantity
      lw_goodsmvt_item-no_more_gr = ''.
      lw_goodsmvt_item-move_type = '101'.
      lw_goodsmvt_item-mvt_ind = 'B'.
      lw_goodsmvt_item-STGE_LOC = '0001'.
        lw_goodsmvt_item-po_number and   lw_goodsmvt_item-po_item are populated as well.
    When I execute the BAPI I get the short dump
    Message Class: 'VL'
    Number = 143
    in the module MB_POST_GOODS_MVT and a reference to 385830 note.
    Would you please help me how to solve this problem?

    from the dump the error orrcurs here:
    CALL FUNCTION 'MB_CREATE_MATERIAL_DOCUMENT_UT'
            EXCEPTIONS
              error_message = 4.
    As soon as we have started to put things into UPDATE TASK, we must
    ensure that errors definitely terminate the transaction.
    MESSAGE A is not sufficient because it can be catched from
    external callers which COMMIT WORK afterwards, resulting in
    incomplete updates. Read note 385830 for the full story.
       IF NOT sy-subrc IS INITIAL.
    >      MESSAGE ID sy-msgid TYPE x NUMBER sy-msgno WITH            "385830
                     sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        MESSAGE A263.
       ENDIF.
    The short text of the error is: Cannot be processed with this transaction.
    Can you tell me if my BAPI Call is correct to post GR in Inbound Delivery?

  • Improve the performance of the 'BAPI_GOODSMVT_CREATE' Bapi

    Hi All,
    We have a requirement in which we create a material document number for each goods receipt note.
    This is done with the help of 'BAPI_GOODSMVT_CREATE' . This BAPI is working perfectly fine and is correctly posting the material document number for each of the goods receipt.
    The problem lies in the fact that this BAPI is geting called for each line item of the Purchase order ie it gets called in a loop , due to which this program is taking much longer time to run.
    Is there any way or any sap notes which we can use to improve the performance of this BAPI .
    Thanks ,
    Sumit

    Hi,
    Why do you call the bapi for each line item. All the line items per document should be processed together.
    The standard code is mostly fine. The performance of these standard transactions generally deteriorates if good programming practices are not used in the user exits/badis available in the standard transaction. Check where is the pain point to figure out where the transaction takes more time.
    Regards,
    Abdullah.

  • Error while using BAPI_GOODSMVT_CREATE

    Hi friends,
                    When I do a 301 movement from MIGO transaction using BAPI BAPI_GOODSMVT_CREATE ..  I m getting an error "The plant material data is locked by the user".. Can you help me out to solve this and post the goods movement.. it is very urgent requirement... Will reward points for helpfull answers,
    Thanks in advance,
    Rama..

    Hi ,
    Check the Following :
    Is your material is being edited by some user via MM02 etc.
    Can you try calling the BAPI FM in Background task ? I guess that might Solve the problem ?
    <b>REWARD IF USEFUL</b>
    Regards,
    Saket Sharma
    null

Maybe you are looking for