A colleague made an Excel file a few days ago, used VBA in Excel to call a tcode in SAP, and saved the content in sheet as a local TXT file, call the TXT file in tcode, execute tcode, and return the result to excel. I found some information on the Internet, logged on to sap using VBA, called the function module, and returned the result to excel. I personally think this is quite good: If you have such a requirement, you need to put the data in SAP in the local Excel after some processing, then we only need to write a function module in SAP, place the result in a table, and then use VBA in Excel to call this function module, then the results can be directly reflected in Excel. What a wonderful thing. Haha!
Of course, the one I wrote by my colleague is complicated and I haven't studied it carefully yet. I will record the following after I study it again in another day!
Here we do not directly record how to call the function module in VBA. Read the attachment directly!
/Files/flysky927/Conect-to-SAP.rar
Statement: the content in the attachment is directly changed by referring to the online materials. If your rights are violated, please inform me in time and I will withdraw it immediately!