2 material documents (107) in STO when executing BAPI_GOODSMVT_CREATE - WHY?
What are the reasons why there could be 2 material documents (107 movement) in my STO upon executing BAPI_GOODSMVT_CREATE? I'm using the exact identical parameters. There are two scenarios to this.
PGI (movement 643) through VL02N Post goods issue. Run BAPI_GOODSMVT_CREATE for 107 movement.
Result: Only 1 material document (107) in my STO
PGI (movement 643) through shipment completion (VT02N). Run BAPI_GOODSMVT_CREATE for 107 movement.
Result: 2 material documents (107) in my STO
During debug of the 2nd scenario, there is always only 1 entry in the MSEG internal tables. When the FM is done executing, 1 material document (107) appears in ME23N purchase order history. Upon executing 'BAPI_TRANSACTION_COMMIT', another material document (107) is added to the STO history. Upon checking in MSEG table, the user for the first 107 is the background user, and the 2nd one is in my username. Any thoughts? I'm an ABAP developer, let me know if you have any clarifications.