Skip to Content
0

RV_CUSTOMER_MATERIAL_UPDATE not updating KNMT table

Dec 27, 2017 at 01:21 PM

153

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"
UPDKZ = "I"


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.Rows.Add  
	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 = bapi.call
(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
1

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

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

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
Former Member

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.

0
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?

0
avatar image
Former Member Jan 03 at 01:07 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded