I have come across the need to have a vendor contact created (you know, those contacts you find in XK01/2/3), and, to my disbelief, really the only possible way to do this programatically, is with a batch input!!
Well, not anymore. I have created a class that allows you to create and edit vendor contacts (deleting might be easy as well, but I haven’t looked into it yet). Also, it should be fairly easy to extend this to create customer contacts as well. If that’s what you need, go ahead and try to do it 🙂 Ideally, there should be a generic “contact” class, and a subclass for vendor and customer contacts.
The most basic way to create a vendor contact is to use static method CREATE_CONTACT and populate vendor number (LIFNR) and last name (NAME1) in structure IM_HEADER_CONTACT_DATA. After that, it’s up to you to figure out how to use it 🙂
You will find the nugget for the class under folder PURCHASE_TO_PAY/VENDOR_CONTACT of project object, here.
If you have any questions, feel free to ask, but don’t expect 24/7 technical support, that doesn’t come for free 😉
This is not, by any means, a finished “commercial product”. It still definitely needs a lot of work to be a final stable solution. However, it should be a great starting point to whatever you need. If you do some work on it and feel like sharing an improved version of this, please let me know.