cancel
Showing results for 
Search instead for 
Did you mean: 

How to create supplier contacts by schedule task which reads contacts details from CSV file

RatneshSisodiy1
Active Participant
0 Kudos

Hi Friends,

My requirement is , I need to create supplier contacts in a bulk by a schedule task which reads contacts details from CSV file.

I created an explicitly called script which is executed by schedule task. My doubt is, where can I store CSV file in sourcing ( similar to application server of standard SAP ) , so that the file can be read in the explicitly called script.

If possible, please provide code also to read the CSV file. Thank a lot.

Regards,

Ratnesh

Accepted Solutions (1)

Accepted Solutions (1)

kushagra_agrawal
Active Participant
0 Kudos

Hi Ratnesh,

You can create a Data Import schedule task and can place the CSV file either in the Local Directory or in the FTP.You can get the directory or FTP details from your basis team. My doubt is why you need to create an explicit script and what exactly your script is doing?

Thanks

Kushagra A

Answers (1)

Answers (1)

RatneshSisodiy1
Active Participant
0 Kudos

Hi All,

I need code help on this issue.

I am using below code for this requirement but it's not working. Basically, I am creating a contact programatically in supplier number hardcoded in below code.

IBeanHomeIfc vendorHome = IBeanHomeLocator.lookup(session,VendorIBeanHomeIfc.sHOME_NAME);

VendorIBeanIfc vendor = ((VendorIBeanHomeIfc) vendorHome).findByExternalId("121414132");

VendorIBeanHomeIfc vendor_home = (VendorIBeanHomeIfc) vendor.getIBeanHomeIfc();

vendor_home.upgradeToEdit(vendor);

contactColl = vendor.getCollnContact();

if(contactColl.size()>1)

{

    contactMbr = contactColl.create();

   

    contactMbr.setFirstName("Dummy");

    contactMbr.setLastName("Dummy");

    contactMbr.setAddress1("Bangalore");

    contactMbr.setCity("Bangalore");

    contactMbr.setStateProvince("karnataka");

    contactMbr.setPostalCode("560011");

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

    contactMbr.setName(vendor.getExternalId());

   

     contactMbr.setCountryObjRef(vendor.getCountryObjRef());

   

    contactMbr.setCurrency(vendor.getCurrencyObjectRef());

 

    contactMbr.setDisplayLanguage(vendor.getDisplayLanguage();

   

   

    try

      {

        contactColl.add(contactMbr); 

      }

      

    catch(Exception e)

    { 

        logMsg.setLogMessage("test"+e.getMessage());

        Logger.info(logMsg);  

               

    }

Please note that I am using above code in an explicitly called script and In my supplier contact, along with above mentioned setter methods, Time zone , Date Format, Excel Format, Decimanl Format field are mandatory.

Please provide me code(if possible) or hint on how to fix this issue.

Regards,

Ratnesh