Skip to Content


Dec 27, 2017 at 01:21 PM


avatar image

Dear all,
I am trying to update the table KNMT (customer-material info records) with (VBA) code instead of having to do this through VD51/52. For this I found RV_CUSTOMER_MATERIAL_UPDATE after some research.

I am using the following values (they exist in SAP) with table XKNMT_TAB

VKORG = "0010"
VTWEG = "10"
KUNNR = "1176"
MATNR = "6001-1000-1000"

However when calling the function it always returns false (meaning nothing is changing and I am probably doing something wrong).

SAP.MakeConnections "****", "***", "100", "SAPAPPDEV01"
Set r3 = SAP.Connection    
Set bapi = r3.Add("RV_CUSTOMER_MATERIAL_UPDATE")    
Set KNMT = bapi.tables.item("XKNMT_TAB")  
	KNMT.Value(1, "VKORG") = "0010" 'sales organisation (0010)  
	KNMT.Value(1, "VTWEG") = "10" 'distribution channel (10)  
	KNMT.Value(1, "KUNNR") = CusNR 'customer  
	KNMT.Value(1, "MATNR") = MaterialPN 'PN  
	KNMT.Value(1, "UPDKZ") = "I"
(bapi_check results false)

This code normally works for BAPIs (e.g. BAPI_MATERIAL_SAVEDATA) and functions (e.g. MD_STOCK_REQUIREMENTS_LIST_API), but I cannot wrap my head around this one.

Any help is appreciated!
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Jelena Perfiljeva
Jan 03 at 04:07 PM

Write a wrapper function that will be remote-enabled and will call the SAP function inside.

10 |10000 characters needed characters left characters exceeded
Jelena Perfiljeva
Jan 02 at 10:46 PM

You'll need to see the messages returned by the FM call, otherwise we could keep guessing till cows go home. If you have access to SAP, then the simplest test would be to just run this FM in SE37. It could be just a data issue. Does KUNNR need leading zeroes, for example? Or maybe the record exists already?

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Thank you for the SE37 suggestion! I knew there was something in SAP to run the FM but I was not known with the actual transaction. I will try debugging it from there and come back here in case I still cannot find the error.


Strange, in SE37 with exactly the same values it works perfectly. I tried it a couple of times with deleting the record between the tries. The call in my code however continues to return false (with and without leading 0's for the KUNNR, with and without including the date (ERDAT), etc.)

Would you have any suggestions where this comes from?

Tom Koolen Jan 03 at 01:07 PM

It turns out that this function is not remote-enabled. I am not sure if this is possible to change but that gives the problem.

10 |10000 characters needed characters left characters exceeded