BAPI_GOODSMVT_CREATE Error 036

Hi, I didn´t found any solution with this problem, even with search function and in google ;).
I am using BAPI BAPI_GOODSMVT_CREATE for posting GR on PO and I allways get the error: can´t post GR for purchasing order 5012134.
If I execute the BAPI with transaction SE37 it works. And if I GR with MB01 it also works.
Here is the code:
  data:
      L_HEAD     LIKE  BAPI2017_GM_HEAD_01,
      L_CODE     LIKE  BAPI2017_GM_CODE,
      L_TESTRUN  LIKE  BAPI2017_GM_GEN-TESTRUN,
      L_MBLNR    TYPE  BAPI2017_GM_HEAD_RET-MAT_DOC,
      L_MJAHR    TYPE  BAPI2017_GM_HEAD_RET-DOC_YEAR,
      LT_ITEM    TYPE  TABLE OF BAPI2017_GM_ITEM_CREATE,
      wa_item like line of LT_ITEM,
      LT_RETURN  TYPE  TABLE OF BAPIRET2.
  L_HEAD-PSTNG_DATE       = sy-datum.
  L_HEAD-DOC_DATE         = sy-datum.
  L_HEAD-HEADER_TXT       = 'test'.
  L_CODE-GM_CODE = '01'.
  loop at itab.
    wa_item-material = itab-matnr.
    wa_item-plant = itab-werks.
    wa_item-stge_loc = itab-lgort.
    wa_item-move_type = '101'.
    wa_item-po_number = itab-ebeln.
    wa_item-po_item = itab-posnr.
    wa_ITEM-MVT_IND      = 'B'.
    wa_ITEM-ENTRY_QNT    = itab-MENGE.
    append wa_item to lt_item.
  endloop.
  CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
      GOODSMVT_HEADER  = L_HEAD
      GOODSMVT_CODE    = L_CODE
     TESTRUN          = L_TESTRUN
   IMPORTING
     MATERIALDOCUMENT = L_MBLNR
     MATDOCUMENTYEAR  = L_MJAHR
    TABLES
      GOODSMVT_ITEM    = LT_ITEM
      RETURN           = LT_RETURN.
  IF SY-SUBRC = 0.
   COMMIT WORK AND WAIT.
  ENDIF.
=> I don´t have any idea how to solve the problem. As I just enter the same values in SE37 and it works. If i debug the returnmessage gives me the error code E 036.
Anyone has an idea?
Best regards,
Christian

Hi,
thanks for the answer,
but the PO is ready for GR. I can GR with MB01 or with this BAPI and SE17.
And I don´t need to uncomment this commit line, because I debug and I see the returning table with error. He doesn´t post anything, even with commit. I already tried it.
Edited by: Christian Schoenen on Feb 2, 2010 4:10 PM

Similar Messages

  • BAPI_GOODSMVT_CREATE - Error while posting a Material Document

    Hi Experts,
    We are  trying to do the material document posting using the transaction "MB1C" manually in SAP. The movement type which we are using for the same is "261".  While doing this is, it is asking for a work order number and the Recipient number. We gave the Recipient Number as "123". Material document is created successfully.
    Again using the same transaction  "MB1C" , we are trying to do the reversal of the material document which we posted previously against another work order number for the same material and the serial number if the material is serialised and as well as for the non serialised material.
    Both this case, in SAP the material document is created succesfully. This is done manually in SAP.
    When we are trying to create the material document using the BAPI 'BAPI_GOODSMVT_CREATE', for the above scenario, posting the material document '261' movement type for one work order and the reversal for another work order '262' movement type for the same material (whether it is a serialised or non serialised) we are getting the eror as "RE Qty. transferred exceeded 1 PC: 50,003,695 C001 USED 1200".
    We are passing the following at the item level. MATERIAL Number, Plant, STGE_LOC, ENTRY_QNT, MOVE_TYPE, BATCH, ORDERID, RESERV_NO,  RES_ITEM, ACTIVITY, XSTOB for reversal.
    We are passing the GM_CODE as '05'.
    Please let us know what needs to be changed inorder to create the material document properly without getting errors.
    Thanks in Advance,
    Mohan.

    Hi,
    We fixed this issue by removing the reservation number of the material when we are trying to post the material document with the movement type "262".
    The reason for removing the reservation number for the movement type "262"
    The reservation number is getting created against a work order when we trying to create the work order in IW32. This reservation number is used for validating the stock while we are trying to consume and doing the reversal.
    SAP is allowing us to reverse the consumed quantities only based on the reservartion number and hence we got this error.
    To fix this error, if we are trying to reverse a particular material against a different work order for which it has been consumed previiously, remove the reservation number and item number and try posting the material document.
    Hope this solution will solve your issue:)
    Thanks and Regards,
    Mohan.

  • BAPI_GOODSMVT_CREATE ERROR: A System Error Has Occurred While Locking

    Hi All,
    I am having a problem with a Z program that I am writing.
    Basically, it uses the BAPI mentioned in the title. The program will read excel file that is being uploaded, and then will segregate the line items by 200 lines.
    That means, if I were to upload 1000 line items, the BAPI will be called and executed 5 times (1000/200 = 5).
    However, when trying to upload 10000 line items, I received this error after around 3000 line items.
    "A system error has occurred while locking".
    This happens when IMPORT parameter TEST_RUN is set to 'X'.
    I found this after some googling: http://sap.ittoolbox.com/groups/technical-functional/sap-basis/lock-entry-system-error-1674434
    I am hoping for your expert thoughts on this.
    Thank you.

    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:\sapdata\TEST.txt'.
    parameters: e-file like rlgrap-filename default
                                     'c:\sapdata\gdsmvterror.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.
    Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 10:20 AM

  • Transfer QI stk to blocked stk with BAPI_GOODSMVT_CREATE (Error msg QA495)

    Hy,
    I would like to create an mass udpate stock program which  transfer the QI stock to blocked (because shelf expiration date is passed).
    So, i use the BAPI_GOODSMVT_CREATE with movement type 350.
    But the following error message appears : "Change the inspection stock of material XXXXXXX to QM only"
    Does anyone can suggest me an another solution ?
    Thanks in advance

    Dear LudovicBento
    You cannot run this FM as QM stock can be  moved only by QA11 tcode. You may try to create a BDC to post the material
    from Quality
    Regards
    Gajesh

  • BAPI_GOODSMVT_CREATE error: Enter the date of production.

    Hi,
    Referring to the subject, I am getting error when i try to use BAPI_GOODSMVT_CREATE to do "Goods Receipts for Prod Order".
    The error is asking me to "Enter the date of production".
    GM_CODE has been assigned to 02. Posting date and doc date are set to local date.
    As for the GOODSMVT_ITEM parameter, I am passing in plant, storage loc, quantity, movement type, batch no, delivery note, CO production order, movement indicator and propose quantities.
    Anyone encounter this error before? Please share your experience and perhaps the solution.
    Thanks.

    hi
    give production date which is in the line of item
    and if u dont want to do that and u have rights to change in spro then plz do folloing 
    go to OMJX there u will find field prod date just make it display
    reward if useful
    regards
    kunal

  • BAPI_GOODSMVT_CREATE  error

    Hi all, 
    I m having a issue in BAPI_GOODSMVT_CREATE for  mb1b  , when i execute it in se37 it works fine n  update database also but when i  try to run it in se38 with text fiel it gives error message type  E  ID  M3  message " mat 80356 is not maintained in  plant 1000 , i m not able to undersatnd why thsi is happening in se38 only , can anybody suggest what could be the posssible error.
    i tried by passing mat as 80356 and 00000080356.
    thanks
    regards
    sarabjit
    Edited by: sarabjit.kaur on Dec 3, 2009 6:09 AM

    Hi,
        you better use  TRANSLATE  MATNR TO UPPER CASE then use that material in BAPI it will definitely work,because the material will be saved in Upper case,so this problem will come.check out my program(Initial Stock Upload)
    loop at it_mat INTO wa_mat.
    PERFORM date_conv USING wa_mat-bldat CHANGING bapi_head-PSTNG_DATE.
    PERFORM date_conv USING wa_mat-budat CHANGING bapi_head-DOC_DATE.
    bapi_head-HEADER_TXT = wa_mat-bktxt.
    bapi_code-GM_CODE    = '05'.
    LOOP at it_data INTO wa_data WHERE sgtxt = wa_mat-sgtxt.
    wa_item-MATERIAL = wa_Data-matnr.
    wa_item-PLANT = wa_data-werks.
    wa_item-STGE_LOC = wa_data-lgort.
    wa_item-BATCH = wa_data-charg.
    wa_item-MOVE_TYPE = wa_data-bwart.
    PERFORM date_conv USING wa_data-vfdat CHANGING wa_item-EXPIRYDATE.
    *wa_item-EXPIRYDATE = wa_data-vfdat.
    wa_item-ENTRY_QNT = wa_data-erfmg.
    wa_item-ITEM_TEXT = wa_data-sgtxt.
    wa_item-AMOUNT_LC = wa_data-amt_lc.
    APPEND wa_item to  it_item.
    endloop.
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        GOODSMVT_HEADER               = bapi_head
        GOODSMVT_CODE                 = bapi_code
    IMPORTING
       MATERIALDOCUMENT              = MATDOC
       MATDOCUMENTYEAR               = matyr
      TABLES
        GOODSMVT_ITEM                 = it_item
        RETURN                        = it_ret
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
                 WAIT          = 'X'
      CLEAR:matdoc,matyr,bapi_head,bapi_code,wa_item,wa_ret,wa_data,wa_mat.
      refresh:it_item,it_ret.
      ENDLOOP.
    Regards,
    Manesh.R
    Edited by: manesh ramachandran on Dec 3, 2009 12:13 PM

  • BAPI_GOODSMVT_CREATE - Error Storage location not supported...

    Dear All
    I am creating the material movement documetn 561 (MB1C) using BAPI_GOODSMVT_CREATE.
    Howeever, the BAPI returns me the error saying
    Storage location not supported. 
    What is this about.  Can someone give me hint
    I searched the forum and not able to find it.
    Regards,
    Venky

    Hi Venky,
    Are you creating a goods issue with reference to a reservation? If so, the documentation states that the storage location is only needed if it's not in the reservation.
    The following fields may have to be populated in some cases (this is not a complete list):
    Storage location (if not planned in the reservation)
    Brenda

  • BAPI_GOODSMVT_CREATE - error for movement type 343 (movement code - 04)

    Hi Gurus,
    I am using BAPI_GOODSMVT_CREATE for doing transfer posting MB1B.
    I need to do transfer posting using movement type - 343 "Blocked to Unrestricted stock"
    Movement type - 343
    GOODSMVT_CODE - 04 (transfer posintg)
    I am getting error message -
    E /CWM/MM              001 Transfer the parallel entry quantity/entry unit of measure
    Help me with some pointers.
    Thanks,
    Madan

    Rajesh,
    Here is my code for line items:
    MATERIAL                       100001374
    PLANT                          1AAE
    STGE_LOC                       B100
    BATCH                          0111331309
    MOVE_TYPE                      343
    ENTRY_QNT                                10.000
    ENTRY_UOM                      EA
    Let me know should I need to fill any other fields.
    Thanks,
    Madan

  • BAPI_GOODSMVT_CREATE error messages

    Hi,
      I'm using BAPI_GOODSMVT_CREATE for Goods issue. I'm trying to find out the possible error conditions when using this BAPI. But I'm not able to get te list of error return messages given by this BAPI. My program is calling this BAPI. To prepare an unit testing plan for my program I need a list of errors given my this BAPI.
    In the BAPI documentation the following is mentioned: "Messages are returned in the Return parameter. The parameter documentation shows the return codes and their meanings"
    But I'm not able to get or locate the return codes and their meanings. Can I get some help on how to get this list of return codes and their meanings?
    Thank you...
    Priya.

    just let me know the values  of the return table ? if u are not getting the any messgaes from the BAPI , so there is no probs with ur coding.
    check the sample Code
    * Post Document
      call function 'BAPI_GOODSMVT_CREATE'
           exporting
                goodsmvt_header       = l_gheader
                goodsmvt_code         = '05'
           importing
                goodsmvt_headret      = l_goodsmvt_headret
                materialdocument      = l_materialdocument
                matdocumentyear       = l_matdocumentyear
           tables
                goodsmvt_item         = i_gitem
                return                = i_return.
    if i_return[] is initial.
    commit work and wait.
    call function 'DEQUEUE_ALL'.
    if sy-subrc = 0.
    write: l_materialdocument.
    endif.
    clear i_gitem[].
    else.
    format color col_negative .
    write: 'Input File Contains Following Errors'.
    format reset.
    loop at i_return.
    write:/'Row No ', i_return-row , i_return-message .
    endloop.
    endif.

  • BAPI_GOODSMVT_CREATE error messages,  when I use Movement Type '541'

    Hello,
    I am using "BAPI_GOODSMVT_CREATE".It was working fine when i was creating a GR against Purchase Order.
    Now i am trying to create GR against subcontracting purchase order
    but it is giving Error "No goods receipt possible for purchase order"
    The following is my soucre code:
      GT_CODE-GM_CODE = '04'.
      GT_HEADER-PSTNG_DATE = SY-DATUM.          
      GT_HEADER-DOC_DATE   = SY-DATUM.         
      GT_ITEM-PLANT      = 'p001'.     
      GT_ITEM-STGE_LOC   = 'w03'.            
      GT_ITEM-MOVE_TYPE  = '541'.           
      GT_ITEM-STCK_TYPE  = SPACE.             
      GT_ITEM-ENTRY_QNT  = '10'.      
      GT_ITEM-PO_NUMBER  = '4500000188'.         
      GT_ITEM-PO_ITEM    = '00010'.               
      GT_ITEM-MVT_IND    = 'B'.                      
       APPEND GT_ITEM.
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
        EXPORTING
          GOODSMVT_HEADER       = GT_HEADER
          GOODSMVT_CODE         = GT_CODE
         IMPORTING
            GOODSMVT_HEADRET    = GT_HEAD_RET        
          TABLES
          GOODSMVT_ITEM         = GT_ITEM
        GOODSMVT_SERIALNUMBER = GT_SNO
          RETURN                = GT_RETURN.
      COMMIT WORK.
    Pls help me out...
    thanks
    Regards,
    Samuel Liu

    Hi jxlmh,
    1. No goods receipt possible for purchase order"
    This is not a program error.
    2. Its a functional message / error.
    3. Please contact the functional guy.
    4. Also try to manually enter the same data 
       via migo transaction.
    (at this point, also, it will give the same error)
    regards,
    amit m.

  • BAPI_GOODSMVT_CREATE - Error - RE Qty. transferred exceeded 1 PC

    Hi Experts,
    We are  trying to do the material document posting using the transaction "MB1C" manually in SAP. The movement type which we are using for the same is "261".  While doing this is, it is asking for a work order number and the Recipient number. We gave the Recipient Number as "123". Material document is created successfully.
    Again using the same transaction  "MB1C" , we are trying to do the reversal of the material document which we posted previously against another work order number for the same material and the serial number if the material is serialised and as well as for the non serialised material.
    Both the case is done manually in SAP, and the material document is created succesfully.
    When we are trying to create the material document using the BAPI 'BAPI_GOODSMVT_CREATE', for the above scenario, posting the material document '261' movement type for one work order and the reversal for another work order '262' movement type for the same material (whether it is a serialised or non serialised) we are getting the eror as "RE Qty. transferred exceeded 1 PC: 50,003,695 C001 USED 1200".
    We are passing the following at the item level. MATERIAL Number, Plant, STGE_LOC, ENTRY_QNT, MOVE_TYPE, BATCH, ORDERID, RESERV_NO,  RES_ITEM, ACTIVITY, XSTOB for reversal.
    We are passing the GM_CODE as '05'.
    Please let us know what needs to be changed inorder to create the material document properly without getting errors.
    It is urgent since we are at the production stage.
    Thanks in Advance,
    Mohan

    Hi Sagar,
    Thanks for your reply.
    We tried with the option what you have suggested. If we use the movement type 262 and if we remove the XSTOB flag, the material document is created for the movement type 261 and not for the reversal movement type 262. This is the standard behaviour of the BAPI.
    If we pass the movement type as 261 and the flag as 'X', it is throughing the same error as we were mentioning. If we use the movement type as 262 and the flag as 'X' still the same error is returned by the BAPI.
    We tried with the GM_CODE as well. Presently we are using '05' and we tried with '06' as well. Still we are getting the same issue.
    Please suggest some other options to fix this bug.
    Thanks,
    Mohan.

  • BAPI_GOODSMVT_CREATE error - Duplicate Transfer Posting

    Hello,
    I'm using BAPI_GOODSMVT_CREATE for transfer posting with GM Code 04 and Movement Type 311.
    But the posted material document is incorrect. Instead of 2 lines only, the line items becomes 4.
    Could anyone please help me?
    Thanks in advance!

    Hi Gold Yap,
          I have done the Transfer posting by using BAPI_GOODSMVT_CREATE.
         Below i added my sample code. Please go through.
    Report XYZ.
    TABLES : mslb , mchb .
    DATA : BEGIN OF i_stock OCCURS 0 ,
           matnr LIKE mslb-matnr ,
           werks LIKE mslb-werks ,
           charg LIKE mslb-charg ,
           sobkz LIKE mslb-sobkz,
           lifnr LIKE mslb-lifnr ,
           lblab LIKE mslb-lblab ,
           END OF i_stock .
    DATA : BEGIN OF i_batch OCCURS 0 ,
           matnr LIKE mchb-matnr ,
           werks LIKE mchb-werks ,
           lgort LIKE mchb-lgort ,
           charg LIKE mchb-charg ,
           clabs LIKE mchb-clabs ,
           END OF i_batch .
    DATA: BEGIN OF it_mess OCCURS 10,
          charg LIKE mslb-charg ,
          lgort LIKE mchb-lgort,
          lifnr LIKE mslb-lifnr,
          err LIKE bapiret2-message,
          flag,
          END OF it_mess.
    DATA match.
    DATA :  header LIKE bapi2017_gm_head_01 . "OCCURS 0 WITH HEADER LINE .
    DATA :  code LIKE bapi2017_gm_code .  " OCCURS 0 WITH HEADER LINE .
    DATA :  item LIKE bapi2017_gm_item_create OCCURS 0 WITH HEADER LINE.
    DATA : i_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE .
    DATA : matdoc LIKE bapi2017_gm_head_ret .
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME .
    SELECT-OPTIONS : s_matnr FOR mslb-matnr .
    PARAMETERS : p_werks LIKE mslb-werks DEFAULT 'TPFB' .
    SELECTION-SCREEN END OF BLOCK b1 .
    AT SELECTION-SCREEN OUTPUT .
      LOOP AT SCREEN .
        IF screen-name = 'P_WERKS' .
          screen-input = '0' .
          MODIFY SCREEN .
          CLEAR screen .
        ENDIF.
      ENDLOOP .
    START-OF-SELECTION .
      CLEAR: i_stock[],i_stock.
      CLEAR: it_mess[],it_mess.
      CLEAR: i_batch[],i_batch.
      SELECT matnr werks charg sobkz lifnr  lblab
      FROM mslb INTO TABLE i_stock
      WHERE matnr IN s_matnr
        AND werks = p_werks.
      DELETE i_stock WHERE sobkz <> 'O'.
      DELETE i_stock WHERE lblab <= '0.000'.
      IF i_stock[] IS INITIAL .
        MESSAGE 'NO Data Available In MSLB Table' TYPE 'S' .
      ELSE.
        DELETE i_stock WHERE charg = 'COMMON' .
        IF i_stock[] IS INITIAL .
          MESSAGE 'Already Transfer Posting to Common Batch' TYPE 'S' .
        ENDIF.
      ENDIF .
      SELECT matnr werks lgort charg clabs
      FROM mchb
      INTO TABLE i_batch
      WHERE matnr IN s_matnr
        AND werks = p_werks .
      DELETE i_batch WHERE clabs <= '0.000'.
      IF i_batch[] IS INITIAL .
        MESSAGE 'NO Data Available In MCHB Table' TYPE 'S' .
      ELSE .
        DELETE i_batch WHERE charg = 'COMMON' .
        IF i_batch[] IS INITIAL .
          MESSAGE 'Already Transfer Posting to Common Batch' TYPE 'S' .
        ENDIF.
      ENDIF .
      CLEAR : header,code,matdoc  .
      header-pstng_date  = sy-datum.
      header-doc_date    = sy-datum.
      header-pr_uname    = sy-uname.
      header-header_txt  = 'Transfer Posting'.
      code-gm_code       = '04'.
      SORT i_batch BY matnr werks charg.
      LOOP AT i_batch.
        CLEAR: item[],item.
        item-material        = i_batch-matnr.
        item-plant           =  i_batch-werks.
        item-batch           = i_batch-charg.
        item-entry_qnt       =  i_batch-clabs .
        item-stge_loc        = i_batch-lgort .
        item-move_type       = '309'.
        item-move_batch = 'COMMON'.
        APPEND item .
        CLEAR item .
        match = 'X'.
        PERFORM bapi_run USING match.
      ENDLOOP.
      LOOP AT i_stock .
        CLEAR: item[],item.
        item-material        = i_stock-matnr.
        item-plant           =  i_stock-werks.
        item-batch           = i_stock-charg.
        item-vendor          =  i_stock-lifnr .
        item-entry_qnt       =  i_stock-lblab .
        item-move_type       = '309'.
        item-spec_stock      =  'O'.
        item-move_batch = 'COMMON'.
        APPEND item .
        CLEAR item .
        match = 'Y'.
        PERFORM bapi_run USING match.
      ENDLOOP.
      IF i_stock[] IS NOT INITIAL OR i_batch[] IS NOT INITIAL .
        IF it_mess[] IS INITIAL.
          MESSAGE 'Transfer Posted Successfully' TYPE 'S' .
        ELSE.
          SORT it_mess BY charg err.
          WRITE:/2 'Batch',11'Location',20'Vendor'.
          LOOP AT it_mess.
            AT NEW charg.
              SKIP.
            ENDAT.
            IF it_mess-flag = 'X'.
              WRITE: /2 it_mess-charg COLOR 6, it_mess-lgort COLOR 3
                     INTENSIFIED OFF,it_mess-lifnr COLOR 2 INTENSIFIED OFF.
            ENDIF.
            WRITE: /10 it_mess-err.
          ENDLOOP.
        ENDIF.
      ENDIF .
    *&      Form  bapi_run
          text
    -->  p1        text
    <--  p2        text
    FORM bapi_run USING match .
      CLEAR: i_return[],i_return.
      CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
        EXPORTING
          goodsmvt_header = header
          goodsmvt_code   = code
        TABLES
          goodsmvt_item   = item
          return          = i_return.
      IF i_return[] IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = 'X'.
      ELSEIF i_return[] IS NOT INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        LOOP AT i_return WHERE type = 'E'.
          it_mess-charg = i_stock-charg.
          IF match = 'X'.
            it_mess-lgort = i_batch-lgort.
          ELSEIF match = 'Y'.
            it_mess-lifnr = i_stock-lifnr.
          ENDIF.
          it_mess-err   = i_return-message.
          IF sy-tabix = 1.
            it_mess-flag = 'X'.
          ENDIF.
          APPEND it_mess.
          CLEAR  it_mess.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " bapi_run
    Regards,
    S.C.K

  • BAPI_GOODSMVT_CREATE Error - The material does not exist or is not activatd

    Scenario is to make a Goods Receipt on a material which is being imported from external sources.
    There is a purchase order created for this already in SAP.
    From MII we are using standard BAPI - BAPI_GOODSMVT_CREATE and passing the fields below:
    GM_Code - 01 since it is a goods receipt
    Psting_date - current date
    Material - material code given by SAP
    Plant - Plant code on which GR takes place.
    Move_type - 101 because it is a GR
    Entry_Qnt - 1
    PO_number - Purchase order which is created in SAP
    When I pass these details to the standard BAPI I get a return message - " The material 10xxxxxxxx does not exist or is not activated"
    Not sure where I am going wrong.
    Any help is highly appreciated.

    Thanks for your reply Vinod...
    Well.. I am calling this BAPI from Netweaver MII and I just see the request and response tags to which I pass the required values to BAPI request fields.
    I am not sure how to call this FM which you are refering to, can you please elobrate a bit or is there any guide I am refer to?

  • Error 036

    Why I cannot move(or copy) a file between external HD ( I was able to do till yesterday) ?
    The HD from origin is NTFS formatted while the destination is FAT32.
    I promise: I never had troubles till yesterday.
    Is anyone having a solution for this?
    Many thanks

    Do you have some kind of 3rd party app for that? A Mac can't natively write to NTFS.
    Try running Disk Utility and the repair option on the FAT drive. Also, how big is the file you're trying to transfer? If it's bigger than 4GB that's your problem. If you have files bigger than 4GB you want ext FAT, not FAT 32.

  • Error on Goods Receipt

    Hi, please help. I'm getting the following error while doing goods receipt using BAPI.
    BAPI: BAPI_GOODSMVT_CREATE
    Error: "Material document data and PO data do not match".
    Please help.
    Regards.

    Hi Swathi,
    Could you please elaborate on your previous statement, as I am completely lost.
    Regards.

Maybe you are looking for