Skip to Content
author's profile photo Former Member
Former Member

Problem While creating Customer Using BAPI need help

Dear Abaper


gating error while Creating customer BAPI


error like : - No reference customer exists for sales area 1011 06 00

so need help to create Customer


*&---------------------------------------------------------------------*

*& Report ZTEST_CUSTOMER_OTHER_WAIST

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT ZTEST_CUSTOMER.

Data : cpd like bapikna101_1 OCCURS 0 WITH HEADER LINE,

ocpd like bapikna105 occurs 0 with header line,

ccd like bapikna106 occurs 0 WITH HEADER LINE,

occd LIKE bapikna105 occurs 0 WITH HEADER LINE,

acm LIKE bapikna107 occurs 0 WITH HEADER LINE,

rd LIKE bapikna102 occurs 0 WITH HEADER LINE,

UCCD LIKE bapikna108 occurs 0 WITH HEADER LINE.

data : return like BAPIRETURN1 occurs 0 with header line.

data : begin of it_error occurs 0,

err_msg(73) type c, "TO RETREIVE ERROR MESSAGES

end of it_error.

data : begin of it_success occurs 0,

CUSTOMERNO like BAPIKNA103-CUSTOMER ,

srno(4),

end of it_success.

data : CUSTOMERNO like BAPIKNA103-CUSTOMER.

data: tot_rec type i, "Total Records

gd_update type i, "Main Table Increement Counter

gd_lines type i, "Success Table increement Counter

w_textout like t100-text. "VARIABLE TO GET ERRORLOG

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS:p_file TYPE rlgrap-filename.

SELECTION-SCREEN END OF BLOCK b1.

"________________________________________________

" Customer Personal Data

cpd-title_p = 'Company'.

cpd-firstname = 'Sri Raghavendra Stationary & Gen. Store'.

cpd-lastname = '13-2, Main Road,Toopran-502334,Dist: Medak (A.P.)'.

cpd-middlename = '.'.

cpd-secondname = '.'.

*cpd-date_birth =

cpd-city = 'TOOPRAN'.

*cpd-district =

cpd-postl_cod1 = '502334'.

*cpd-postl_cod2 =

*cpd-po_box =

*cpd-po_box_cit =

cpd-street = ' '.

*cpd-house_no =

*cpd-building =

*cpd-floor =

*cpd-room_no =

cpd-country = 'IN'.

*cpd-countryiso =

cpd-region = 'AP'.

cpd-tel1_numbr = '9490867337'.

*cpd-tel1_ext =

*cpd-fax_number =

*cpd-fax_extens =

cpd-e_mail = 'dheeraj.late1@gmail.com'.

cpd-langu_p =

cpd-langup_iso =

cpd-currency = 'INR'.

*cpd-currency_iso =

*cpd-currency_iso =

*cpd-title_key =

*cpd-only_change_comaddress =

APPEND CPD.

"_____________________ " Optional Customer Personal Data

*ocpd-TRANSPZONE =

ocpd-CONTROL_ACCOUNT = '20402010'.

"ocpd-PMNTTRMS =

ocpd-SHIP_COND = '01'.

ocpd-DELYG_PLNT = '1108'.

ocpd-PART_DLV = '9'.

*ocpd-C_CTR_AREA =

*ocpd-TAXJURCODE =

APPEND OCPD.

"__________________ Customer Company Data,

CCD-TITLE = 'Company'.

*CCD-TITLE_KEY =

CCD-NAME = 'Sri Raghavendra Stationary & Gen. Store'.

CCD-NAME_2 = '13-2, Main Road,'.

CCD-NAME_3 = 'Toopran-502334,'.

CCD-NAME_4 = 'Dist: Medak (A.P.)'.

"CCD-C_O_NAME =

CCD-CITY =' TOOPRAN'.

CCD-DISTRICT = ''.

"CCD-CITY_NO =

CCD-POSTL_COD1 = '502334'.

"CCD-POSTL_COD2 =

"CCD-PO_BOX =

"CCD-DELIV_DIS =

CCD-STREET = ''.

*CCD-HOUSE_NO =

*CCD-BUILDING =

*CCD-FLOOR =

*CCD-ROOM_NO =

CCD-COUNTRY = 'IN'.

CCD-LANGU = 'EN'.

CCD-REGION = 'AP'.

CCD-TEL1_NUMBR = '9490867337'.

*CCD-TEL1_EXT =

*CCD-FAX_NUMBER =

*CCD-FAX_EXTENS =

CCD-E_MAIL = 'N@A'.

*CCD-COUNTRYISO =

*CCD-LANGU_ISO =

*CCD-CURRENCY =

*CCD-CURRENCY_ISO =

APPEND CCD.

***"" _______________Optional Customer Company Data,

*

**OCCD-TRANSPZONE =

OCCD-CONTROL_ACCOUNT = '20402010'.

**OCCD-PMNTTRMS =

OCCD-SHIP_COND = '01'.

OCCD-DELYG_PLNT = '1108'.

OCCD-PART_DLV = '9'.

**OCCD-C_CTR_AREA =

**OCCD-TAXJURCODE =

APPEND OCCD.

"___________________"Allow Consumer Maintenance

ACM-consumer_flag = 'X'.

APPEND ACM.

"______________________Reference Data

rd-SALESORG = '1011'.

rd-DISTR_CHAN = '06' .

rd-DIVISION = '00'.

rd-REF_CUSTMR = '142645' .

APPEND RD.

"__________________"update_credit_control_data

uccd-x_flag = 'X'.

APPEND UCCD.

"_________________________________

CALL FUNCTION 'BAPI_CUSTOMER_CREATEFROMDATA1'

EXPORTING

pi_personaldata = cpd

PI_OPT_PERSONALDATA = ocpd

PI_COMPANYDATA = ccd

PI_OPT_COMPANYDATA = occd

PI_CONSUMEREN = ACM

pi_copyreference = RD

PI_CREDIT_CONTROL_FLAG = UCCD

IMPORTING

CUSTOMERNO = CUSTOMERNO

RETURN = RETURN

.

**loop at RETURN.

*

* loop at RETURN.

READ TABLE return.

write : RETURN-MESSAGE.

* ENDLOOP.

if CUSTOMERNO <> space.

commit work.

add 1 to gd_update.

commit work.

it_success-CUSTOMERNO = CUSTOMERNO.

" it_success-srno = tab-srno.

append it_success.

else.

"__________________________

loop at return.

it_error-err_msg = return-message .

append it_error.

ENDLOOP.

ENDIF.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on May 11, 2015 at 10:54 AM

    Hi,

    Please check if the customer 142645 exist for sales organization 1011, distribution channel 06 and division 00. If it does not exist, you will have to use a customer that exists for the sales area appearing in the error.

    When using BAPI to create customer, a reference customer is required which will be used to get company code data, tax code and other reminder data for the newly created customer.

    Hope this helps,

    ~Athreya

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.