Application Development 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: 

Create Contact Person via Function Module

Former Member
0 Kudos

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

dani_mn
Active Contributor
0 Kudos

you can use BDC to create it in background.

Regards,

Wasim Ahmed

Former Member
0 Kudos

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

Former Member
0 Kudos

Stefan,

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

You can pass Contact Information of a customer there.

Cheers,

Thomas.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

former_member181962
Active Contributor
0 Kudos

Hi Stefan,

Check this FM : BAPI_BUPR_CONTP_CREATE

Regards,

Ravi

0 Kudos

Hi,

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

regards,

ram

0 Kudos

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

0 Kudos

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

0 Kudos

Thank you, this actually answered my question

Former Member
0 Kudos

Run BAPI_PARTNEREMPLOYEE_GETINTNUM and use the nuber generated for the BAPI_ADDRCONTPART_SAVEREPLICA.

former_member184390
Participant
0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos

Hi All,

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

Thanks in advance,

KSR

Former Member
0 Kudos

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 .

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

bruno_esperanca
Contributor
0 Kudos

Hi all,

Please check this class, here

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

Best,

Bruno