cancel
Showing results for 
Search instead for 
Did you mean: 

Type compatible error

Former Member
0 Kudos

Hi All,

I am getting this following error:

Error :'Customer' in not type- compatible with formal parameter 'KUNNR'.

here both Customer and KUNNR is of type kna1-kunnr.

can any one tell me why do i get this error....

Thanks,

Susil.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Still i am getting the same error.. Error :'lv_Customer' in not type- compatible with formal parameter 'KUNNR'.

Component1:

method EXECUTE_CUSTOMER .

data:

node_input type ref to if_wd_context_node,

node_output type ref to if_wd_context_node,

node_visible TYPE REF TO if_wd_context_node,

it_kunnr type kna1-kunnr,

itab type table of kna1.

node_input = wd_context->get_child_node( name = 'CUST_INPUT' ).

node_output = wd_context->get_child_node( name = 'CUST_OUTPUT' ).

node_input->get_attribute( EXPORTING name = 'KUNNR'

IMPORTING value = iT_KUNNR ).

SELECT * FROM KNA1 into table itab WHERE kunnr = it_kunnr.

node_output->bind_table( itab ).

endmethod.

Parameter i passed here is KUNNR of type kna1-kunnr.

In the below action i am calling that method of component1..

Component 2

ONACTIONCALL METHOD:

DATA lo_nd_cust_input TYPE REF TO if_wd_context_node.

DATA lo_el_cust_input TYPE REF TO if_wd_context_element.

DATA ls_cust_input TYPE wd_this->element_cust_input.

DATA lv_CUSTOMER LIKE ls_cust_input-KUNNR.

  • navigate from <CONTEXT> to <CUST_INPUT> via lead selection

lo_nd_cust_input = wd_context->get_child_node( Name = IF_REUSEVIEW=>wdctx_Cust_Input ).

  • get element via lead selection

lo_el_cust_input = lo_nd_cust_input->get_element( ).

  • get single attribute

lo_el_cust_input->get_attribute(

EXPORTING

name = `KUNNR`

IMPORTING

value = lv_customer ).

DATA: l_ref_INTERFACECONTROLLER TYPE REF TO ZIWCI_DEMO_WDA .

l_ref_INTERFACECONTROLLER = wd_This->wd_CpIfc_Reuse( ).

l_ref_INTERFACECONTROLLER->Execute_Customer(

KUNNR = lv_customer " Ref to kna1-kunnr

).

endmethod.

I have mapped the same node from the component 1 to component 2...

Can any one help me?

Thanks,

Susil.

Former Member
0 Kudos

What is the data type/DE you have given for both of the below ones...

DATA lv_CUSTOMER LIKE ls_cust_input-KUNNR. "DE for this lv_customer

Parameter i passed here is KUNNR of type kna1-kunnr. "DE for this ..

Are they referring to same DE...

I guess the probelm is here...

Have you decalred this KUNNAR as importgin parameter for execute methiod or not...

If yes, then it should be of type TYPE not TYPE REF TO...

l_ref_INTERFACECONTROLLER->Execute_Customer(

KUNNR = lv_customer " Ref to kna1-kunnr

).

Edited by: Lekha on Nov 30, 2009 4:43 PM

Former Member
0 Kudos

Hi Lekha,

Thank you for your reply. My problem is solved..

Problem was- In the importing parameter I have specified as Type Ref to instead of Type.

Thanks,

Susil.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

This is the following code which i used pass the parameter from component to other...

method CALLMETHOD .

data:

node_input type REF TO if_wd_context_node.

node_input = wd_context->get_child_node( 'CUST_INPUT' ).

data customer type kna1-kunnr.

node_input->get_attribute( EXPORTING name = 'KUNNR'

IMPORTING value = customer ).

DATA: l_ref_INTERFACECONTROLLER TYPE REF TO ZIWCI_DEMO_WDA .

l_ref_INTERFACECONTROLLER = wd_This->wd_CpIfc_Reuse( ).

l_ref_INTERFACECONTROLLER->Execute_Customer( KUNNR = customer " Ref to kna1-kunnr

).

endmethod.

Thanks,

Susil.

Former Member
0 Kudos

hi Susil ,

instead of

data customer type kna1-kunnr.

do it like


DATA ls_cust_input TYPE wd_this->element_cust_input.
    DATA CUSTOMER  LIKE ls_cust_input-KUNNR.

where ls_cust_input is a structure which is like the node cust_input of my context

this is the code u shud try , it shud work perfect


// node cust_input and a context attribute KUNNR under it 
DATA lo_nd_cust_input TYPE REF TO if_wd_context_node.
    DATA lo_el_cust_input TYPE REF TO if_wd_context_element.
    DATA ls_cust_input TYPE wd_this->element_cust_input.
    DATA lv_CUSTOMER  LIKE ls_cust_input -CUSTOMER.
*   navigate from <CONTEXT> to <CUST_INPUT> via lead selection
    lo_nd_cust_input = wd_context->get_child_node( name = wd_this->wdctx_kunnr).
 
*   get element via lead selection
    lo_el_cust_input= lo_nd_cust_input->get_element(  ).
 
*   get single attribute
    lo_el_cust_input->get_attribute(
      EXPORTING
        name =  `KUNNR`
      IMPORTING
        value = customer ).

regards,

amit

Former Member
0 Kudos

Hi Amit,

I have used your code.. but i am getting the following error:

error: field wdctx_kunnr is unknown. It is neither one of the specified table nor defined by the DATA statement...

and can u please explain me the codes.. i dont understand why we are using it...

Thanks,

Susil.

Former Member
0 Kudos
l_ref_INTERFACECONTROLLER->Execute_Customer( KUNNR = customer

Check out the type of kunnr in the method execute_customer.

Type of boht Kunnr and Customer which you are giving to this method should be same.

If they are same, it should not be a problem

Former Member
0 Kudos

hi

lo_nd_cust_input = wd_context->get_child_node( name = wd_this->wdctx_kunnr).

actually we r doing a data declartion of type if_wd_context_node and thn we ar moving to the context node

so as to read th attributes using get_attribute method

I believe u r using the context node CUST_INPUT and reading the context attribute KUNNR under it , so do it like :

this code is automatically generated using code wizard :

1 press CONTROL + F7

2 click on the radio button Read context node/ attribute

3 press F4

4 choose the attribute under ur context node, which u want to get/set using the wizard

regards,

amit

0 Kudos

Hi Sushil,

You can just use the code provided by Amit with a small correction.

lo_nd_cust_input = wd_context->get_child_node( name = wd_this->wdctx_kunnr).

Instead of the above line just use this line

lo_nd_cust_input = wd_context->get_child_node( name = wd_this->wdctx_cust_input).

Then your error will be gone.

Former Member
0 Kudos

hi


lo_nd_cust_input = wd_context->get_child_node( name = wd_this->wdctx_cust_input).

do like this , as mentioned in earlier reply to the thread

this code wud be automatically generated thru code wizard

cheers:)

regards,

amit

0 Kudos

Could you provide the code where you are getting this error?