Question

I'm trying to replace some un-reliable sap scripting we have in place to do an MB01 from a custom goods receipt application. I have come across the .NET connector and it looks like it could do a job for me.

Research has churned up the BAPI called BAPI_GOODSMVT_CREATE but can anyone tell me what parameters might be required to perform this transaction?

I have access to a SAP test environment.

BAPI_GOODSMVT_CREATE accepts a table of values called GOODSMVT_ITEM which contains 121 fields. I'm sure that not all of these fields are required.

Ultimately I guess my question is, what how can I work out which ones are required?

Was it helpful?

Solution

Do you have access to a SAP system? I have recently used this BAPI, and it has quite detailed documentation. To view the documentation, use transaction SE37, and enter the BAPI name. Unfortunately I don't currently have access to a system.

You will have to ask one of your MM/Logistics people to tell you what the movement type (BWART) is, and depending on the config you will need details like material number (MATNR), plant (WERKS), storage location etc.

OTHER TIPS

MB01 is a Post GR for PO transaction, it is an equivalent of GM_Code 01 in MIGO or BAPI_GOODSMVT_CREATE. MIGO transaction is a modern successor for obsolete MB01.

So, as per the BAPI_GOODSMVT_CREATE documentation for GM_Code 01 the following fields are mandatory:

  • 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

Here is the sample:

gmhead-pstng_date = sy-datum.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '01'.

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.

call function 'BAPI_GOODSMVT_CREATE'
  exporting
    goodsmvt_header  = gmhead
    goodsmvt_code    = gmcode
 IMPORTING
    goodsmvt_headret = mthead
  tables
    goodsmvt_item    = itab
    return           = errmsg
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top