What a mistake! Exception CX_SY_DYN_CALL_ILLEGAL_TYPE [SAP]

SAP ECC 6.0 - SAP_BASIS 700

I wrote a new method GET_HANDLING_UNIT for ZCL_PCC_SD_DELIVERY class. Basically it gets the handling unit numbers for the delivery. I have used HU_GET_HUS function module inside the method; after investigation how handling units tracking data is selected in function module XSI_E1EDL49, it seemed the best and the proper way to select handling units is to use HU_GET_HUS function module.

Giving different parameters the function module HU_GET_HUS can get handling unit header and items data for you.

Then I finished the method and wanted to test in directly in SE24. Created the class/object instance, then click GET_HANDLIN_UNIT method, then immediately I got a popup says:

Exception CX_SY_NO_HANDLER triggered
An exception with the type CX_SY_DYN_CALL_ILLEGAL_TYPE occur

I thought all right there is a type conflict and improper usage somewhere. I checked all import and export parameters type, compared with function module interface types and my variables type. But nothing seemed wrong to me! So tried different things: Different table types, giving lt_hum_venum[] instead of lt_hum_venum for an import internal table parameter.

Debug and debug… Even actually there is nothing to debug for the function module. Intelligent SAP catches the error immediately.

Then I started to eliminate each parameter. Then it worked if I did not use the parameters that I need. Suddenly I saw it, I saw what wrong!

I called the function module like that:

CALL FUNCTION ‘HU_GET_HUS’
EXPORTING
if_no_loop = lc_false
it_venum = lt_hum_venum
IMPORTING
et_header = ext_hu_header
et_items = ext_hu_header
EXCEPTIONS
hus_locked = 1
no_hu_found = 2
fatal_error = 3
OTHERS = 4.

But it must be like that:

CALL FUNCTION ‘HU_GET_HUS’
EXPORTING
if_no_loop = lc_false
it_venum = lt_hum_venum[]
IMPORTING
et_header = ext_hu_header[]
et_items = ext_hu_items[]
EXCEPTIONS
hus_locked = 1
no_hu_found = 2
fatal_error = 3
OTHERS = 4.

Did you see the difference! It took me some time to see the difference! What my mistake is I used ext_hu_header for parameter et_items. What I a mistake! Why doesn’t the exception handler tell which parameter is wrong?

It happens sometimes. When you are tried, you cannot able to see with your eyes. You need a refresh air, coffee, etc. Rest your brain! Take a time break!

Tags: , , , , , ,

2 Responses to “What a mistake! Exception CX_SY_DYN_CALL_ILLEGAL_TYPE [SAP]”

  1. Dawis Says:

    At least you saw what ws wrong in the end..
    This code gives me the same exception…
    and types are equivalent I am sure..
    CALL FUNCTION ‘CRM_PARTNER_READ_OW’
    EXPORTING
    iv_ref_guid = lv_header_guid
    iv_ref_kind = ‘A’”lv_ref_kind “for header
    iv_partner_pft = ‘Z0000035′”lv_partner_fct “RDC/FDC
    IMPORTING
    es_partner_wrk = ls_rdc_partner_wrk
    EXCEPTIONS
    error_occurred = 1
    parameter_error = 2
    entry_does_not_exist = 3
    OTHERS = 4.

  2. Dawis Says:

    you were right - It does happens when you are tired..

    For the whole time I was using iv_partner_PFT instead of iv_partner_FCT..

    Damn right - why would it not give you info about which parameter was wrong..

    I was allready starting to believe there is whole new dimension of SAP I do not know about and this is first instance I met with that dimension.. Luckily it had nothing to do with DESTINATION keyword

Leave a Reply