Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create Contact Person via Function Module

Former Member
0 Likes
5,037

Hello,

I´m searching for a possibility to create a new contact person for a customer via function module.

It is possible using transaction VAP1: But how can this be done in background with a function module or class?

Thank you for any help,

Stefan

19 REPLIES 19
Read only

dani_mn
Active Contributor
0 Likes
2,870

you can use BDC to create it in background.

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
2,870

OK, this will help us. Nevertheless, I´m wondering why there isn´t a BAPI or FM for this. SAP provides in the meantime nearly for everything a BAPI - but not for this (in my eyes) easy topic.

Best regards,

Stefan

Read only

Former Member
0 Likes
2,870

Stefan,

See the <b>BAPI BAPI_CUSTOMER_CHANGEFROMDATA1 / BAPI_CUSTOMER_CHANGEFROMDATA</b>.

You can pass Contact Information of a customer there.

Cheers,

Thomas.

Read only

Former Member
0 Likes
2,870

Hello,

thank you for this answer. We can use it for creation/change of new customers.

But how can we add an additional contact Person to an existing customer with these functions? All I can see are data structures of KNA1. I´d have expected a KNVK-like data structure!?

Do you have an example how to use it for adding a new contact person?

Thank you in advance,

Stefan

Read only

Former Member
0 Likes
2,870

Hi,

Exactly I was talking about KNVK table entry of address type (3). But you check with BAPI <b>BAPI_CUSTOMER_CHANGEFROMDATA1</b>. It collects data for KNVK(address type 3) to pass it to <b>SD_CUSTOMER_MAINTAIN_ALL</b>. If the BAPI is not working probably can you use Function Module SD_CUSTOMER_MAINTAIN_ALL directly.

For that you may need to pass

POSTFLAG = 'X'.
  CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'
       EXPORTING
            I_KNA1                  = I_KNA1
            PI_POSTFLAG             = POSTFLAG
       TABLES
            T_XKNVK                 = T_XKNVK
            T_XKNVP                 = T_XKNVP
            T_YKNVK                 = T_YKNVK
            T_YKNVP                 = T_YKNVP

Hope this post will help you.

Regards,

Thomas

Read only

Former Member
0 Likes
2,870

Hi Stefan,

Check this FM : BAPI_BUPR_CONTP_CREATE

Regards,

Ravi

Read only

0 Likes
2,870

Hi,

You can use BAPI_PARTNEREMPLOYEE_CREATE to create Contact persons for Customers or Vendors. It internally calls for VAP1 tcode.

regards,

ram

Read only

0 Likes
2,870

Hello,

this will only start transaction VAP1 (as far as I can see), so that it´s not possible to create a contact person in batch/backend with it?

Best regards,

Stefan Obermeier

Read only

0 Likes
2,870

Hello,

this will not create a KNA1-Customer - ContactPerson but a BusinessPartner contact person. I found no possibility to create a normal KNA1-Customer - ContactPerson creation with it.

Best regards,

Stefan Obermeier

Read only

0 Likes
2,870

Thank you, this actually answered my question

Read only

Former Member
0 Likes
2,870

Run BAPI_PARTNEREMPLOYEE_GETINTNUM and use the nuber generated for the BAPI_ADDRCONTPART_SAVEREPLICA.

Read only

Former Member
0 Likes
2,870

Stefan,

Did you get a solution for the query. Currently i too got a similar requirement,can you please share your approach and the FM used for the same. Basically, i need to create a customer with the role Contact person and assign this contact person to a sold to party.

Thanks in advance.

Regards,

Udaya.

Read only

0 Likes
2,870

Did you ever get a solution to this one?

Would be lovely to have some code passed then!

I'm currently creating contact person for Quality Notifications. They are created through VAP1 and I have been searching for a FM to do that.

BR

Mattias Kardell

Read only

0 Likes
2,870

Stefan,

Did you get a solution for the query. Currently i too got a similar requirement,can you please share your approach and the FM used for the same. Basically, i need to add the Contact persons Home address and Business addres for a coustomer.

For this i am using LSMW-BAPI method with BUS4002 & BUS4002 but the problem is the data is updating the tables but not the screen(XD02), if you have any idea please help me on this its URGENT

Thanks in advance.

Regards,

KSR.

Read only

0 Likes
2,870

Hi All,

Urgent, need some soluution to upload the the contack persons address load for a customer....

Thanks in advance,

KSR

Read only

Former Member
0 Likes
2,870

hi u can create the input fields in the screen and then just add that reference in the Chain at PAI . Provided if the space is available .

Read only

Former Member
0 Likes
2,870

hi u can create the input fields in the screen and then just add that reference in the Chain at PAI . Provided if the space is available for your field on screen.

Read only

Former Member
0 Likes
2,870

Hi Stefan,

Did you get any solution in maintaining multiple contact persons(along with their private addresses) for a normal KNA1-customer. If so pl can you send me the code or suggestion on how you did this as i too have same requirement.

Regards,

Srikanth.

Read only

bruno_esperanca
Contributor
0 Likes
2,870

Hi all,

Please check this class, here

It is for vendors, but it should be easy to adapt for customers as well.

Best,

Bruno