Application Development 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: 

ALV

sreelatha_gullapalli
Active Participant
0 Kudos

hi all

i tried to use alv concept to display the data.

i used the function module reuse_alv_grid_display

but it is showing run time error

here i am including my program

TYPE-POOLS: slis.

PARAMETERS p.

TABLES ztable_main.

TYPES: BEGIN OF itab,

empid TYPE zempid,

empname TYPE zempname,

END OF itab.

TYPES: ty_itab TYPE STANDARD TABLE OF itab.

DATA: it_itab TYPE ty_itab,

wa_itab TYPE itab.

SELECT

zempid

zempname

FROM ztable_main

INTO TABLE it_itab

WHERE zempid = p.

*DATA: ITAB1 TYPE DD02L-TABNAME.

PERFORM grid_display.

&----


*& Form GRID_DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM grid_display .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = 'SY-REPID'

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

i_structure_name = IT_ITAB

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

  • IT_FIELDCAT =

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

i_default = 'X'

i_save = 'A'

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = it_itab

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " GRID_DISPLAY

the error i am getting is:

Short text

Type conflict when calling a function module.

What happened?

A function module was called incorrectly.

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was

not caught in

procedure "GRID_DISPLAY" "(FORM)", nor was it propagated by a RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

The call to the function module "REUSE_ALV_GRID_DISPLAY" is incorrect:

The function module interface allows you to specify only

fields of a particular type under "I_STRUCTURE_NAME".

The field "IT_ITAB" specified here is a different

field type.

can you help me to solve this problem.

thanks and regards

Sreelatha Gullapalli

1 ACCEPTED SOLUTION

ravishankar_reddy2
Active Participant
0 Kudos

Hi sreelatha,

See this Function module,

u will get some idea how to pass values.

g_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = g_repid

i_callback_top_of_page = 'TOP-OF-PAGE'

is_layout = wa_layout

it_fieldcat = it_fieldcat[]

TABLES

t_outtab = it_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

regards,

ravi shankar reddy

9 REPLIES 9

Former Member
0 Kudos

Do not pass anything in I_STRUCTURE_NAME parameter. Just comment it

Former Member
0 Kudos

hi,

ur declaration of types and internal table is not proper

TYPES : BEGIN OF tbseg,

belnr LIKE bseg-belnr,

wrbtr LIKE bseg-wrbtr,

hkont LIKE bseg-hkont,

END OF tbseg.

it create internal table.

DATA : it_bseg TYPE STANDARD TABLE OF tbelnr.

it create work area.

DATA : wam_bseg1 TYPE tbseg1.

and u need to pass internal table in REUSE_ALV_GRID_DISPLAY...

u passing work area.

Former Member
0 Kudos

Hi,

Check out this code,

&----


*& Report ZST_ALV

*&

&----


*&

*&

&----


REPORT ZST_ALV.

type-POOLs: slis.

--


ALV Related Variables--

DATA: lt_fcat TYPE slis_t_fieldcat_alv,

lw_fcat TYPE slis_fieldcat_alv,

lv_variant TYPE disvariant,

lv_layout TYPE slis_layout_alv,

lt_sort type slis_t_sortinfo_alv,

lw_sort type slis_sortinfo_alv.

types: begin of ty_vbap,

vbeln type vbap-vbeln,

posnr type vbap-posnr,

kwmeng type vbap-kwmeng,

umzin type vbap-umzin,

end of ty_vbap.

data: lt_vbap type table of ty_vbap.

start-of-selection.

select vbeln posnr kwmeng umzin

from vbap

into table lt_vbap UP TO 10 ROWS.

sort lt_vbap descending.

clear lw_fcat.

lw_fcat-fieldname = 'VBELN'.

lw_fcat-seltext_l = 'Sales document'.

append lw_fcat to lt_fcat.

clear lw_fcat.

lw_fcat-fieldname = 'POSNR'.

lw_fcat-seltext_l = 'Sales document'.

append lw_fcat to lt_fcat.

clear lw_fcat.

lw_fcat-fieldname = 'KWMENG'.

lw_fcat-seltext_l = 'Sales document'.

lw_fcat-do_sum = 'X'.

lw_fcat-no_zero = 'X'.

append lw_fcat to lt_fcat.

clear lw_fcat.

lw_fcat-fieldname = 'UMZIN'.

lw_fcat-seltext_l = 'Sales document'.

lw_fcat-do_sum = 'X'.

append lw_fcat to lt_fcat.

*lw_sort-spos = 1.

*lw_sort-fieldname = 'VBELN'.

*LW_SORT-Up = 'X'.

*append lw_sort to lt_sort.

clear lw_sort.

lw_sort-spos = 2.

lw_sort-fieldname = 'KWMENG'.

LW_SORT-Up = 'X'.

lw_sort-subtot = 'X'.

append lw_sort to lt_sort.

clear lw_sort.

lw_sort-spos = 3.

lw_sort-fieldname = 'UMZIN'.LW_SORT-Up = 'X'.

lw_sort-subtot = 'X'.

append lw_sort to lt_sort.

lv_layout-totals_text = 'Santosh'.

lv_layout-subtotals_text = 'Thorat'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

IS_LAYOUT = lv_layout

IT_FIELDCAT = lt_fcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

IT_SORT = lt_sort[]

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = lt_vbap

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Former Member
0 Kudos

Hello Sreelatha,

I think you are not passing the field catalog. Also check the callback program you are mentioning it in quotes 'SY-REPID' instead it should be SY_REPID.

do let me know whether it worked

Regards,

Kiran I

Former Member
0 Kudos

Hi,

Your Structure Name is incorrect. It should be Some DDIC Sructure Name. Remove it. AND also create a field catalog and pass it in IT_FIELDCAT.

Regards,

Sachin Bhatnagar

Former Member
0 Kudos

Hi,

Remove Single Quotes for this 'SY-REPID'.

Regards,

Satish

ravishankar_reddy2
Active Participant
0 Kudos

Hi sreelatha,

See this Function module,

u will get some idea how to pass values.

g_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = g_repid

i_callback_top_of_page = 'TOP-OF-PAGE'

is_layout = wa_layout

it_fieldcat = it_fieldcat[]

TABLES

t_outtab = it_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

regards,

ravi shankar reddy

Former Member
0 Kudos

Hi,

In the i_structure_name = IT_ITAB , here u should not give the internal table name u have to fill field catalog table u cannot give ur internal table as structure name .

see the example program

DATA: HFIELD TYPE SLIS_T_FIELDCAT_ALV.

DATA: AFIELD TYPE SLIS_FIELDCAT_ALV.

*

CLEAR AFIELD.

L_COUNT = L_COUNT + 1.

AFIELD-COL_POS = L_COUNT.

AFIELD-FIELDNAME = 'CARRID'.

  • AFIELD-TABNAME = 'XDATA'.

AFIELD-REF_TABNAME = 'SCARR'.

AFIELD-KEY = 'X'. "define field as key

APPEND AFIELD TO XFIELD.

AFIELD-TABNAME = 'HDATA'.

APPEND AFIELD TO HFIELD.

AFIELD-TABNAME = 'LDATA'.

APPEND AFIELD TO LFIELD.

*

and give hfield at

IT_FIELDCAT = hfield

Plzz reward points if it helps.

RoySayak
Active Participant
0 Kudos

Hi Sreelatha,

I think it is helpful to you,

Enable your Exception...

**************************************************************************************************************************

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " GRID_DISPLAY

***************************************************************************************************************************

OTHERWISE....

CATCH CX_SY_DYN_CALL_ILLEGAL_TYPE. "#EC NO_HANDLER

*****************************************************************************reward points if it works*****************

THANKS,

SAYAK..