Need Code For PO-GR through MiGO for multiple documents through BAPI

Hi All
Im using BAPI_GOODSMVT_CREATE to post goods for PO-GR.
When im posting multiple documents its giving error.
When im posting individually, it's working fine.
Please send me the code for PO-GR through BAPI.
Urgently required.
Regards,
SImha.

Is this not working???
BAPI_GOODSMVT_CREATE to post Goods Movement
The following is an abap program making used of the BAPI function BAPI_GOODSMVT_CREATE to do Goods Receipts for Purchase Order after importing the data from an external system.
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.
*--- End of Program
REgards,
Ravi

Similar Messages

  • Goods Receipt is allowed through MIGO  for PO's though they hav the confirm

    Goods Receipt is allowed through MIGO  for PO's though they hav the confirmation control key. where as its should allow based on ASN(inbound Delivery).
    Not sure if any system changes has to be made or anything else. please suggest.
    Thanks

    Hi Dear <
      You can also recived the goods  with reference to inbound Delevery,
    1  Select  In Confirmation  Tab Con con key while in  Creating PO
    2  Create a Inbound delevry from T.code: VL31n
    3 Once you create the Inbound delevery wth reference to PO, The inbound delevery no will be propulated in  Confirmation Tab of PO
    4 you can Do the mIGO  with reference to that Inbound delevery

  • A friend wants me to put together on booklet that's been done in excel. I'm on a mac os 10. Do I need to download microsoft excel for mac or can I open the document through indesign?

    A friend wants me to put together on booklet that's been done in excel. I'm on a mac os 10. Do I need to download microsoft excel for mac or can I open the document through indesign?

    I second LibreOffice as it's the most recent fork, however NeoOffice and OpenOffice will also work.
    Just say No money to Redmond!
    Also the old Ready Set Go! will be having a Lion version out soon.
    It's a low cost page layout program (like Indesign but without the high price) and can make booklets etc better, import the excel grpahics from LibreOffice.
    http://www.diwan.com/ready/prsg.htm

  • System is not allowing GR through MIGO for generic article in SAP Is-Retail

    Hi,
    I am trying to do a GR into DC through MIGO for a generic article and its variants but system is not allowing it saying " The generic article is not maintained in DC". System by design doesn't allow to maintain generic article for specific site but it does for reference site. It did not say anything at the time of PO creation but throwing error during GR. Looking for help!
    Thanks in advance!
    Subhankar

    awaiting response.

  • RE: Goods issue posting through Migo for Production Order

    I have released the production order, when I want to post the goods issue through migo to the concerned order I am getting error saying that material "No components exist but there was stock in the storage location for unresticted use.
    I have checked through MMbe transaction.

    Are there components in the Production Order? If yes, is the reservation created and movement allowed for the reservation?
    Lakshman

  • Block GR through MIGO for specific PO type

    Hi all,
    I have a scenario to block the GR for specific purchase order type as it has to be done through VL32N.
    System has to throw an error message when user tries to do the GR for this type.
    I am looking for an user exit where system has to throw an error msg for MIGO only.
    Users are already blocked to do GR through transaction MB01.
    Please help me out to resolve this issue. Please let me know if any user exists are available before saving MIGO transaction.
    Regards
    Gowri Sankar

    Well I can suggest a work around, if you want all PO's with Confirmation control Inbound Delivery be GR through VL32N, then in IMG screen go to Inventory Management - Settings for enjoy transaction - Settings for Goods Movement - Settings for Transactions and reference Docs and there you remove Inbound delivery as a reference document for MIGO & MIGO _GR.
    This will solve the purpose.
    Edited by: Chandra Shekhar Singh on Feb 26, 2011 9:21 PM

  • Change Purchase Order type ,price before auto creation of PO through MIGO?

    Hi ,
    I have reuirement  infront of me.
    We are creating return Purchase order through MIGO for Non-ordered items.
    Purchase Order is created automatically by SAP.
    I need to change its Purchase Order type  , Net Price , Order Price Unit .
    Is it possible to modify the content before the creation of this PO.
    Please help me .
    Regards,
    Amit

    We are not using BPA ; is there any solution involving ASL and/or Sourcing Rule which can be used to meet the User requirement.There certainly is. It involves using either Blanket Purchase Aggreement (which you don't have) or using Quotes.
    Once you have created either of those, simply create an ASL entry for the item(s), attach the Quote or BPA to the ASL entry; create a sourcing rule.
    Once these setups are done, when a requisition is created and approved, it will get converted into a PO automatically.
    And depending upon the value you enter in the "Release method" field on the ASL screen (and your PO workflow attributes), the PO will be created in incomplete status or it can be automatically submitted for approval.
    Hope this answers your question,
    Sandeep Gandhi
    Independent Techno-functional consultant

  • How to update Assignment field in Accounting Document through BAPI ?

    I need to change Assignment field in already posted accounting document through bapi or some other automatic method. Please tell me exactly which bapi I should use and how can I pass the changed assignment field?

    Hey,
    I couldnt find any BAPIs which update an accounting document. I think the safest way is to record FB02 and use BDC/Call Transaction.
    -Kiran
    *Please reward useful answers

  • Goods Receipt for Inbound Delivery through MIGO

    Hi All,
    Can anyone pl. explain me in steps the process of GR for Inbound Delivery from MIGO transaction.
    Also I need the process of reversing this goods receipt done.
    For certain inbound deliveries a dump occurs in the program SAPLIE01 in 'EQUIPMENT_ADAPT_BUSVIEWS' fn module.
    I need to analyse the reason for the dump. Here is the extract from the dump
    <b>IF WA_EQUI IS INITIAL
      keine Equidaten vorhanden => EXCEPTION
    --->       RAISE ERR_ADAPT_BUSVIEWS . ENDIF.                     </b>                                          
    Advance Thanks

    Hi Sanjay and Srikanth,
    Thank you for the correction. I was just wondering over this number.
    Sanjay, regd the release level, it is 0017 for SAP_APPL.
    In brief, when GR is done for an inbound delivery, a fn moudle equipment_adapt_busviews is called, in which if the equipment data of the material (wa_equi) is initial, it gives dump.
    1. This fn module is called 3 or 4 times while the posting is done through MIGO
    2. In the 4th call, the parameter wa_equi is initial - which gives the dump.
    3. While debugging, when I reach this point,if I restart the debugging, I find that the posting is completed !!!! (so something happening after posting of GR gives the dump)
    4. I have to reverse this GR for replicating the same again.
    Any further clues !!
    Regards
    Aadarsh

  • Need code for sales order create report using bapi's

    need code for sales order create report using bapi's

    Hi,
    Go through below link
    http://www.saptechies.com/bapi_salesorder_createfromdat2/
    <b>Reward points if it helps,</b>
    Satish

  • Adobe Photo Downloader has encountered a problem and needs to close. We are sorry for the inconvenience.  Error Code: c0000005  Address: 76f73ac3     I clicked on the OK button and the downloader closed.     I then tried to download from the organizer. I

    Photoshop Elements 12
    Adobe Photo Downloader has encountered a problem and needs to close. We are sorry for the inconvenience.
    Error Code: c0000005
    Address: 75e32f71
    I clicked on the OK button and the downloader closed.
    I did a search on this error code (c0000005) and there seems to be a workaround but no solutions, why is this? I ask that because this problem seems to be years and years old, going back to at least 2005 (do the math that is 10 years).
    I don't even have the Camera hooked up and I get this error on download.  I redownloaded everything and reinstalled.  I allso saw the AVI issues reported with this proble so i updated Quicktime though without the camera being hooked up when I get this error I didn't expect that to work.  I tried support and they wouldn't help because I bought it in March this year.  Pretty frustrating as I have re-purchased Elements about every 2 years.  I think I might need a new CODEC?   I had this problem on an Earlier version And I seem to remember that being the Fix but this may be something completely different

    I finally found that it was missing a picture so the Catalog was "corrupted".  I just deleted the picture and it started working.
    I hate Adobe and their total lack of support - thanks for nothing Adobe .  Also get this - they offered me to upgrade to 13.0 ( My 12.0 is only 6 months old  but they still don't support it on errors.  Only install errors!
    I have upgrade and repurchase this product 4 times now.  I will find something else next time!

  • Need Code for this requirement for generating report

    1) Creating interactive reports for sales orders, vendors, customers, and stock available  In each type for a particular material, list of purchase documents and vendor performance report that lists vendor name, materials Supplied and actual delivery times, payments terms and prices.
    2) Classical Report to display a list of Purchase
      Requisitions with details like MRP controller, release date, unit to
      Measure along with the standard details, Table used EBAN.
    3) Create a list of customer number, Credit limit
      To the given Customer. Tables used KNA1, KNKKF1 (Customer Credit table)
    Plz help me i need it very urgently....

    I always put code in the when-validate-RECORD trigger to ensure fields are entered, rather than setting the property. That way, the user can enter other fields within the record, and then gets a message that the field is required only when leaving the record.
    ...of course, if the date item is the only field in the block, then the when-validate triggers will not run unless the user at least types a space in the date. In that case, you need to check in the key-commit trigger.

  • Why do i need to enter the credit card information for downloading free apps and redeem the codes?

    getting a message says apple id has not yet been used with the itunes store while trying to download apps
    why do i need to enter the credit card information for downloading free apps and redeem the codes?

    As a security precaution, Apple verifies your billing credentials with every transaction whether paid or free apps or using the balance of a redeemed code.

  • Problem in Posting of GR for Subcontracting PO Through MIGO

    Hi All,
    When I am posting 101 through MB01 for Subcontracting PO The system is creating three line items in Material Document( 101, <b>543 & 545</b> ) which is correct.
    But if i am doing the same through MIGO it is posting three line items as (101, <b>543 & 543</b>) - Which is wrong.
    I am using SAP R/3 4.7.
    Please let me know if there is any OSS note to fix this.
    Thanks a ton in advance.
    -Nirupam

    Hi,
    I can't belive it....543 is showing Credit indicator and 545 is showing debit indicator.  Which is perfect.  So, when we receive a subcontracting PO, if at all there is any byproduct that is going to be received, it has to be either debit or credit (only one way) whether we receive from MB01 or MIGO.  If you see 545 in MB01 that means, you are receiving by-products along with ....However, in MIGo you are showing only 543 (consumption of components).....Are you missing any by-products comingup in mIGO?  Is the PO the same you are using in both MB01 and mIGO....very minimal differences in terms of functionality we may encouner between these two transactions but I strongly doubt about posting two different movements types for exactly the same data....I am not doubting you; just curious to work on such problem.  Please cross verify again and let me know.
    Regards

  • Need code for restarting my system

    hello every body i need code for restarting system
    this code does not work
    try {
    Runtime.getRuntime().exec("shutdown -s -t01") // stop
    }catch(...
    or
    try {
    Runtime.getRuntime().exec("shutdown -r -t01") // reboot
    }catch(...
    or
    try {
    Runtime.getRuntime().exec("shutdown -l -t01") // logout
    }catch(...

    write a jni function that calls this method : ExitWindowsEx()
    check the documentation

Maybe you are looking for

  • Why can't I use the Fade to option in iMovie?

    Hi! I'm editing a movie on iMovie, but I'm unable to use the "Fade to" special effect. First, I select the clip, then I go Clip>Fade to>-Black and White                                                                                                  

  • Qosmios X300-156: Should I buy a cooler for the portable

    Hi. Well I'm freshman here in your site :) I have a doubt about my portable. I have asked many people reviews, but none was able to convince. I have a X300, and unfortnely he had a breakdown on the motherboard. I'm from Portugal, anda they sad to me

  • Regarding export invoice

    hi to all               i need to add net weight Gross weight no.of shippers date and time of removal of goods, registration number of vehicle in the export invoice. these are from different tables ,can any one say how to fetch the records thru the s

  • Rowset

    Hi, Every Sql Query I create in BI Publisher has ROWSET as the root node. I need to be able to change this to something more unique and descriptive so that my label printing will understand which template to use. Is there a way within the SQL Query s

  • Wrong google images returned

    within my touch if I do a google image search then forward a link to that image the link often returns a different image.   is this touch related?..I only experience this with my touch...