2

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?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Ant Swift
  • 20,089
  • 10
  • 38
  • 55

2 Answers2

0

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
Suncatcher
  • 10,355
  • 10
  • 52
  • 90
0

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.

Esti
  • 3,677
  • 8
  • 35
  • 57
  • I do have access to a test SAP environment, I guess my question is the BAPI takes a table called GOODSMVT_ITEM which contains a 121 fields. I am certain that some of these fields are required to do the call. How can I work out which are required without crazy trial and error? – Ant Swift Nov 11 '11 at 08:28
  • From what I remember the BADI documentation detailed exactly which fields were required depending on which movement type you are working with. You are right, only a handful of fields are mandatory. Sorry that I can't be of more help at this stage. – Esti Nov 13 '11 at 19:28
  • I found more documentation which lists the required fields depending on my movement code. SE37 is the structure and field listing but to get to anything useful, there is a button labeled function module documentation in the GUI. – Ant Swift Nov 14 '11 at 11:21