Skip to Content
avatar image
Former Member


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!
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 03, 2018 at 04:07 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 02, 2018 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?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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?

  • avatar image
    Former Member
    Jan 03, 2018 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.

    Add comment
    10|10000 characters needed characters exceeded