cancel
Showing results for 
Search instead for 
Did you mean: 

Create Supplier Contact through IApiTask

Former Member
0 Kudos

I am currently using SAP Sourcing 7. When importing Suppliers from ECC into CLM, only vendor information is populated. In sourcing 7, we have to populate contact information in order to be able to add the supplier to a master agreement. Currently we are doing this through workbook imports.

However, I am working on automating the contact creation for all the vendors populated from ECC. Has anyone worked in creating the contacts for suppliers through a schedule task (IApiTask).

I created an IApiTask to create a contact for the suppliers without the contact information. I am trying to populate the mandatory fields and have an issue populating the DirectoryConfiguration information for a contact.

void

setDirectoryConfiguration(ObjectReferenceIfc

value)
          UNDOCUMENTED (Database Column: DIRECTORY)

I created the ObjectReference using TypeFactory:

ObjectReferenceIfc directory = TypeFactory.createObjectReference(126, -2147472326, "XXX_TN External"...

  1. contactBean.setDirectoryConfiguration(directory);

However, I am getting the following error when trying to execute the code.

Sourced file: inline evaluation of: ``import com.sap.odp.api.common.types.ObjectReferenceIfc;  import com.sap.odp.api. . . . '' : Method Invocation vendorHome.save

Sourced file: inline evaluation of: ``import com.sap.odp.api.common.types.ObjectReferenceIfc;  import com.sap.odp.api. . . . '' : Method Invocation vendorHome.save : at Line: 47 : in file: inline evaluation of: ``import com.sap.odp.api.common.types.ObjectReferenceIfc;  import com.sap.odp.api. . . . '' : vendorHome .save ( vendor )

Target exception: java.lang.NullPointerException: while trying to invoke the method com.sap.odp.common.directory.DirectoryConfigIfc.isCaseSensitive() of an object returned from com.sap.odp.usermgmt.masterdata.AbsAccount.getAbsDirConfig()

Sourced file: inline evaluation of: ``import com.sap.odp.api.common.types.ObjectReferenceIfc;  import com.sap.odp.api. . . . '' : Method Invocation vendorHome.save : at Line: 47 : in file: inline evaluation of: ``import com.sap.odp.api.common.types.ObjectReferenceIfc;  import com.sap.odp.api. . . . '' : vendorHome .save ( vendor )

Target exception: java.lang.NullPointerException: while trying to invoke the method com.sap.odp.common.directory.DirectoryConfigIfc.isCaseSensitive() of an object returned from com.sap.odp.usermgmt.masterdata.AbsAccount.getAbsDirConfig()

Can anyone help me resolve this issue?

-

Bindu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

could you please elaborate a little bit more on this.


1. Are you trying to replicate the contact from the ECC vendor or are you just using dummy contacts?

2. Did you check if the contact information could not be included in the XML file that is sent from ECC to Sourcing?

Thanks,

Bram

Former Member
0 Kudos

I am trying to create dummy contacts. These contacts would never be replicated to ECC. Since in sourcing 7, contact information is mandatory to be able to create a master agreement, we are creating these dummy contacts.

Yes, as far as my knowledge goes, contact information cannot be included in the xml file that is sent from ECC to sourcing. Correct me if I am wrong.

However, I have an alternative approach for creating dummy contacts. I have created an IApiTask to create a .csv file for contacts. A data import task can then be configured to read the generated csv file and import data into CLM.  This is a 2-step process (step 1 - create csv file for contacts using IApi task, step 2 - importing csv using data import task)

I would like to know if this can be done through IAPI rather than creating the csv file.

-

Bindu

Former Member
0 Kudos

Hello,

yes this can be achieved via an IAPI task but using this kind of task is not best practice. You would have to deploy a custom JAR and redeploy them during upgrades/installation of SPs. Besides that, you would also have to redeploy them everytime you wanna make changes.

An easier solution would be to create a script that is executed either during import or during save/validate. When this script executes (when a new vendor is imported), you could then check if a contact exists. If not, you add one. This is a very simple and clean solution compared to using the IAPI task.

Kr,

Bram

Former Member
0 Kudos

That is exactly what I am trying to do. However, my question was about the error that I am getting when tryint o create contact for a supplier. No matter whether I create IApiTask or I do it via script, the question is still valid. Is there a way to solve this?

Former Member
0 Kudos

Hello,

are you sure that you need to set the directory? When you defined a standard external directory, I don't think you need to set directory since it is done automatically for you.

You should just set the first name, last name, email and username and check the checkbox 'create directory account'. Instead of creating a new contact for each vendor, maybe it's better to create one dummy contact and add reuse that same one...

Can you try the following code:

contactColl = doc.getCollnContact();

if(contactColl.size()<1)

{

    contactMbr = contactColl.create();

    contactMbr.setFirstName("Dummy");

    contactMbr.setLastName("Dummy");

    contactMbr.setEmail("Dummy@dummy.com");

    contactMbr.setName(doc.getExternalId());

    contactMbr.setPrimaryContact(new Boolean("true"));

    contactColl.add(contactMbr);

}

Kr,

Bram

Former Member
0 Kudos

Hello Bindu,

As a different approach, if you are using PI interface between ERP and CLM for replicating vendor master data trough XML files, you can duplicate standart Vendor XML in PI and modify it for contact data format. By this way PI will drop two seperate files, one is vendor the other one will be contact (Assuming that contact will be dummy, in our case we mapped vendor number as contact name etc.)

This solution is very easy to be applied, I implemented in one customer and did not face any problem.

Regards,

Kaan

Former Member
0 Kudos

Bindu Sharma,

Could you able to resolve this issue ?

Thanks,

Venu.

Answers (0)