We are making payments against a P-Card. Of course these are sent to the bank with all that such entails. In the meantime, we are loosing information on the real vendor. For instance, the purchaser took their P-Card to Walmart and bought ink pens. This is a non-inventoried item. Once the paymant was approved outside of SAP, we stopped caring that they were ink pens but we still care that we spent $5125.72 at Walmart. The plan is to read the banks file and write a PO to Walmart, recieve(create) a GR from Walmart against that PO, and recieve an invoice from Walmart against that PO. When I have writen the code for that, that will end my part of this. There may be other things that users have to do from there. So I am writing an interface that reads an excel and BAPI's a PO creation, a GR creation, and a invoice receipt.
To date, the PO creation works great (from 'BAPI_PO_CREATE'). The created PO can be MIGO_GR'd with movement type 101 and the OK (or Item is adopted into document) flag set and the GR creates prefectly.
I started working the GR create portion of the problem with 'BAPI_GOODSMVT_CREATE'. Eventually, with the help of searching this forum, I've got the GR creating. Unfortunately, it is not adopting to the PO. I haven't been able to find a flag to set that seems to equate to the OK (adopt) flag in MIGO_GR.
Here is what I'm setting up for 'BAPI_GOODSMVT_CREATE'.
Code: Select all
MOVE '01' TO lf_gr_code-gm_code. SELECT SINGLE ebeln INTO (ekpo-ebeln) FROM ekpo WHERE bednr = wa_upload-trackingno. IF sy-subrc IS INITIAL. MOVE ekpo-ebeln TO lf_gr_header-ref_doc_no. ENDIF. MOVE '20080414' TO lf_gr_header-pstng_date. MOVE sy-datum TO lf_gr_header-doc_date. MOVE sy-uname TO lf_gr_header-pr_uname. CONCATENATE 'From Vendor -' wa_upload-short_text INTO lf_gr_header-header_txt. LOOP AT it_gr INTO wa_upload2 WHERE z_vendor = wa_upload-z_vendor. SELECT SINGLE ebeln ebelp werks INTO (ekpo-ebeln, ekpo-ebelp, ekpo-werks) FROM ekpo WHERE bednr = wa_upload2-trackingno. IF sy-subrc IS INITIAL. MOVE ekpo-ebeln TO lf_gr_item-po_number. MOVE ekpo-ebelp TO lf_gr_item-po_item. MOVE 'X' TO lf_gr_item-no_more_gr. MOVE '1' TO lf_gr_item-entry_qnt. MOVE 'EA' TO lf_gr_item-entry_uom. * MOVE 'EA' TO lf_gr_item-ENTRY_UOM_ISO. MOVE 'B' TO lf_gr_item-mvt_ind. MOVE '101' TO lf_gr_item-move_type. * MOVE ekpo-werks TO lf_gr_item-plant. APPEND lf_gr_item TO lt_gr_item. ELSE. * Do something about this because it is an error. ENDIF. DELETE it_gr. ENDLOOP.
So the questions come down to this. Is 'BAPI_GOODSMVT_CREATE' the right BAPI? If so, What initialization stuff am I missing? If not, is there another BAPI? (I've seen a note that Rinscheid Ruediger suggested FM "MB_CREATE_GOODS_MOVEMENT" (on another forum) as an alternative, but I haven't explored it. Does anyone have experience with it so that they can provide some further inducement? I've been avoiding it because I am biased into believing that SAP provides better support of BAPI's.)
Of course, any other suggestions (on topic) would be greatly appreciated.