Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_GOODSMVT_CREATE and 323/324 movement

Former Member
0 Kudos

Hi All

I'm trying to make a 323 good movement (change of storage location from QM to QM status, without lost hte QM inspection lot number), but I received always the error QA495 "Change the inspection stock of material & in QM only" because the movement it is normally made by QM module and not with MB1B. Exist a mode for make the BAPI work or another bapi for this movement?

Thanks

Davide

1 REPLY 1

Former Member
0 Kudos

For the people which has the same problem, that is the solution:

Yes it is possible use the bapi for good movements for make the 323/324 without pass from QM transaction, this is the code

CALL FUNCTION 'QAAT_QM_ACTIVE_INACTIVE'

EXPORTING

aktiv = space.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = header

goodsmvt_code = code

* TESTRUN = ' '

IMPORTING

* GOODSMVT_HEADRET =

materialdocument = doc_mat

matdocumentyear = doc_yea

TABLES

goodsmvt_item = item

* GOODSMVT_SERIALNUMBER =

return = return

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

CALL FUNCTION 'QAAT_QM_ACTIVE_INACTIVE'

EXPORTING

aktiv = 'X'.

The function 'QAAT_QM_ACTIVE_INACTIVE' with aktiv eq at space disable the SAP control over the transaction. Aktiv = 'X' set again the control.

The only problem is that with this solution the storage location over the inspection batchs aren't automatically changed, so you must made it with source code over the qals table (in the same program or in another program), like in example here below.

tables: qals , MARD.

select-options: prueflos for qals-prueflos obligatory.

parameters: lgort like marD-lgort.

select * from qals

where prueflos in prueflos.

if sy-subrc = 0.

  • note over the qals are two the field lgort to change

move lgort to qals-LAGORTCHRG.

move lgort to qals-LAGORTVORG.

modify qals.

endif.

endselect.