cancel
Showing results for 
Search instead for 
Did you mean: 

Type conflict when calling a function module (field length)

Former Member
0 Kudos

Dear All,

I am getting this following error while executing: Type conflict when calling a function module (field length)

This is piece of coding i have writern in my action button.

method SEARCH_MATERIAL .

data:

node_mat_input TYPE REF TO if_wd_context_node,

node_mat_output TYPE REF TO if_wd_context_node,

material TYPE BAPIMATDET-MATERIAL,

itab TYPE TABLE OF BAPIMATDOA.

node_mat_input = wd_context->get_child_node( 'NODE_MAT_INPUT' ).

node_mat_output = wd_context->get_child_node( 'NODE_MAT_OUTPUT' ).

node_mat_input->get_attribute( EXPORTING name = 'MATERIAL'

IMPORTING value = material ).

CALL FUNCTION 'BAPI_MATERIAL_GET_DETAIL'

EXPORTING

material = material

  • PLANT = plant

  • VALUATIONAREA =

  • VALUATIONTYPE =

  • MATERIAL_EVG =

IMPORTING

MATERIAL_GENERAL_DATA = itab

  • RETURN =

  • MATERIALPLANTDATA =

  • MATERIALVALUATIONDATA =

.

node_mat_output->bind_table( itab ).

endmethod.

Attributes are:

Node name = INPUT its structure is BAPIMATDET

INPUT attributes = MATERIAL of type BAPIMATDET-MATERIAL

Thanks,

Gopi.

Accepted Solutions (1)

Accepted Solutions (1)

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

the exporting paramter MATERIAL_GENERAL_DATA is of structure type BAPIMATDOA.

so u need to declare a structure variable only.

The decalration which you have declared

data:itab TYPE TABLE OF BAPIMATDOA.

so itab becomes a table here.

u need to declare as

data: itab TYPE BAPIMATDOA.

now pass the value to the BAPI.

Priya

Former Member
0 Kudos

Hi,

I have tried. It shows exception itab type not compatible.

when i use service call to populate data, it shows itab[] is not an internal table. Please try with this bapi bapi_material_getdetails and let me say whether data is populating or not?

thanks,

Gopi.

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Please do in this way:

data :ls_data TYPE BAPIMATDOA."structure

lt_data type table of BAPIMATDOA."table

CALL FUNCTION 'BAPI_MATERIAL_GET_DETAIL'

EXPORTING

material = material

  • PLANT = plant

  • VALUATIONAREA =

  • VALUATIONTYPE =

  • MATERIAL_EVG =

IMPORTING

MATERIAL_GENERAL_DATA = ls_data

  • RETURN =

  • MATERIALPLANTDATA =

  • MATERIALVALUATIONDATA =

.

append ls_data to lt_data.

node_mat_output->bind_table( lt_data. ).

the node is also of the same structure type BAPIMATDOA rght?

Priya

Former Member
0 Kudos

Hi,

Great. Problem solved. Thanks for all.

Thanks,

Gopi.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Amit,

I have used service call to fetch records from that bapi..

but the problem is I am getting the following error while compiling...

" stru_c_materialplantdata " is not an internal table - the " OCCOURS n" specification is missing.

Thanks,

Gopi.

Former Member
0 Kudos

hi ,

As earlier stated as well , this is because of the wrong data declarations , which are not matching the IMPORT parameters.

Do the DATA declaration like this :


Data: lv_matgendata like BAPIMATDOA,
         lv_matplantdat like BAPIMATDOC,
         lv_matvaldat like BAPIMATDOBEW,
        d_return like BAPIRETURN.

and pass this in ur IMPORTING PARAMETER:


 IMPORTING
   MATERIAL_GENERAL_DATA       = lv_matgendata
   RETURN                                        =  d_return
   MATERIALPLANTDATA               =  lv_matplantdat
   MATERIALVALUATIONDATA       =  lv_matvaldat .

u wud be successfully able to use the BAPI .

regards,

amit

Former Member
0 Kudos

Hi Amit,

I have used service call to fetch records from that bapi..

The following is the code generated by service call:-

METHOD execute_bapi_material_get_deta .

  • declarations for context navigation

DATA:

node_bapi_material_get_de TYPE REF TO if_wd_context_node,

node_exporting TYPE REF TO if_wd_context_node,

node_material_general_dat TYPE REF TO if_wd_context_node,

node_importing TYPE REF TO if_wd_context_node,

lri_element TYPE REF TO if_wd_context_element.

  • declarations for fuba parameters

data:

stru_c_material_general_dat TYPE if_componentcontroller=>element_material_general_dat.

DATA:

attr_material TYPE bapimatdet-material,

attr_plant TYPE bapimatall-plant.

  • get all involved child nodes

node_bapi_material_get_de = wd_context->get_child_node( `BAPI_MATERIAL_GET_DE` ).

node_exporting = node_bapi_material_get_de->get_child_node( `EXPORTING` ).

node_material_general_dat = node_exporting->get_child_node( `MATERIAL_GENERAL_DAT` ).

node_importing = node_bapi_material_get_de->get_child_node( `IMPORTING` ).

  • get input from context

node_importing->get_attribute( EXPORTING name = `MATERIAL`

IMPORTING value = attr_material ).

node_importing->get_attribute( EXPORTING name = `PLANT`

IMPORTING value = attr_plant ).

  • the invocation - errors are always fatal !!!

CALL FUNCTION 'BAPI_MATERIAL_GET_DETAIL'

EXPORTING

material = attr_material

plant = attr_plant

" valuationarea = wd_This->Valuationarea

" valuationtype = wd_This->Valuationtype

" material_Evg = wd_This->Material_Evg

IMPORTING

material_general_data = stru_c_material_general_dat

" return = wd_This->Return

" materialplantdata = wd_This->Materialplantdata

" materialvaluationdata = wd_This->Materialvaluationdat

.

node_material_general_dat->bind_structure( stru_c_material_general_dat[] ).

ENDMETHOD.

but the problem is I am getting the following error while compiling...

" stru_c_materialplantdata " is not an internal table - the " OCCOURS n" specification is missing.

Thanks,

Gopi.

Edited by: Yegalaivan on Nov 18, 2009 8:30 AM

Former Member
0 Kudos

hi,

U need to define like this.

data:
    stru_c_material_general_dat    TYPE if_componentcontroller=>elements_material_general_dat.

Former Member
0 Kudos

ya i have already defined like the same wat u suggested..

Thanks,

Gopi

Former Member
0 Kudos

hi,

but in the code provided u r using this:

data:
    stru_c_material_general_dat    TYPE if_componentcontroller=>element_material_general_dat.

U have to use elements not element.

if_componentcontroller=>elements_material_general_dat

please try it once

Former Member
0 Kudos

hi ,

CALL FUNCTION 'BAPI_MATERIAL_GET_DETAIL'

EXPORTING

material = material

  • PLANT = plant

  • VALUATIONAREA =

  • VALUATIONTYPE =

  • MATERIAL_EVG =

IMPORTING

MATERIAL_GENERAL_DATA = itab

in the IMPORTING parameter MATERIAL_GENERAL_DATA , u r passing the itab value . the error is coming because of that

check with the type of the importing parameter and do DATA declarations of tht type , thn u wont get the exception

definition TYPE CONFLICT :

"

Somewhere you're passing a variable to a function parameter and they don't share the same definition.

So check each variable you're passing to the function against the function parameters. "

regards,

amit

Former Member
0 Kudos

Try with : Data itab TYPE BAPIMATDOA.

Former Member
0 Kudos

Hi,

Try using..

Data itab like BAPIMATDOA.