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 Cutomer with BAPI

Former Member
0 Likes
527

Hi,

I need to create a customer with an external customer number (phone number). I have tried using BAPI_CUSTOMER_CREATEFROMDATA1 and got an exception of CX_SY_DYN_CALL_ILLEGAL_TYPE type. the value of cxIllegalDynCallType->parameter is 'RETURN'.

What is wrong in my code?

Note: The company needs to distinguish its customers by their phone numbers. The customer calling the company will be recognized from its phone number by the telephony application and the customer will be asked to enter his order using the phone keypad.

my code is:

data cxIllegalDynCallType type ref to CX_SY_DYN_CALL_ILLEGAL_TYPE.

data cxSyDynCallParamMissing type ref to CX_SY_DYN_CALL_PARAM_MISSING.

data cxRoot type ref to CX_ROOT.

personalData-firstname = 'Tolga'.

personalData-lastname = 'Akıncı'.

personalData-city = 'İzmir'.

personalData-po_box = '35120'.

personalData-street = 'Atatürk Bulvarı'.

personalData-house_no = '13'.

personalData-tel1_numbr = '3881756'.

optionalPersonalData-delyg_plnt = '5001'.

optionalPersonalData-ship_cond = '01'.

copyReference-salesorg = '5000'.

copyReference-distr_chan = '01'.

copyReference-division = '02'.

copyReference-ref_custmr = '2323309823'.

try.

CALL FUNCTION 'BAPI_CUSTOMER_CREATEFROMDATA1'

EXPORTING

PI_PERSONALDATA = personalData

PI_OPT_PERSONALDATA = optionalPersonalData

PI_COPYREFERENCE = copyReference

IMPORTING

CUSTOMERNO = customerNo

RETURN = bapiResult.

if sy-subrc = 0.

endif.

catch CX_SY_DYN_CALL_ILLEGAL_TYPE into cxIllegalDynCallType.

write cxIllegalDynCallType->parameter.

catch CX_SY_DYN_CALL_PARAM_MISSING into cxSyDynCallParamMissing.

write cxSyDynCallParamMissing->parameter.

catch CX_ROOT into cxRoot.

write cxRoot->cx_root.

endtry.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
485

Hi,

Can you show the declaration for the bapiResult ?

It should be:

data: bapiResult type BAPIRETURN1.

Regards,

Ravi

3 REPLIES 3
Read only

Former Member
0 Likes
486

Hi,

Can you show the declaration for the bapiResult ?

It should be:

data: bapiResult type BAPIRETURN1.

Regards,

Ravi

Read only

0 Likes
485

it was of type bapireturn. i corrected it and got a message in bapiresult saying 'Fill all the requeired fields'. where can i supply the customer no?

thanks,

Read only

0 Likes
485

Hi,

I think it is not asking for the customer number. There must be some other field that is mandatory. Try to create a Customer with the same data you have through the transaction Xd01 and see what exactly is it asking for.

Regards,

Ravi