Goods Receipt for PO using BAPI

Hello,
I need to do a goods receipt for a purchase order using bapi_goodsmvt_create for movement type 101. My function module does not return the material document number. Can someone help me with my code?
Thanks,
A.P.
FUNCTION Z_GR_BAPI.
""Local interface:
*"  IMPORTING
*"     REFERENCE(I_CODE) TYPE  GM_CODE
*"     REFERENCE(I_MOVE_TYPE) TYPE  CHAR3
*"     REFERENCE(I_EKKO) TYPE  EKKO
*"  EXPORTING
*"     REFERENCE(E_DOCUMENT) TYPE  BAPI2017_GM_HEAD_RET-MAT_DOC
*"     REFERENCE(E_RETURN) TYPE  BAPIRET2
*"  TABLES
*"      T_EKPO STRUCTURE  EKPO
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.
  data: x_ekpo type table of ekpo with header line.
   x_ekpo[] = t_ekpo[].
  clear: gm_return, gm_retmtd.
  refresh gm_return.
  gm_code-gm_code = i_code.
  gm_header-pstng_date = sy-datum.
  gm_header-doc_date = sy-datum.
  gm_header-pr_uname = sy-uname.
  loop at x_ekpo.
    gm_item-material = x_ekpo-matnr.
    gm_item-plant = x_ekpo-werks.
    gm_item-stge_loc = x_ekpo-lgort.
    gm_item-move_type = i_move_type.
    gm_item-mvt_ind = 'B'.
    gm_item-stck_type = space.
    gm_item-entry_qnt = x_ekpo-menge.
    gm_item-entry_uom = x_ekpo-meins.
  append gm_item.
  endloop.
  CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
      GOODSMVT_HEADER             = gm_header
      GOODSMVT_CODE               = gm_code
     TESTRUN                     = ' '
    IMPORTING
      GOODSMVT_HEADRET            = gm_headret
      MATERIALDOCUMENT            = gm_retmtd
    MATDOCUMENTYEAR             =
    TABLES
      GOODSMVT_ITEM               = gm_item
    GOODSMVT_SERIALNUMBER       =
      RETURN                      = gm_return.
e_document = gm_retmtd.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
         WAIT          = 'X'.
     IMPORTING
        RETURN        =
ENDFUNCTION.

Hi,
This piece of code may be helpful.
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'.
regards,
keerthi.

Similar Messages

  • Missing Goods receipt for inbound using VL32N

    Hello All:
    An inbound was posted into our system (version ECC 6.0) as complete, but the goods receipt shows a zero qty. and value.   I have traced the error that caused this to the value missing on the material master & also the conversion for units of measure was missing for the qty. they entered on the inbound. 
    I have attempted to reverse the Goods receipt but get the error "Qty and / or "delivery completed" ind. or final issue ind. are missing
    Message no. M7264"
    With the Diagnosis listed as:
    Diagnosis
    The quantity and inward delivery completed or final issue indicator are missing for an item, for which a goods movement should be posted via the function module MB_CREATE_GOODS_MOVEMENT.
    My goal is to either reverse this or complete the GR with qty and value within the delivery.  Any advice or help would be greatly appreciated.
    Best regards,
    Laura

    HI ALL,
    I am also facing the same issue. Can any one please help me in this issue.
    Regads,
    Pavan

  • Post Goods Receipt for Inbound Delivery using WHSCON IDoc

    Dear All
    Currently I am working on a big project dealing with EDI connections to our logistics partner for the Export business. The entire message flow between Lindt and our partner should be via EDI. Our SAP release is (still) 4.6c.
    We will create two kinds of despatch advice messages, one for inbound deliveries and one for outbound deliveries for customers.
    I would appreciate your support in the following problem that I am facing with the inbound delivery scenario:
    We create stock transport orders (purchase orders, POs) for the goods intended to be delivered into the plant at our partner
    We create a delivery (type NL = replenishment delivery) for this POs
    As soon as we post the goods issue we send the despatch advice (as EANCOM D96A DESADV message) to our partner.
    At this point the delivery is basically completed, i.e. packing status (PS) and goods movement status (GM / GS) are equal to 'C' (= completed).
    Our logistics partner uses the same EDI message to send us the goods receipts data, e.g.:
    We dispatched 50 units of a product => QTY:50:12
    The partner received indeed 50 units => QVR:50:66
    Please note that we do not use the QVR segment for the quantity difference (between despatched and received quantity) but it contains the received units. This way we avoid negative values in the QVR segment.
    When the logistics partner sends back the DESADV message containing the received quantities (QVR segment) we want to make
    the goods receipts for the products in the original stock transport order and
    upate the message flow in the delivery
    My idea was to transform the incoming DESADV message into a WHSCON.DELVRY03 IDoc based on the documentation in: [Delivery Interface|http://help.sap.com/saphelp_crm40/helpdata/en/e2/654b15a9f411d184ec0000e81ddea0/content.htm]
    In the delivery header control E1EDL18 I used QUALF = 'PGI' (Post goods issue).
    I prepared an inbound WHSCON IDoc according to the documentation mentioned below. I managed to get some feedback from the Idoc processing implying that the system tried to do the goods receipt in the PO but failed.
    To make a long story short here are my questions:
    Can an inbound WHSCON IDoc used for doing both the goods receipt in the PO and the update of the message flow in the delivery?
    Does anybody have an example on how to fill the WHSCON IDoc?
    Or is my approach a cul-de-sac ?
    Kind Regards
       Uwe
    PS: A related question can be found here: Goods Receipt in PO AND Message Flow Update in Inb. Delivery using WMMBXY

    Hi Uwe,
    Can an inbound WHSCON IDoc used for doing both the goods receipt in the PO and the update of the message flow in the delivery?
    The binary answer would be no. You should use WMMBXY or MBGMCR instead.
    But if we are doing goods receipt against Inbound delivery then answer is YES with additionally E1EDL18-QUALF = 'PIC' populated. But please remember no partial receipt is possible against Inbound Delivery.
    We should populate E1EDL20-VBELN with our Inbound delivery number and line item info should go to E1EDL24.
    I have done a similar interface recently where we are doing receipt against Inbound delivery. But our case was a bit complex because we had to support against Inbound delivery. So we had to go for a custom solution on top of IDOC_INPUT_DELVRY.
    Hope this helps. Let me know if you have more questions.
    Regards,
    Rudra

  • BAPI/FM for goods receipt for a Sub Contracting PO

    Hi All,
    Is there a BAPI/FM to perform goods receipt for a sub contracting PO? BAPI_GOODSMVT_CREATE can not perform goods receipt for sub contracting PO.
    My purpose would be served if I can know how to find the component material of a subcontrcting PO.
    Please help.
    Thanks,
    Rana

    Thanks for your input
    Well, I wanted to ask if the BAPI is capable of performing GR for SC PO. Instead of a question, that went as a statement :-). Your recommendation helped me to find answer to my question.
    Thanks again.

  • Goods Receipts for Purchase Order using BAPI_GOODSMVT_CREAT

    Hi experts,
    I am working on the a program where am generating Goods Receipts for Purchase Order. the BAPI_GOODSMVT_CREAT returns an error saying "Material 6003022 not maintained in plant 1001"
    Can any one assist? is there a field I may be missing?
    Here is a sample code.
    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 = '02'.
    " MB1A * Write 971 movement to table CLEAR GM_ITEM.
    MOVE '101' TO gm_item-move_type .
    " MOVE 'Q' TO GM_ITEM-SPEC_STOCK.
    MOVE '6003022' TO gm_item-material.
    MOVE '10' TO gm_item-entry_qnt.
    MOVE 'EA' TO gm_item-entry_uom.
    MOVE '1001' TO gm_item-plant.
    MOVE '' TO gm_item-stge_loc.
    MOVE '0901' TO gm_item-move_reas.
    "  MOVE '4500006877' TO GM_ITEM-WBS_ELEM.
    "  MOVE '0020' TO GM_ITEM-VAL_WBS_ELEM.
    MOVE '0020' TO gm_item-deliv_numb.
    MOVE '4500006881' TO gm_item-po_number.
    MOVE '0010' TO gm_item-po_item.
    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.

    >
    Spark842 wrote:
    > Hi experts,
    > I am working on the a program where am generating Goods Receipts for Purchase Order. the BAPI_GOODSMVT_CREAT returns an error saying "Material 6003022 not maintained in plant 1001"
    >  Can any one assist? is there a field I may be missing?
    >
    > Here is a sample code.
    >
    > 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 = '02'.
    >
    >
    > " MB1A * Write 971 movement to table CLEAR GM_ITEM.
    > MOVE '101' TO gm_item-move_type .
    > " MOVE 'Q' TO GM_ITEM-SPEC_STOCK.
    > MOVE '6003022' TO gm_item-material.
    > MOVE '10' TO gm_item-entry_qnt.
    > MOVE 'EA' TO gm_item-entry_uom.
    > MOVE '1001' TO gm_item-plant.
    > MOVE '' TO gm_item-stge_loc.
    > MOVE '0901' TO gm_item-move_reas.
    > "  MOVE '4500006877' TO GM_ITEM-WBS_ELEM.
    > "  MOVE '0020' TO GM_ITEM-VAL_WBS_ELEM.
    > MOVE '0020' TO gm_item-deliv_numb.
    > MOVE '4500006881' TO gm_item-po_number.
    > MOVE '0010' TO gm_item-po_item.
    > 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.
    My guess, is that this material is not really maintained in the Plant '1001', to be on the safer side, get the exact values from EKPO itself, also check if this material exists in the table MARC for the plant and storage location.
    MOVE '1001' TO gm_item-plant.   "<< Hard coded
    MOVE '' TO gm_item-stge_loc.
    Replace the above hardcodes to something like this to get the actual value from EKPO.
    select werks lgort into (gm_item-plant, gm_item-stge_loc) from ekpo
       where ebeln = gm_item-po_number
            and ebelp = gm_item-po_item.

  • BAPI for goods receipt for subcontracting PO

    Dears,
    I Just want to confirm that whether BAPI "BAPI_GOODSMVT_CREATE " will do the goods receipt for the subcontracting PO. SInce  I will be passing only 101 mvy type in BAPi, will the system automatically call 543 mvt type and post the consumption.
    Require suggestions
    Regards
    Kamesh

    Hi,
    Yes, BAPI_GOODSMVT_CREATE will work for subcontracting GR as well.
    It all depends on the parameters you pass to the BAPI.
    Example give below:
    *Item Parameters to be passed:     
    Ordered (Subcontracting) Material:
    Parameter     Field     Description     Value
    GOODSMVT_ITEM     MATERIAL     Material Number     100-200
         PLANT     Plant     1000
         ENTRY_QNT     Quantity in Unit of Entry     0.000
         MOVE_TYPE     Movement Type     121
         PO_NUMBER     Purchase Order Number     4500000007
         PO_ITEM     Item Number of Purchasing Document     00010
         MVT_IND     Movement Indicator     O
         LINE_ID     Unique identification of document line     000001
         PARENT_ID     Identifier of immediately superior line     000000
    Note: Quantity of ordered material must be zero.
    Component Material 1:
    Parameter     Field     Description     Value
    GOODSMVT_ITEM     MATERIAL     Material Number     100-100
         PLANT     Plant     1000
         ENTRY_QNT     Quantity in Unit of Entry     2.000
         LINE_ID     Unique identification of document line     000002
         PARENT_ID     Identifier of immediately superior line     000001
    Note: LINE_ID should be incremented for each component and the PARENT_ID remains same for all the components of an ordered material. Component negative quantity can be given in case of Under Consumption.
    Component Material 2:
    Parameter     Field     Description     Value
    GOODSMVT_ITEM     MATERIAL     Material Number     100-100
         PLANT     Plant     1000
         ENTRY_QNT     Quantity in Unit of Entry     3.000
         LINE_ID     Unique identification of document line     000003
         PARENT_ID     Identifier of immediately superior line     000001

  • Goods Receipt for Handling Unit using RF

    Hello,
    The customer requirement is to do Goods Receipt for HU in RF. In RF the standard transaction is LM76 for GR for HU.
    The scenario is Multiple handling units are there for each inbound delivery. the client wants to do GR for each HU. where as in
    standard TC: LM76, if one HU is entered GR is done for the entire inbound delivery.
    Can i go for customized transaction (is it possible to develop) in RF where GR is done for each handling unit ( i.e. multiple HU's
    are there in the inbound delivery)
    Regards,
    Neetha

    Hi,
    I've done something similar on RF for a retailer in Holland and used enhancement MWMRFDLV/INCLUDE ZXLHUU31.
    I've added an example of the code that is implemented.
    This enhancement is called by transaction LM61 op to LM66 en LM71 up to LM76.
    Transaction LM76 is initially intended to select the delivery by scanning the HU.
    What I did is reducing the information on the sceen to the HU that has been scanned
    Secondly yo need to assure that when the user is creating a TO or posting the GR it is performed for the HU only.
    For this you need to do additional development mwmrf631 (= Delivery Header / in the PAI define your own logic that post the GR for a single HU) What I used is an outputtype in application V6 (HU) that is triggerred from include ZXLHUU21 and will post the GR with BAPI_GOODSMVT_CREATE'  . See 2nd example include ZXLHuu21
    I hope my comment are usefull for you.
    Kind regards
    Ronald
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    INCLUDE ZXLHUU31
    case sy-tcode.
      WHEN con_lm76.
    inperken OP HU als de levering meerdere Handling Units heeft
    alleen dan inperken op HU informatie
        LOOP AT et_postab WHERE posnr = '000000'.
          SELECT SINGLE anzpk FROM likp INTO et_postab-anzpk
                              WHERE vbeln = et_postab-vbeln.
          MODIFY et_postab.
          IF et_postab-anzpk > 1.
            EXIT.
          ENDIF.
        ENDLOOP.
        CHECK et_postab-anzpk > 1.
        GET PARAMETER ID 'INP_100' FIELD inp_100.
        i_exidv = inp_100.
        IF i_exidv NA sy-abcde.
          et_postab-exidv = i_exidv.
          et_postab-anzpk = 1.
          LOOP AT et_postab WHERE posnr <> '000000'.
            SELECT SINGLE aexidv abrgew b~vemng
                           INTO (et_postab-exidv, et_postab-brgew, et_postab-lfimg)
                                  FROM vekp AS a INNER JOIN vepo AS b
                                  ON avenum = bvenum
                                  WHERE a~exidv    = i_exidv
                                    AND bvenum    = avenum
                                    AND b~vbeln    = et_postab-vbeln
                                    AND b~posnr    = et_postab-posnr.
            MODIFY et_postab.
          ENDLOOP.
          et_postab-anzpk = 1.
          MODIFY et_postab TRANSPORTING exidv brgew anzpk WHERE posnr = '000000'.
          DELETE et_postab WHERE exidv IS INITIAL.
          SORT et_postab BY posnr.
        ENDIF.
    ENDCASE.
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    EXIT_SAPLLMOB_084    INCLUDE ZXLHUU21 .
    *&  Include           ZXLHUU21                                         *
    Initial development by Perfect for People - Ronald Westdijk
    o_current_field         = current_field.
    o_verification_errors[] = verification_errors[].
    SET PARAMETER ID 'BYDLVRY' FIELD LIKP-VBELN.
    CASE sy-tcode.
      WHEN con_lm76.
        CASE sy-ucomm.
          WHEN fcode_save.
    melding alleen geven als meerdere Handling Units bestaan
    en als deze nog moeten worden geboekt.
            SELECT SINGLE anzpk FROM likp INTO i_anzpk
                                WHERE vbeln = likp-vbeln.
            CHECK i_anzpk > '1'.
    check output messages in tabel NAST of deze nog moet worden geboekt.
    melding alleen geven als er nog meerdere HU open staan.
    eerst de HU's ophalen
    daarna de nast records inlezen in i_nast (output ZMCR) en checken
            REFRESH i_nast.
            CLEAR vbco3.
            vbco3-vbeln = likp-vbeln.
            CALL FUNCTION 'SD_PACKING_PRINT_VIEW'
              EXPORTING
                comwa                         = vbco3
                auftrag_nicht_lesen           = 'X'
                exportdaten_nicht_lesen       = 'X'
              TABLES
                vbplk_tab                     = xvbplk
                vbplp_tab                     = xvbplp
                vbpls_tab                     = xvbpls.
            LOOP AT xvbplk.
              SELECT SINGLE * FROM nast INTO i_nast
                              WHERE vstat = '0'
                                AND kappl = 'V6'
                                AND objky = xvbplk-venum
                                AND kschl = 'ZMCR'.
              IF sy-subrc = 0.
                APPEND i_nast.
              ENDIF.
            ENDLOOP.
            DESCRIBE TABLE i_nast LINES n.
            CHECK n > 1.
    message lf317 Het systeem zal de boeking uitvoeren, verder?
            sy-msgid = 'LF'.
            sy-msgno = '317'.
            PERFORM warning_message(rlmob001).
            GET PARAMETER ID 'POX' FIELD msg_answ.
            SET PARAMETER ID 'POX' FIELD ''.
            CASE msg_answ.
              WHEN ver_on.
    output ZMCR after HU to post Goods receipt is executed.
                REFRESH bapihukey.
                bapihukey-hu_exid = i_exidv.
                APPEND bapihukey.
                REFRESH bapioutptype.
                bapioutptype-trans_medium = '8'.
                bapioutptype-output_type  = 'ZMCR'.
                APPEND bapioutptype.
                CALL FUNCTION 'BAPI_HU_PROCESS_MSG_DIRECT'
                  TABLES
                    hukey      = bapihukey
                    outputtype = bapioutptype
                    return     = bapiret2.
                LEAVE TO TRANSACTION con_lm01.
            ENDCASE.
        ENDCASE.
    ENDCASE.

  • Steps For Goods Receipt For Work Order Using Handling Units

    Hello MM gurus,
    I'm new to HU Management.  Can you please share with me the steps for executing a "Goods Receipt For Work Order" using Handling Units?
    I created a HU (1000000026), and then using transaction COWBHUWE I tried using that HU to create a goods receipt, but I keep getting the message below:
    Handling unit 1000000026 is not provided for goods receipt
    Message no. VHURM046
    Do you have to assign/plan HUs to Process Orders first? I think the problem is that I'm not understanding the process or the requirements for a goods receipt for work order using HU.

    Hello Manish Kumar,
    I've been doing Handling Units testing in our sandbox environment and I've been trying to Pack a Finished Product for a Process Order using
    1-Transaction code HU02 to create the Handling Unit
    2-Transaction COWBHUE after creating the HU to enter the production order number and the HU number and propose it, but the it doesn't work. When I propose it, nothing happens.
    3.-I also tried COWBPACK, but for some reason, when I go into COWBPACK, key in the Process Order, and then press enter, I get the following message:
    You do not have authorization to create handling units for plant BP08
    Message no. VHUPD500
    Do you know how to solve this issue?

  • BAPI needed for goods receipt for delivery created from sales order

    Hi experts,
    I need help.
    I want to post goods receipt for the delivery created from sales order. I have tried out BAPI BAPI_GOODSMVT_CREATE but I am not able to post it.
    Is there any way to post this? I need BAPI and not FM MB_*....
    Thanks & REgards,
    Bhavin A. Shah

    Hi,
    Please refer to link,
    https://wiki.sdn.sap.com/wiki/display/Snippets/BAPI_GOODSMVT_CREATE-ABAP
    Regards
    Shree

  • Problem for Goods Receipt for Subcontracting Purchase Order

    Dear all,
    Presently, we are using SAP version 4.6C and we need to introduce GR for
    Subcontracting Purchase Order. We have developed a ABAP program to handle
    subcon Goods Receipt by uploading flat-files from our subcontractor. The
    scenario is as follows :
    Goods Receipt for Subcontracting Purchase Order
    1. In the ABAP program, function BAPI_GOODSMVT_CREATE will be used for goods
    movement.
    2. Data provided to the function are as follows :
    - Posting date
    - Document date
    - Material number
    - Plant
    - Storage location
    - Batch
    - Movement type (101)
    - Quantity
    - Purchase order number
    - Purchase order item
    - Movement indicator (B - Goods receipt for purchase order)
    3. The function will do data verification and automatically determine GI
    item for subcon stock:
    - Movement type (543)
    - Special stock (O - parts prov. vendor)
    - Material
    - Quantity
    - Plant
    Our problem is that :
    Only the GR item in the interface is to be transferred and the GI item is
    determined by the system. So, the quantity for subcon stock cannot be
    changed using this BAPI. Then the system will continue processing the goods
    receipt and create material document.
    Manually, by using transaction code MIGO, the user can display the subcon
    stock data and then change the quantity.
    By using transaction code MB01, after the user fills in all the GR fields,
    the system comes to line item 002 (subcon stock data) and then quantity can
    be changed.
    As per user requirement, quantity for GI item must be same with the quantity
    that has been transferred to subcon vendor in Delivery for Subcon
    (transaction code VL02N).
    We cannot achieve this requirement by using the BAPI mentioned above. Would
    appreciate any valuable help from anyone who is able to help us on this
    matter. Are there any other BAPI's that can help us to achieve the same
    result ?
    Thank you in advance and best regards.

    As far as i understood the problem I suggest u to create the
    BDC according to user actions that are performed in he manual
    operation.
    I can't say that the BAPI performs the exac solution what you want.
    I have done some BDC work using MB01 and suggest you to be careful
    and try to keep the complete in the logic as some chages in rows in BDC will
    change the complete scenario.And throw correct quantity val in correct
    material
    row.
    This methodology will help u even in mass uploads.
    Or in case of automation u can perform the call transaction BDC in
    background mode.
    so As per my understanding bdc program is the solution. pls try and let me
    know.

  • Goods receipt for subcontracting order! BAPI_GOODSMVT_CREATE

    I wanna use BAPI "BAPI_GOODSMVT_CREATE"  to create goods receipt for subcontracting order.
    But it says that this combination is not possible.  Combination of my movement type and this BAPI.
    What can i do to solve it?
    thanks in advance.

    >
    Julia Nikiforva wrote:
    > I wanna use BAPI "BAPI_GOODSMVT_CREATE"  to create goods receipt for subcontracting order.
    > But it says that this combination is not possible.  Combination of my movement type and this BAPI.
    >
    > What can i do to solve it?
    >
    > thanks in advance.
    Might work
    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.

  • Auto goods receipt for STO

    Hi
    We are creating STO without delivery. Goods issue (mvt type 351) for STO is posted via portal using BAPI.
    We then want to post goods receipt for full quantity using movt type 101. Is there any std program available to be used in batch job to post goods receipts for STO? This way we will be able to do auto goods receipts.
    Any help will be highly appreciated.
    Thanks
    Sanjay

    Hi,
    Check the following limks hope it will help you...
    STO Process Automation
    http://help.sap.com/saphelp_47x200/helpdata/en/4d/2b90dc43ad11d189410000e829fbbd/frameset.htm
    Regards,
    Udaya.

  • Doing a goods receipt for a customer material that is ASEQ status

    We are needing to find a way to be able to do a goods receipt for a child part in ASEQ status.  Most of our customers will send in their part after disassembling it themselves.  Since we can not receive the part our present process is to dismantle so the system status changes to ESTO and we can receive.  The problem with this is that the end user forgets to assemble the part back and we end up breaking the linkage.
    We have looked into using User Status in the equipment master and have configured that.  However the user status button, nor name shows up in the equipment master.  I have looked at the field selection in IMG and it is not hidden.  I am assuming it is being supressed by a user exit we have.
    Can anyone give me any suggestions on how we can improve the process using SAP for material that is ASEQ status and being able to create an inbound delivery so we can receive in our warehouse for this status without dismatling the unit? 
    We are on ECC

    Hello Kimberly
    You lost me while describing your current process, so  please provide more details as to how you dismantle and reinstall etc.  Also how the part goes back to the customer.
    However I can provide you  clarifications to some questions you raised..
    You see both system and user statuses in the field 'Status' itself. This is the 3rd row in the Equipment display screen under Equipment number and Description. If you see carefully you will see 2 sections, the one on left is system status and the one on right is User status. If you click on the i (info) icon, you will be taken to a screen where you see more info like status and business processes etc.
    ASEQ is a system status and it is determined by what you did ( example dismantling) and can't be changed by you (user). If you see the 'Business Processes' tab, you will also see the this won't allow assignment to a Delivery and so on. So my point is having a user status will not help you. Based on the combination of system and user statuses, some processes are permitted, some not. For example if Goods Receipts are allowed, may be you can receive without an Inbound delivery.  I am mentioning this as a thought initiator, I know you will have a Return/Repair order process including a return delivery.
    I guess you have to systematically prevent the user from  doing whatever they are doing out of turn, e.g., forgetting to reassemble (install?) and for this User statuses can help.
    Let us know your process more in detail and I am sure SAP will have a standard way to receive a child part of a big assembly. Other members will share their practices also.
    Take care.

  • Transaction BORGR: No tolerance on goods receipt for Kanban calloff

    Hello,
    we have the following situation:
    - MM scheduling agreement with tolerance of 10% for under and overdelivery, production supply "summarized JIT call" is set.
    - KANBAN cycle has 1 empty container with a summarized JIT call for replenishment, quantity 10 pieces.
    - ASN has been created with BORGR transaction, it contains: 1 line item for the material with delivery quantity 9 pieces, assigned to this line item is the JIT call with notified quantity 9 pieces as well.
    My expectation was that the JIT call can be booked with 9 pieces as it is inside the 10% tolerance defined for the scheduling agreement. In addition, I expected the KANBAN container be set to full.
    Instead, the following error message is given:
    'Post GR' carried out without success
    (Message no. BORGR215)
    Because of previous error, dispatching is not possible for ID 0180573431
    (Message no. /SPE/ID_HANDLING011)
    Inbound Delivery 0180573431 00010
    (Message no. BORGR210)
    Total of the summarized JIT calls does not match the current delivery qty
    (Message no. BORGR540)
    Changing the delivery quantity and the notified JIT quantity to 10 pieces, the goods receipt is booked correctly.
    I only found the following notes that deal with tolerances but they are outdated, as we are using DIMP release 603:
    https://service.sap.com/sap/support/notes/393421
    https://service.sap.com/sap/support/notes/508215
    Has anybody faced a similar problem or can help me with this?
    Thanks!

    Hello Jiaul,
    Sorry I may have mislead you.  The actual error message is "Goods Receipt for Production Order XXXX can only be made on 2010.08.25 to 2010.08.27".  These two dates are the Start Date and FInish Date for the Production Order in CO03, 
    The Basic Start Date for the current Production Order is  2010.08.25
    The Basic Finish Date for the current Production Order is 2010.08.27
    I think what it means is that you can only Post Goods Receipt for the Production Order only after the Basic Start Date of the Production Order.  Do you know where I can find the configuration for this message?
    Thanks

  • Value of inventory after Goods Issue, before Goods Receipt for open order

    Dear Experts,
    Raw materials R72 and R82 are required to produce Semifinished Product S10.
    Semifinished product S10 is required to produce Fnished product F20
    On 10th August 2011, I created and release a Process Order for material S10 copying component materials R72 and R82.. Goods issue for component materials R72 and R82 were done for this process order using tcode MIGO (mvt type 261).
    It  takes four to five days to properly blend components R72 and R82 to obtain S10.
    It means Goods Receipt for this process order will be done on 14th or 15th August when this blending has been completed.
    Management suddenly issues a directive that stock take should be carried out in the plant on the 12th August 2011, and my process order is still open and cannot be closed ( or goods receipt cannot be done)  because blending is yet to be completed.
    Please how do I take care of this scenario/situation since Goods Issue has been done already?
    How will the Accountants see or get the correct value of inventory?

    When I run WIP Calculation for my Process Order, what will be the effect ? I mean what accouts are updated by WIP Calculation within a period (not across a perion or  at period end)?
    GI values issued to the Process order will come into WIP GL .( Since your client want to know the stock take should be carried out in the plant on the 12th August 2011- we are doing WIP calculation)
    > After  this WIP Calculation is run,  and say about 2days later, Goods Receipt for this process order is to be posted, what steps am I suppose to carry out?
    After GR Made, Run a WIP calculation again for the order so that The WIP from the GL account will get reduced ,now WIP= (GI value + confirmation ) -(GR Value),
    Check in DEV system before doing in PRD,
    On Month end, do the variance calculation and do the settlement

Maybe you are looking for