BAPI_CUSTOMER_CREATEFROMDATA1

I'm trying to use BAPI_CUSTOMER_CREATEFROMDATA1 to update the customer master. 
This does not work asking message the referencing customer number does not exist on the sales master.
Since I want to create a new customer, I have nothing to reference do I? 
I then switched and tried sub-function module inside the one above called SD_CUSTOMER_MAINTAIN_ALL and this update and created a new customer number with appropriate data.
This function module alone does not update the 'View' so when I try to view the newly created customer number in VD01 and the screen dumps saying the DYNPRO not found.
Has anyone had this error and maybe the best way to use ABAP to create/change a customer master record.

I still receive error message "889Internal error: Ref. customer does not exist in comp.code master record' even after filling in all fields on PI_OPT_PERSONALDATA.  Any ideas?
I've pasted my code below.
REPORT  ZINC_TEST_SETUP_TABLE.
Data:
      personaldata like BAPIKNA101_1,
      personalopt  like BAPIKNA105,
      copyref      like BAPIKNA102,
      message      like bapireturn1,
      SORTL LIKE KNA1-SOrtL,
      custnumber(10) type c.
      personaldata-firstname = 'RYAN FIRST NAME'.
      personaldata-lastname = 'SPACE'.
      personaldata-CITY      = 'GRAND RAPIDS'.
      personaldata-POSTL_COD1 = '49508'.
      personaldata-STREET    = '44th'.
      personaldata-country = 'US'.
      personaldata-REGION = 'US'.
      personaldata-CURRENCY = 'USD'.
      personaldata-LANGU_P = 'EN'.
      personalopt-TRANSPZONE = '1111'.
      personalopt-CONTROL_ACCOUNT = 'Z003'.
      personalopt-PMNTTRMS = 'MI'.
      personalopt-SHIP_COND = 'MI'.
      personalopt-DELYG_PLNT = 'MI'.
      personalopt-PART_DLV = 'MI'.
      personalopt-C_CTR_AREA = 'MI'.
      personalopt-TAXJURCODE = 'MI'.
      copyref-salesorg = '1000'.
      copyref-distr_chan = '10'.
      copyref-division = '01'.
    copyref-REF_CUSTMR = '0000022492'.
     Call function 'BAPI_CUSTOMER_CREATEFROMDATA1'
           exporting
           PI_PERSONALDATA =       personaldata
           PI_OPT_PERSONALDATA =   personalopt
           PI_COPYREFERENCE    = copyref
           importing
            CUSTOMERNO     = custnumber
           return         =  message.
           Write custnumber.

Similar Messages

  • Creation of customer using BAPI_CUSTOMER_CREATEFROMDATA1

    hi Techies..
    i want to create customer in effects in KNA1.
    iam using FM "BAPI_CUSTOMER_CREATEFROMDATA1".
    first is it correct one to create customer.
    nxt is the mandat fields given in documentation and mandat fields while we create through XD01 are different.
    plz list out mandat fields i need to pass...
    plz anyone help me out wts process of creation of customer through this bapi..
    Thanks in Adv..
    Raju Mummidi

    HI
    Re: BAPI function create Customer master(T-code XD01)??
    For XD01-- account group and customer number are mandatory.
    Re: BAPI for creating customers
    Regards
    Pavan

  • Problem with BAPI_CUSTOMER_CREATEFROMDATA1 using JCo on IDES

    sorry, wrong board - i opened a new post
    Problem with BAPI_CUSTOMER_CREATEFROMDATA1 using JCo on IDES
    Hello everyone,
    we are working on a student project and would like to create customers (debtors) in an SAP IDES system.
    Using the ref-customer to copy from, and some personal-data below, we get the error message
    'Internal error: External no.assignment for reference customer/customer'
    We also tried with BAPI_CUSTOMER_GETINTNUMBER, and ACCOUNTGROUP ZINT (New Internet Customer, others won't work?). But CREATEFROMDATA1 takes no CustomerNo created this way, nor it wants to create one 'internal'?
    Any suggestions? Thanks a lot for your help,
    Greetings,
    Tobias Schmidbauer
              inParams = function.getImportParameterList().getStructure(
                   "PI_COPYREFERENCE");
              inParams.setValue("0000001000", "REF_CUSTMR");
              inParams.setValue("1000", "SALESORG");
              inParams.setValue("10", "DISTR_CHAN");
              inParams.setValue("00", "DIVISION");
              inParams =function.getImportParameterList().getStructure(
                   "PI_PERSONALDATA");
              inParams.setValue("Simpson", "LASTNAME");
              inParams.setValue("Homer", "FIRSTNAME");
              inParams.setValue("Jay","MIDDLENAME");
              inParams.setValue("Springfield", "CITY");
              inParams.setValue("DE", "LANGU_P");
              inParams.setValue("DE", "LANGUP_ISO");
              inParams.setValue("DE", "COUNTRY");
              inParams.setValue("EUR", "CURRENCY");
              inParams.setValue("12345", "POSTL_COD1");
    Message was edited by: Tobias Schmidbauer

    Hello Brian,
    Thanks for your pointer. Actually The customer's reference number i was providing in the PI_COPYREFERENCE structure was a sold-to party customer and it uses external customer number assignment. When i used "New Internet Customer" (that doesnt use external assignment by default) as customer's account group, the customer was created successfully and assigned customer number was returned.
    I want to ask now how could we give a customer number in the BAPI as i am unable to find any such column in any of the tables. (Customer number is an "out" parameter so it can only return the number of created customer). Secondly, how to chnage the external assignment property of a particular account group (like sold-to party). i.e, how could we change the account group configurations through SAP GUI??
    - Umair

  • Regarding BAPI_CUSTOMER_CREATEFROMDATA1 Urgent Issue

    Hi all,
    I am using BAPI_CUSTOMER_CREATEFROMDATA1 to create customers from the portal.
    I have given a reference customer in the PI_COPYREFERENCE structure along with sales area information.
    But the BAPI gives an error message like no tax records exist for the reference customer.
    I am working in UAE, and here we dont have tax. So we dont maintain tax records anywhere.
    How to overcome this issue?
    Can anyone help me out?
    Thanks alot
    Shobin

    Hi
    Pls go thru this code. hope it will sove ur issue.
    Reward if help.
    FUNCTION z_bapi_customer_create.
    ""Interface local:
    *" IMPORTING
    *" VALUE(I_KNA1) LIKE KNA1 STRUCTURE KNA1 OPTIONAL
    *" VALUE(I_KNB1) LIKE KNB1 STRUCTURE KNB1 OPTIONAL
    *" VALUE(I_KNVV) LIKE KNVV STRUCTURE KNVV OPTIONAL
    *" EXPORTING
    *" VALUE(E_KUNNR) LIKE KNA1-KUNNR
    *" REFERENCE(O_KNA1) LIKE KNA1 STRUCTURE KNA1
    *" REFERENCE(RETURN) LIKE BAPIRETURN1 STRUCTURE BAPIRETURN1
    *" TABLES
    *" T_XKNVI STRUCTURE FKNVI OPTIONAL
    *" T_XKNB5 STRUCTURE FKNB5 OPTIONAL
    -(1) initial routines -
    data declaration: fields, items, tables:
    DATA: subrc LIKE sy-subrc,
    credit_control_flag LIKE bapikna108-x_flag value 'X',
    postflag LIKE wdl_flag-xflag.
    (ii) reset exporting data and sy-subrc
    CLEAR: return,
    sy-subrc.
    (iii) fill temporary interface data i_bapikna1_0x, i_bapikna10x
    (in the following: importing data unchanged, work only with
    temporary interface data)
    (iv) reset data of function kernel
    CLEAR: i_kna1,
    i_knb1,
    i_knvv.
    REFRESH:
    t_xknbk,
    t_xknvi,
    t_xknvk,
    t_xknvp,
    t_xknb5.
    -(2) work routines -
    call "check function"
    (ii) fill exporting data of "kernel function"
    (iii) call "kernel function" post synchron (postflag = X)
    i_kna1-land1 = 'BR'.
    i_kna1-name1 = 'Nome'.
    i_kna1-ort01 = 'Abaetetuba'.
    i_kna1-pstlz = '099999999'.
    i_kna1-regio = 'PA'.
    i_kna1-sortl = 'Conceito'.
    i_kna1-stras = 'Rua'.
    i_kna1-mcod1 = 'Nome'.
    i_kna1-mcod2 = 'Abaetetuba'.
    i_kna1-mcod3 = 'Sr.'.
    i_kna1-brsch = '01'.
    i_kna1-ktokd = '0021'.
    i_kna1-spras = 'P'.
    i_kna1-stcd2 = '999'.
    i_kna1-lzone = 'AC00000001'.
    i_kna1-stkzn = 'X'.
    i_kna1-txjcd = 'NN'.
    i_kna1-duefl = 'X'.
    i_kna1-civve = 'X'.
    i_kna1-brsch = 'AG05'.
    i_kna1-anred = 'Sr.'.
    i_knvv-vkorg = 'MY01'.
    i_knvv-vtweg = 'Z5'.
    i_knvv-spart = 'Z7'.
    i_knvv-versg = '1'.
    i_knvv-kalks = '1'.
    i_knvv-kdgrp = '02'.
    i_knvv-bzirk = 'CLIE'.
    i_knvv-pltyp = '02'.
    i_knvv-awahr = '100'.
    i_knvv-antlf = '9'.
    i_knvv-kzazu = 'X'.
    i_knvv-vsbed = '01'.
    i_knvv-perfk = '01'.
    i_knvv-waers = 'BRL'.
    i_knvv-ktgrd = '01'.
    i_knvv-vwerk = 'MY01'.
    i_knvv-vkgrp = 'LDA'.
    i_knvv-vkbur = 'MSOY'.
    i_knvv-kurst = '001S'.
    i_knvv-kabss = '0001'.
    i_knvv-kkber = 'SE01'.
    i_knb1-bukrs = '4169'.
    i_knb1-akont = '0011411000'.
    i_knb1-akont = '9999999999'.
    i_knb1-zwels = 'C'.
    i_knb1-zterm = '7001'.
    i_knb1-vzskz = '02'.
    i_knb1-fdgrv = 'C1'.
    i_knb1-xzver = 'X'.
    i_knb1-knrze = '0000935002'.
    t_xknvi-aland = 'BR'.
    t_xknvi-tatyp = 'IBRX'.
    t_xknvi-taxkd = '1'.
    APPEND t_xknvi.
    t_xknb5-bukrs = i_knb1-bukrs.
    t_xknb5-mahna = '0001'.
    append t_xknb5.
    postflag = 'X'.
    CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'
    EXPORTING
    i_kna1 = i_kna1
    i_knb1 = i_knb1
    i_knvv = i_knvv
    I_BAPIADDR1 =
    I_BAPIADDR2 =
    I_MAINTAIN_ADDRESS_BY_KNA1 = ' '
    pi_postflag = postflag
    IMPORTING
    e_kunnr = e_kunnr
    o_kna1 = o_kna1
    TABLES
    T_XKNAS =
    T_XKNBK =
    T_XKNB5 = t_xknb5
    T_XKNEX =
    T_XKNVA =
    T_XKNVD =
    t_xknvi = t_xknvi
    T_XKNVK =
    T_XKNVL =
    T_XKNVP =
    T_XKNZA =
    EXCEPTIONS
    client_error = 1
    kna1_incomplete = 2
    knb1_incomplete = 3
    knb5_incomplete = 4
    knvv_incomplete = 5
    kunnr_not_unique = 6
    sales_area_not_unique = 7
    sales_area_not_valid = 8
    insert_update_conflict = 9
    number_assignment_error = 10
    number_not_in_range = 11
    number_range_not_extern = 12
    number_range_not_intern = 13
    account_group_not_valid = 14
    parnr_invalid = 15
    bank_address_invalid = 16
    tax_data_not_valid = 17
    no_authority = 18
    company_code_not_unique = 19
    dunning_data_not_valid = 20
    knb1_reference_invalid = 21
    cam_error = 22
    OTHERS = 23
    (iv) insert the credit control data
    IF credit_control_flag = 'X'
    AND sy-subrc = 0.
    CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_KNKA_K'
    EXPORTING
    PI_REF_CUSTOMER = E_KUNNR
    PI_CUSTOMER = E_KUNNR
    EXCEPTIONS
    KNKA_INSERT_ERROR = 23
    KNKK_INSERT_ERROR = 24.
    CALL FUNCTION 'CREDITCONTROL_INSERT_DEFAULT' IN UPDATE TASK
    EXPORTING
    kunnr = e_kunnr
    kkber = i_knvv-kkber
    knrze = i_knb1-knrze.
    ENDIF.
    (v) return-value "kernel function"
    (1) reset data of function kernel
    CLEAR: i_kna1,
    i_knb1,
    i_knvv.
    I_BAPIADDR1_01,
    I_BAPIADDR2_01.
    (2) error-handling
    return value sy-subrc, only in case sy-subrc = 0
    the exporting data customer_number (customerno)
    will be changed
    subrc = sy-subrc.
    CLEAR sy-subrc.
    -(3) set return values and leave the function -
    customerno (key-field of BO KNA1), pe_customer, return
    PERFORM returnsubrc_1
    USING subrc
    e_kunnr
    CHANGING e_kunnr
    return.
    IF subrc = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    ENDIF.
    ENDFUNCTION.

  • Usage of BAPI BAPI_CUSTOMER_CREATEFROMDATA1

    Hi all,
    I'm thinking to use BAPI BAPI_CUSTOMER_CREATEFROMDATA1 as a call to ECC from 3rd party system.
    I found SAP Note 390045 - Usage of BAPI_CUSTOMER_* of function group V02D
    which says that the BAPI and other FMs in function group V02D is supposed to be used "exclusively for use in the SAP Online Store and the SAP Internet Sales R/3 Edition"
    So my question is if someone used this BAPI in Z* programs in SAP system system.
    If this BAPI is not used can you suggest alternative BAPI for Customer master data creation?
    Thanks.
    m./

    Hi Martin,
    from the function module documentation:
    - Fields of import parameter PI_COPYREFERENCE:
    R/3 reference customer, sales area data (sales organization,
    distribution channel, division)
    Note on reference customer:
    The reference customer should be created bearing in mind that its
    sole purpose is to provide data for customers that are created via
    the BAPI.
    That is, the reference customer is not an operative customer in the
    business sense. As a result, the customer should be created with a
    separate account group with internal number assignment. In addition,
    the reference customer must exist in the organizational data that is
    transferred to the BAPI.
    If company-code-independent data is transferred to the BAPI, the
    reference customer must be created for a company code.
    So, if you have created a reference customer already, you should know the organizational data (Org/DistrChan/Division and Company code).

  • Reg BAPI_CUSTOMER_CREATEFROMDATA1 .. plz hep me...

    I am using BAPI_CUSTOMER_CREATEFROMDATA1 to create customer in 4.7
    I am populating the mandatory fields for this BAPI:
    PI_PERSONALDATA
    PI_COPYREFERENCE
    TITLE_P element in PI_PERSONALDATA is populated with relevant data by checking the contents of table 'TSAD3T' it is internally converting that into Uppercase even if I am providing it as it is in contents of  Data base table.So when I execute I am getting following error message.
    838-Invalid Form of Address Text.
    But when I debug the same  n changed the content of TITLE_P  in subroutine SD_CUSTOMER_CHECK_1 to appropriate case and executed it. It created a customer.
    Is there any way to handle this situation without changing the content of table TSAD3T.
    Thanking you in Advance
    Message was edited by:
            kvg mca

    Hi Piyas,
    Using the BAPI_CUSTOMER_CREATEFROMDATA1 is not recommended because this BAPI doesn't support a lot of fields that are needed to create valid customer master data.
    Though, you are exploring the possibility with this BAPI, I'd like to mention that you may check Function Module documentation on this - use Ctrl+F4.
    Please find below the mandatory inputs - though other fields are also important -
    Thanks,
    Kumar Saurav.

  • BAPI_CUSTOMER_CREATEFROMDATA1 (help)

    when i use the bapi,BAPI_CUSTOMER_CREATEFROMDATA1,we use the parameter PI_COMPANYDATA.
    there is always a error:
    <b>Invalid form of address key.</b>
    any suggestion is welcome.
    if you can give me a complete example it's better.
    thanks very much.

    Hi James,
    You pass an incorrect parameter for <b>PI_COMPANYDATA-TITLE_KEY</b>.
    Please check tables <b>TSAD3 and TSAD3T</b> for available values.
    Hope this will help.
    Regards,
    Ferry Lianto

  • "BAPI_CUSTOMER_CREATEFROMDATA1" Mandatory Fields

    Hi Experts,
    I will be consuming the BAPI "BAPI_CUSTOMER_CREATEFROMDATA1" from an external system, Can someone let me know the mandatory fields to be entered in the BAPI so that the bapi creates a customer.
    It will be really helpful if you could also give in some test data along with it.
    In response you could also send me a screen shot of the fields filled with dummy data in the mandatory fields.
    Thanks in Advance
    Cheers
    Piyas.

    Hi Piyas,
    Using the BAPI_CUSTOMER_CREATEFROMDATA1 is not recommended because this BAPI doesn't support a lot of fields that are needed to create valid customer master data.
    Though, you are exploring the possibility with this BAPI, I'd like to mention that you may check Function Module documentation on this - use Ctrl+F4.
    Please find below the mandatory inputs - though other fields are also important -
    Thanks,
    Kumar Saurav.

  • 'Contact' field in BAPI_CUSTOMER_CREATEFROMDATA1

    hello gurus,
    i have a contact person coming in my flat file. i am creating customer using structure PI_PERSONALDATA. I don't see a field where I can put this 'Contact person'.
    This will be a different contact person as opposed to the customer that I am creating.
    How can I resolve this issue?
    Thanks in advance.
    Regards,
    Eddie
    P.S. Helpful answers will be rewarded.

    Hi Suresh,
    The following is what I got from documentation of BAPI_CUSTOMER_CREATEFROMDATA1.
    One person to be created as a customer:
    With the entered personal data, addresses of type 1 (company address), type 2 (address for a person/private address of a contact person), and type 3 (contact partner address) are created simultaneously in Central Address Management (CAM).
    If the "Allow Consumer Maintenance" indicator is set, then a consumer is created in SAP R/3. (See also: import parameter PI_CONSUMEREN ).
    (a) No consumers to be created:
    The entered personal data has a direct influence on the master data, company code data and <b>contact person data. One contact partner record is created for the customer in question.</b> All the master data, company code data, sales area data, tax code data, and reminder data that is not entered is adopted from a reference customer and from the sales area data (sales organization, distribution channel and division - import parameter PI_COPYREFERENCE).
    I'm not sure what they are implying. But I think there is some way where the contact person is assigned.
    What do you think?
    Regards,
    Eddie.

  • Create new customer using BAPI BAPI_CUSTOMER_CREATEFROMDATA1

    Hi There,
    I am trying to create a new customer in SAP through BAPI for demo purpose. The BAPI function I used is BAPI_CUSTOMER_CREATEFROMDATA1. However, the BAPI call requires a reference customer. How can I find a valid reference customer in SAP? Furthermore, is it correct at all to use this BAPI function to create a new customer? Is there any other BAPI function that I can use to do the same stuff? Thanks a lot in advance for your help!
    Thanks,
    Lei

    Hi,
    I didn't get which system of SAP are you refering to , but as this forum is for CRM i assume that you want to create customer in CRM.
    So for creating a customer in CRM you can use the BAPI,
    BAPI_BUPA_CREATE_FROM_DATA
    and for getting the reference customer jsut execute the following FM in test enviroment to get the Business Partner no and Business Partner GUID.
    CRM_BUPA_CONSUMER_GET_REFERENC
    Hope this helps.
    Regards
    Sidd

  • Create Cutomer with BAPI_CUSTOMER_CREATEFROMDATA1

    Hi,
    I use BAPI_CUSTOMER_CREATEFROMDATA1 to create a customer but i have to supply the PI_COPYREFERENCE parameter of the BAPI. I want to supply all the data myself, don't want to use a reference customer. is it possible? if it's not how can find a reference customer or what can i do if there is no customer to reference?
    thanks all,
    - ferudun

    Hi Ravi,
    What can be done to find a suitable reference customer or what can be done when there is no suitable reference customer?
    thanks,
    - ferudun

  • Regarding BAPI_CUSTOMER_CREATEFROMDATA1

    HI,
      I am using BAPI_CUSTOMER_CREATEFROMDATA1 to create a customer. I am not getting all the fields that require to create a customer. I am not getting the fields like industry,terms of payment,sales district,sales office,price procedure,status group,inco terms. I need all these fields to create a customer. please tell me how can to approach  to create it. Please advice me is there any bapi which is to create it .
    Thank you.
    Regards
    Madhu.

    Hi
    this might not be any solace to you - but with every roll-out we use RFBIDE00 to migrate ALL customer data (incl. banking etc.). it'a batch input ....
    follow this links
    [http://abaplovers.blogspot.com/2008/03/customer-master-bapis-function-modules.html]
    [BAPI_CUSTOMER_CREATEFROMDATA1;
    Regards

  • Problem in customer master creation using BAPI_CUSTOMER_CREATEFROMDATA1

    Hi Guru's...
    i am unable to go forward...
    can you please help me out in this customer master creation....
    what are the fileds i am using while creating in XD01 (account group,name,country)then i am able create and the customer number is autogenerated.
    using same field values i am trying to test the BAPI initially but i am unable to execute the BAPI BAPI_CUSTOMER_CREATEFORMDATA1.
    in this one draw back is when compare to the XD01 peocess is account group.
    account group is mandataory in XD01 process and in BAPI test there i sno field for giving this account group field value.....may be this is one reason....(if it is mandatory where i have to provide in BAPI test..)
    and i tried in BAPI test using customer reference ID also....
    please guide me....
    please let me know if my question is not clear...
    Thanks in advance
    Srinivas...

    thanks rajani ur valuble reply..
    but i am looking for creating at a time 'n' number of customer's using BAPI (the coustomers data will be in flat file in presentation server....)
    please advise me ..
    let me know if my question is not clear...
    thanks in advance
    srinivas....

  • Example of  BAPI_CUSTOMER_CREATEFROMDATA1

    anyone have an example of this bapi?

    Check the table TSAD3T for TITLE_MEDI gives some valid values,.
    If you don't have any valid entries in that table, you will get this mesage.
    Actually in that Function module,
    this part of the code triggers that message:
    <i><b>        SELECT SINGLE * FROM TSAD3T WHERE TITLE_MEDI
                                                   = I_BAPIKNA106-TITLE.
            IF SY-SUBRC NE 0.
              PE_RETURN1-TYPE = 'E'.
              SY-MSGID = C_MSG_ID.
              SY-MSGNO = '838'.
              SY-MSGV1 = SPACE.
              SY-MSGV2 = SPACE.
              SY-MSGV3 = SPACE.
              SY-MSGV4 = SPACE.
            ENDIF.</b></i>

  • BAPI_CUSTOMER_CREATEFROMDATA1 without using pi_copyreference

    Hi Guys
    it seems there is a lot of information about this BAPI on SDN but the question remains
    Is there any way to create a customer in BAckground WITHOUT  using a pi_copyreference.
    I dont know why would SAP want to force the client to put a reference customer in there !
    Is this mandatory? what if I leave it blank?
    Please advise !!

    Hi Ronald,
    With this BAPI all the master data, company code data, sales area data, tax code data, and reminder data that is not entered is adopted from a reference customer and from the sales area data (sales organization, distribution channel and division - import parameter PI_COPYREFERENCE).
    That is, you cannot enter directly the account group, but you can provide the reference customer and this data will be adopted.
    Regards,
    Eli

Maybe you are looking for