Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member182708
Active Participant

The error message V1331 occurs most often in sales order processing and you can find threads about here in the SCN Forum. However, if custom own coding is programmed wrongly, then it can pop up as well, when you try to create an invoice via transaction VF01:


The root cause of the error is most often an accidental manipulation of the sales order number VBAK-VBELN in pricing user-exit

USEREXIT_PRICING_PREPARE_TKOMK of include RV60AFZZ.

Here in this exit the sales order header structure VBAK is available. If now a wrong select on VBAK is programmed, the number could be changed. One example for erroneous coding:

SAPLV60A                   / RV60AFZZ

FORM                           / USEREXIT_PRICING_PREPARE_TKOMK

...

IF ( vbrk-vkorg = '3000' OR vbrk-vkorg = '5000' ) AND ( sy-tcode = 'VF01' OR sy-tcode = 'VF04' ).

   SELECT * FROM vbak

     WHERE vbeln = vbrk-zuonr.

   ENDSELECT.

When VBRK-ZUONR is not filled with the sales order number currently involved, then VBAK-VBELN is changed wrongly, and the sales order numbers differ thereafter between header information VBAK and item VBAP:

In the processing of the status, this inconsistency is detected and as the item VBAP structure FXVBAP does not contain the same VBELN number as in VBAK present, the check fails:

And the error message is issued when returning to function module RV_XVBUP_MAINTAIN_FKGSA:

Conclusion: Be very careful with your modifications and assure that VBAK information is not changed wrongly!

6 Comments