In table T158, you can allocate the FI document type transaction to the accounting document or the revaluation document. However, these document types are not considered in transactions MBST, MBRL, MBSF and MBSL so far. The system determines a transaction with which table T158 is read depending on the transaction/event type of the reference document in table T158N and copies the document types of this transaction.
Examples of T158 entries:
Transaction MB1A transaction/event type GI document type W1
Transaction MB11 transaction/event type GI document type GI
Transaction MBST transaction/event type GI document type ST
A document is posted with MB1A. This document has transaction/event type GI and document type W1. If the document is cancelled with MBST, the system finds transaction MB11 for transaction/event type GI via table T158N. That is, the cancelled document then has transaction/event type GI with document type GI.
Cause and prerequisites
It was, until now, programmed this way.
SolutionIn Release 3.0A, the following changes were made which can be taken over into the older releases, if required (the changes are not included in the standard system in Release 2.1 or 2.2).
You have to consider that the changes now allow two ways to determine the document type. They are controlled via the type of entry in table T158.
Variant 1: In table T158, no FI document types are set for transactions MBST, MBSF, MBRL and MBSL (one or all - depending on what you want)
In this case, the system copies the document types of the reference document.
Thus, the cancelled document in the example listed under 'Symptom' then would have document type W1.
Variant 2: In table T158, FI document types are set in transactions MBST, MBSF, MBRL and MBSL (one or all - depending on what you want).
In this case, the system copies the document types from table T158.
Thus, the cancelled document in the example listed under 'Symptom' then would have document type ST.
Please make the following changes in Include MM07MFB0 to implement these variants:
FORM BELEG_LESEN.
...
VGART = XMKPF-VGART.
IF T158-TRTYP = H.
DATA: BLART LIKE MKPF-BLART, <- new
BLAUM LIKE MKPF-BLAUM. <- new
BLART = T158-BLART. <- new
BLAUM = T158-BLAUM. <- new
SELECT SINGLE * FROM T003M WHERE VGART = VGART.
...
PERFORM RW_VORGANG_SETZEN USING VGART.
***********************************************************************
* Please delete the following lines *
***********************************************************************
SELECT SINGLE * FROM T003 WHERE BLART = T158-BLAUM.
IF NOT SY-SUBRC IS INITIAL.
MESSAGE E001 WITH '003' T158-BLAUM.
ENDIF.
SELECT SINGLE * FROM T003 WHERE BLART = T158-BLART.
IF NOT SY-SUBRC IS INITIAL.
MESSAGE E001 WITH '003' T158-BLART.
ENDIF.
MKPF-VGART = VGART.
MKPF-BLART = T158-BLART.
MKPF-BLAUM = T158-BLAUM.
***********************************************************************
* Please insert the following lines *
***********************************************************************
IF SY-TCODE = 'MBST' OR SY-TCODE = 'MBSF' OR SY-TCODE = 'MBSL'
OR SY-TCODE = 'MBRL'.
IF BLART IS INITIAL.
MKPF-BLART = XMKPF-BLART.
ELSE.
MKPF-BLART = BLART.
ENDIF.
IF BLAUM IS INITIAL.
MKPF-BLAUM = XMKPF-BLAUM.
ELSE.
MKPF-BLAUM = BLAUM.
ENDIF.
ELSE.
MKPF-BLART = BLART.
MKPF-BLAUM = BLAUM.
ENDIF.
SELECT SINGLE * FROM T003 WHERE BLART = MKPF-BLART.
IF NOT SY-SUBRC IS INITIAL.
MESSAGE E001 WITH '003' MKPF-BLART.
ENDIF.
SELECT SINGLE * FROM T003 WHERE BLART = MKPF-BLAUM.
IF NOT SY-SUBRC IS INITIAL.
MESSAGE E001 WITH '003' MKPF-BLAUM.
ENDIF.
MKPF-VGART = VGART.
***********************************************************************
* End of changes in FORM BELEG_LESEN *
***********************************************************************
...
ENDFORM.
FORM BELEGKOPF_VORSCHLAG.
...
IF SY-TCODE = 'MBST' OR SY-TCODE = 'MBRL' <- new
OR SY-TCODE = 'MBSL' OR SY-TCODE = 'MBSF'. <- new
CHECK NOT T158-BLART IS INITIAL. <- new
ENDIF. <- new
SELECT SINGLE * FROM T003 WHERE BLART = T158-BLAUM.
IF NOT SY-SUBRC IS INITIAL.
MESSAGE E001 WITH '003' T158-BLAUM.
ENDIF.
SELECT SINGLE * FROM T003 WHERE BLART = T158-BLART.
IF NOT SY-SUBRC IS INITIAL.
MESSAGE E001 WITH '003' T158-BLART.
ENDIF.
...
ENDFORM.
No comments:
Post a Comment