‎2007 Feb 02 10:09 AM
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.
‎2007 Feb 02 10:12 AM
Hi,
Can you show the declaration for the bapiResult ?
It should be:
data: bapiResult type BAPIRETURN1.
Regards,
Ravi
‎2007 Feb 02 10:12 AM
Hi,
Can you show the declaration for the bapiResult ?
It should be:
data: bapiResult type BAPIRETURN1.
Regards,
Ravi
‎2007 Feb 02 10:22 AM
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,
‎2007 Feb 02 10:26 AM
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