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

type conflict when calling a function module

Former Member
0 Likes
2,016

Hi,

i am getting type conflict error while executing the code, please help out to go my practice forward

REPORT ztest_m03_inner_joins.
TYPE-POOLS: slis.
TABLES: vbrk, vbrp.
TYPES: BEGIN OF ty_vbrk,
vbeln TYPE vbeln_vf,
fkart TYPE fkart,
fktyp TYPE fktyp,
vbtyp TYPE vbtyp,
END OF ty_vbrk.

TYPES:BEGIN OF ty_vbrp,
vbeln TYPE vbeln_vf,
posnr TYPE posnr,
fkimg TYPE fkimg,
vrkme TYPE vrkme,
END OF ty_vbrp.

TYPES: BEGIN OF ty_out,
vbeln TYPE vbeln_vf,
fkart TYPE fkart,
fktyp TYPE fktyp,
vbtyp TYPE vbtyp,
posnr TYPE posnr,
fkimg TYPE fkimg,
vrkme TYPE vrkme,
END OF ty_out.

DATA: wa_out TYPE ty_out,
it_out TYPE TABLE OF ty_out,

wa_fcat TYPE slis_fieldcat_alv,
it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

SELECT-OPTIONS: s_vbeln FOR vbrk-vbeln.

START-OF-SELECTION.


wa_fcat-col_pos = 1.
wa_fcat-fieldname = 'VBELN'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'BILLING DOC NO'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat-col_pos = 2.
wa_fcat-fieldname = 'FKART'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'BILLING TYPE'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat-col_pos = 3.
wa_fcat-fieldname = 'FKTYP'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'BILLING CATAGERY'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat-col_pos = 4.
wa_fcat-fieldname = 'VBTYP'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'SD DOCUMENT CATAGERY'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat-col_pos = 5.
wa_fcat-fieldname = 'VBTYP'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'SD DOCUMENT CATAGERY'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat-col_pos = 6.
wa_fcat-fieldname = 'POSNR'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'BILLING ITEM'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat-col_pos = 7.
wa_fcat-fieldname = 'FKIMG'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'QUANTITY'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat-col_pos = 8.
wa_fcat-fieldname = 'VRKME'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'SALES UNIT'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.


SELECT a~vbeln
fkart
fktyp
vbtyp
posnr
fkimg
vrkme FROM vbrk AS a INNER JOIN vbrp AS b
ON a~vbeln = b~vbeln INTO TABLE it_out UP TO 30 ROWS
WHERE a~vbeln IN s_vbeln.

*END-OF-SELECTION.
*DATA: tb_lines TYPE i.
*DESCRIBE TABLE it_out LINES tb_lines.
*WRITE: 'NO.OF RECORDS', tb_lines.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fcat

TABLES
t_outtab = it_out
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.


5 REPLIES 5
Read only

FredericGirod
Active Contributor
1,887

Hi,

when you have a type conflict, you have a dump. Inside the dump, you will have the description of the type conflic, the FM & the field. Start from here, read your dump (trans ST22)

Read only

bhanuprakash5
Explorer
1,887

Hi,

You are calling 'REUSE_ALV_GRID_DISPLAY' Function module with wrong input parameter. With header line is not necessary for your requirement.

Try removing with header line in the declaration for it_fcat.

Data: it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

Try this

Data: it_fcat TYPE slis_t_fieldcat_alv.
Read only

1,887

You are nice to say "With header line is not necessary for your requirement", because it's just completely obsolete since 7.0 (2005), essentially because it's error prone (good experience for the OP, I hope he will never do it again :-D).

Read only

Former Member
0 Likes
1,887

Hi,

1.Remove with header line.

it_fcat TYPE slis_t_fieldcat_alv." WITH HEADER LINE.

2.and also remove duplicate field catalog

wa_fcat-col_pos = 4.
wa_fcat-fieldname = 'VBTYP'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'SD DOCUMENT CATAGERY'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat-col_pos = 5.
wa_fcat-fieldname = 'VBTYP'.
wa_fcat-tabname = 'IT_OUT'.
wa_fcat-seltext_m = 'SD DOCUMENT CATAGERY'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

Read only

ascm
Explorer
0 Likes
1,887
data g_vblen type vbrk-vbeln.

select-options: s_vbeln for g_vblen .

select vbrk~vbeln, fkart, fktyp, vbtyp, posnr, fkimg, vrkme
       from vbrk inner join vbrp
       on vbrk~vbeln = vbrp~vbeln
       where vbrk~vbeln in @s_vbeln
       into table @data(db_values) up to 30 rows.


try.
    cl_salv_table=>factory( exporting list_display   = if_salv_c_bool_sap=>false
                            importing r_salv_table   = data(salv)
                            changing t_table        =  db_values ).


    salv->get_functions( )->set_all( ).
    salv->display( ).
  catch cx_salv_msg cx_salv_not_found.
endtry.

1. The TYPE-POOLS-Statement isn't needed. The system includes all Type-Pools!

2. Forget the Tabels-Statement

3. Why not using the SALV-Framework for output?