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

Vendor Master Contact Creation BAPI

Former Member
0 Likes
1,736

Hi All

I am trying to create a vendor contact upload program but I am having trouble with the BAPI I have. It seems like it works for update but I want to create a new contact.

BAPI_ADDRESSCONTPART_GETDETAIL and BAPI_ADDRESSCONTPART_CHANGE is complaining because I haven't filled out the importing parameter obj_id_p which requires the partner number (which obviously doesn't exist yet)

Does anyone know of the correct BAPI to use to insert new contacts for Vendor? Am I using this BAPI wrong?

I receive this error:

           E AM                   165

Specify person object type and key

COde:

  ls_bapi_ct-objtype_p = 'BUS1006001'.
  ls_bapi_ct-objkey_p = t_vend-parnr.
  ls_bapi_ct-objtype_c = 'LFA1'.
  ls_bapi_ct-objkey_c = t_vend-lifnr.
  ls_bapi_ct-context = '5'.

  CALL FUNCTION 'BAPI_ADDRESSCONTPART_CHANGE'
    EXPORTING
      obj_type_p     = ls_bapi_ct-objtype_p
      obj_id_p       = ls_bapi_ct-objkey_p
      obj_type_c     = ls_bapi_ct-objtype_c
      obj_id_c       = ls_bapi_ct-objkey_c
      obj_id_ext     = ' '
      context        = ls_bapi_ct-context
      accept_error   = ' '
    IMPORTING
      address_number = ls_bapi_ct-addr_no
      person_number  = ls_bapi_ct-pers_no
    TABLES
      bapiad3vl      = t_bapiad3vl
*     bapiadtel      = t_bapiadtel
*     bapiadfax      = t_bapiadfax
      bapiadsmtp     = t_bapiadsmtp
*     bapiaduri      = t_bapiaduri
      bapicomrem     = t_bapicomrem
      bapiad3vl_x    = tx_bapiad3vlx
*     bapiadtel_x    = tx_bapiadtelx
*     bapiadfax_x    = tx_bapiadfaxx
      bapiadsmt_x    = tx_bapiadsmtx
*     bapiaduri_x    = tx_bapiadurix
      bapicomre_x    = tx_bapicomrex
      return         = t_ret.

Hi All

I am trying to create a vendor contact upload program but I am having trouble with the BAPI I have. It seems like it works for update but I want to create a new contact.

BAPI_ADDRESSCONTPART_GETDETAIL and BAPI_ADDRESSCONTPART_CHANGE is complaining because I haven't filled out the importing parameter obj_id_p which requires the partner number (which obviously doesn't exist yet)

Does anyone know of the correct BAPI to use to insert new contacts for Vendor? Am I using this BAPI wrong?

I receive this error:

           E AM                   165

Specify person object type and key

COde:

  ls_bapi_ct-objtype_p = 'BUS1006001'.
  ls_bapi_ct-objkey_p = t_vend-parnr.
  ls_bapi_ct-objtype_c = 'LFA1'.
  ls_bapi_ct-objkey_c = t_vend-lifnr.
  ls_bapi_ct-context = '5'.

  CALL FUNCTION 'BAPI_ADDRESSCONTPART_CHANGE'
    EXPORTING
      obj_type_p     = ls_bapi_ct-objtype_p
      obj_id_p       = ls_bapi_ct-objkey_p
      obj_type_c     = ls_bapi_ct-objtype_c
      obj_id_c       = ls_bapi_ct-objkey_c
      obj_id_ext     = ' '
      context        = ls_bapi_ct-context
      accept_error   = ' '
    IMPORTING
      address_number = ls_bapi_ct-addr_no
      person_number  = ls_bapi_ct-pers_no
    TABLES
      bapiad3vl      = t_bapiad3vl
*     bapiadtel      = t_bapiadtel
*     bapiadfax      = t_bapiadfax
      bapiadsmtp     = t_bapiadsmtp
*     bapiaduri      = t_bapiaduri
      bapicomrem     = t_bapicomrem
      bapiad3vl_x    = tx_bapiad3vlx
*     bapiadtel_x    = tx_bapiadtelx
*     bapiadfax_x    = tx_bapiadfaxx
      bapiadsmt_x    = tx_bapiadsmtx
*     bapiaduri_x    = tx_bapiadurix
      bapicomre_x    = tx_bapicomrex
      return         = t_ret.

6 REPLIES 6
Read only

arindam_m
Active Contributor
0 Likes
1,241

Hi,

The details of values populated is not given but what do you have in the updateflag field is it 'I'.  The pattern would be similar to

CLEAR: bapiadtel, bapiadtel_x.

bapiadtel-consnumber = '002'.

bapiadtel_x-updateflag = 'D'.

APPEND: bapiadtel, bapiadtel_x. "Delete entry

CLEAR: bapiadtel, bapiadtel_x.

bapiadtel-consnumber = '003'.

bapiadtel-extension = '77733'.

bapiadtel_x-extension = 'X'.

bapiadtel_x-updateflag = 'U'.

APPEND: bapiadtel, bapiadtel_x. "Update entry

CLEAR: bapiadtel, bapiadtel_x.

bapiadtel-telephone = '06227'.

bapiadtel-extension = '11111'.

bapiadtel_x-updateflag = 'I'.

APPEND: bapiadtel, bapiadtel_x. "Insert new entry

Also you mentioned

...which requires the partner number (which obviously doesn't exist yet)

I think we need the partner first to add, update the related information. Please create the same using  BAPI_BPCONTACT_CREATEFROMDATA.

Cheers,

Arindam

Read only

Former Member
0 Likes
1,241

I believe BAPI_BPCONTACT_CREATEFROMDATA is for creating sale activities? I've used this in the past. This is the code I used to fill the table.

   "Create new Email addresses

    "Email

    tx_bapiadsmtx-e_mail     = 'X'.

    tx_bapiadsmtx-consnumber = 'X'.

    tx_bapiadsmtx-updateflag = 'I'.



    "Comments

    t_bapicomrem-langu       = sy-langu.

    t_bapicomrem-langu_iso   = sy-langu.

    t_bapicomrem-comm_type   = 'INT'.

    "X Flags

    tx_bapicomrex-langu      = 'X'.

    tx_bapicomrex-langu_iso  = 'X'.

    tx_bapicomrex-consnumber = 'X'.

    tx_bapicomrex-comm_notes = 'X'.

    tx_bapicomrex-comm_type  = 'X'.

    tx_bapicomrex-updateflag = 'I'.



    IF t_vend-email IS NOT INITIAL.

      t_bapiadsmtp-std_no     = 'X'.

      tx_bapiadsmtx-std_no    = 'X'.

      t_bapiadsmtp-home_flag  = 'X'.

      tx_bapiadsmtx-home_flag = 'X'.

      "First Email

      t_bapiadsmtp-consnumber = '001'.

      t_bapiadsmtp-e_mail     = '[email protected]'.

      t_bapicomrem-consnumber = '001'.

      t_bapicomrem-comm_notes = 'test email description'.

      APPEND: t_bapiadsmtp, tx_bapiadsmtx, t_bapicomrem, tx_bapicomrex.

      CLEAR: t_bapiadsmtp-std_no, tx_bapiadsmtx-std_no, t_bapiadsmtp-home_flag, tx_bapiadsmtx-home_flag.

    ENDIF.

Read only

arindam_m
Active Contributor
0 Likes
1,241

Hi,

Yes that true.. I think you need to populate the Object details first similar to

* Choose the following customer contact person address object types and

* object key:

  objtype_p  = 'BUS1006001'

  obj_id_p   = <person number (KNVK)>

  objtype_c  = 'KNA1'

  obj_id_c   = <customer number>

  obj_id_ext = ' '

  context    = '0005'

The parameter obj_id_p   = <person number (KNVK)> that what is missing i think in your case the Customer Master Contact Partner has to exist I think.

Cheers,

Arindam

Read only

Former Member
0 Likes
1,241

Yep since I don't have a person number yet then I don't think this is the right BAPI.. haven't seen one that would work for vendor either

Read only

arindam_m
Active Contributor
0 Likes
1,241

Check out if you have these in you system

ISAI_CONTACT_CREATE

ISA_USER_CREATE

ERP_WEC_USER_CREATE

Cheers,

Arindam

Read only

Former Member
0 Likes
1,241

Hi Brad Gorlicki,

I had the same issue and tried with all possible ways.

At last I used BDC for t code 'MAP1', it is specially to create contact persons for vendor. It worked for me. Make sure to check the field 'Use central address management' while recording. It helps you to give telephone, email, etc details.

Regards,

Meena