VBA SAP to Excel through Function Modules - BAPI returns empty values on different PC/SAP version

Viewed 30

i'm using an excel macro to get some values from SAP, especially for planned orders. This is my code:

Function GetOrders(ByVal ProductNumber As String)
   Dim OrderList As Object: Set OrderList = SAP.Add("BAPI_MATERIAL_MRP_LIST")
   Dim OrderMat As Object: Set OrderMat = OrderList.Exports("MATERIAL")
   Dim OrderPlant As Object: Set OrderPlant = OrderList.Exports("PLANT")
   Dim OrderTable As Object: Set OrderTable = OrderList.Tables("MRP_IND_LINES")

   OrderTable.FreeTable
   OrderMat = ProductNumber
   OrderPlant = "XXX"
   OrderList.Call

   Set GetOrders = OrderTable
   
   Set OrderMat = Nothing
   Set OrderPlant = Nothing
   Set OrderTable = Nothing
End Function

I've changed the OrderPlant just for the question. It's all working correctly on one PC but using the same SAP account on another one we get some empty values, especially all the number > 10kk are not showed.

What I mean is that on my pc I can get something like this as a result from the MRP_IND_LINES table:

P.cons  00XXXXXXXX/XXXXXX/XXXX          -21.600.000
P.cons  00XXXXXXXX/XXXXXX/XXXX          -3.600.000

while on another pc I get the same values except that the -21.600.000 is empty so it shows like this

P.cons  00XXXXXXXX/XXXXXX/XXXX          
P.cons  00XXXXXXXX/XXXXXX/XXXX          -3.600.000

The disappearing field is the "REC_REQD_QTY", number 16 of the table BAPI_MRP_IND_LINES (MRP: Single Lines of MRP Elements), Data Type: "QUAN"

The only different thing between the pcs is the sap logon gui version, 720 on mine and 750 on the other pc.

Moreover this happens only on the big numbers and the other fields in the row are downloaded correctly.

I'm not using SAP Gui scripting, but I've created the SAP Object with the row

Set SAP = CreateObject("SAP.Functions.Unicode")

Is there anything that I can do to make it work?

Thank you in advance.

0 Answers
Related