cancel
Showing results for 
Search instead for 
Did you mean: 

DTW contact employees

Former Member
0 Kudos

Hi all,

I've serached this forum and tried some answers but till now no good result.

I want to add contact employees to existing BP which already can have other contact employees.

I use the 2 templates, BusinessPartners adn Contactemployees, but I can't get it right.

There is a problem with the LineNum I think, as when I leave it blank, the new employees are added to the BP, but overwrites the existing contact employees and that's not good.

If I put a linenum, 0,1,2, etc. in the file, I get another error about NULL value in column NAME, but this column is filled with data!

How can I use the DTW and add new CP to the BP with existing CP?

Please advise.

Thanks in advance.

Carl Verhagen

Accepted Solutions (1)

Accepted Solutions (1)

former_member541807
Active Contributor
0 Kudos

hi Carl,

934829 - DTW_How to update an existing Contact Employee via the DTW


Cause

Consulting


Solution

To update the Contact Employee you need to fill the LineNum in the ContactEmployee import file.

In order to find out what LineNum to use, you first have to run a query into the Query Generator such as:
SELECT *  FROM OCPR WHERE CardCode = 'C01' ORDER BY Name

The first line returned from the query will get a LineNum of 0, the second line returned gets the LineNum 1 and so on.


Other terms

SAP Business One, SDK, DTW, B1, Business Partner, DTW, DI API, setCurrentLine LineNum, contact person, update contact employee, existing, OCPR

Regards,

Fidel

Former Member
0 Kudos

Hi Fidel,

That note I already found and is talking about updating existing contact employees and I want to add new ones to Business Partners which can already have existing contact employees.

That's why I wrote that adding linenum to the records, causes errors.

I also tried to take other linenumbers (the last one + 1) at BP with existing contact employees, but also errors and no result.

Thanks for helping so far.

Carl

Former Member
0 Kudos

Hi Carl,

Use the result of this query to get the linenum:

SELECT T0.CARDCODE, Count(T0.Name) 'Count' FROM OCPR T0 WHERE T0.CardCode LIKE '[%0\]%'

GROUP BY T0.CARDCODE

If you only add one contact, this is the number you should use.

Thanks,

Gordon

Former Member
0 Kudos

Hi Gordon,

Thanks for answering, but unfortenately it still didn't work.

I run your query for a customer which have already 1 contactperson, so the value of Count is 1.

In my file I have 2 new contactpersons which I gave the linenum 1, but then then when I use the DTW and choose Add new data I get the error message that the entry already exist, also when I use the linenum 1,2 or 2,3 or 2,2 or 1,1.

If I don't use a linenum it will overwrite the already existing contactperson which don't have the same Name ofcourse.

Can you please advise how I have to configure my file see underneath.

RecordKey LineNum Name E_Mail Fax Gender Phone1

RecordKey LineNum Name E_Mail Fax Gender Phone1

1 2 Test 1 0320-238050 M 0320-238238

1 3 Test 2 M

Thanks for your attention.

Best regards,

Carl Verhagen

former_member541807
Active Contributor
0 Kudos

hi Carl,

your data is

RecordKey	LineNum	Name	E_Mail	Fax	Gender	Phone1
RecordKey	LineNum	Name	E_Mail	Fax	Gender	Phone1
1	2	Test 1	 0320-238050	M	0320-238238
1	3	Test 2	 M	

instead try this

RecordKey	LineNum	Name	E_Mail	Fax	Gender	Phone1
RecordKey	LineNum	Name	E_Mail	Fax	Gender	Phone1
Actual BP Code	1	Test 1	 0320-238050	M	0320-238238
Actual BP Code	2       Test 2	 M	

note:

Recordkey: Refers to actual BP Code from your db i.e 'C00001'

LineNum: when you do the count it should begin from 0, 1, 2, 3 and so on......

Now since Gordon's query returns 1 line, you should consider it as line 0, so if you have to add another contact person the LineNum should start in 1.

hope it is clear to you.

regards,

Fidel

Former Member
0 Kudos

Try:

RecordKey LineNum Name E_Mail Fax Gender Phone1

RecordKey LineNum Name E_Mail Fax Gender Phone1

1 1 Test 1 0320-238050 M 0320-238238

1 2 Test 2 M

If this override the existing one, export all current contacts and do a complete DTW.

former_member541807
Active Contributor
0 Kudos

hi Carl,

im sorry, my previous reply is my mistake. i have tested here and its working

RecordKey	LineNum	Name	E_Mail	Fax	Gender	Phone1
RecordKey	LineNum	Name	E_Mail	Fax	Gender	Phone1
1	1	Test 1	 0320-238050	M	0320-238238
1	2       Test 2	 M	

please note the ff.

the RecordKey for this case is

1 - this refer recordkey in BusinessPartner template

1 - this refer recordkey in BusinessPartner template

now if you run the query from Gordon's reply, it the return result is 1 line the your lineNum should begin 1 & 2, but if the query returns 2 line your LineNum should begin 2 & 3 something like this

RecordKey	LineNum	Name	E_Mail	Fax	Gender	Phone1
RecordKey	LineNum	Name	E_Mail	Fax	Gender	Phone1
1	2	Test 1	 0320-238050	M	0320-238238
1	3       Test 2	 M	

regards,

Fidel

Former Member
0 Kudos

Hi Fidel,

Thanks for your answer and finally it worked.

I already tried the 1,2 linenum, but used the Add function instead of the Update existing data as I thought it was new data.

However I also have to work with the query of Gordon as existing BP can have more than 1 contactperson and I have to take that number as startnumber forthe linenum.

I can manage that :).

Thanks for your help.

Best regards,

Carl

Former Member
0 Kudos

Thanks for your help Gordon, but it finally worked after some extra help from Fidel.

You were correct with the 1 and 2 linenum, I only had to use the Update existing data instead of Add new data function.

Ofcourse I could export al existing contactpersons and add them to the new ones and use the DTW to import them all, but then the persons also dissapear in all open documents.

However, I can continue with this.

Thanks again.

Best regards,

Carl

Answers (0)