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

problem with alv report code using function

Former Member
0 Likes
562

Output is not displaying in the grid. I am getting empty Grid. The code i had written is

-


REPORT ZBPALV.

type-pools SLIS.

data: w_fcat type slis_fieldcat_alv,

t_fcat type slis_t_fieldcat_alv.

w_fcat-fieldname = 'kunnr'.

w_fcat-seltext_m = 'Customer'.

append w_fcat to t_fcat.

data: begin of ty_kna1 occurs 100,

kunnr type kunnr,

end of ty_kna1.

select kunnr from kna1 into table ty_kna1.

*loop at ty_kna1.

*

*write: ty_kna1-kunnr.

*

*endloop.

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 =

IT_FIELDCAT = t_fcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = ty_kna1

  • 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.

-


can any one help me on this issue

Thanks in advance

1 ACCEPTED SOLUTION
Read only

amit_khare
Active Contributor
0 Likes
519

Hi,

Just make following change.

w_fcat-fieldname = '<b>KUNNR</b>'.

w_fcat-seltext_m = 'Customer'.

Regards,

Amit

6 REPLIES 6
Read only

amit_khare
Active Contributor
0 Likes
520

Hi,

Just make following change.

w_fcat-fieldname = '<b>KUNNR</b>'.

w_fcat-seltext_m = 'Customer'.

Regards,

Amit

Read only

Former Member
0 Likes
519

Hi,

Pass

data: ws_repid like sy-repid.

ws_repid = sy-repid.

I_CALLBACK_PROGRAM = ws_repid

Regards

Subramanian

Read only

Former Member
0 Likes
519

HI,

Change upper case of 'kunnr'.

w_fcat-fieldname = 'KUNNR'.

regards

sarath

Read only

Former Member
0 Likes
519

Hi,

Check this modified code..

type-pools SLIS.

data: w_fcat type slis_fieldcat_alv,

t_fcat type slis_t_fieldcat_alv.

w_fcat-fieldname = 'KUNNR'.

w_fcat-seltext_m = 'Customer'.

append w_fcat to t_fcat.

data: begin of ty_kna1 occurs 100,

kunnr type kunnr,

end of ty_kna1.

select kunnr from kna1 into table ty_kna1.

*loop at ty_kna1.

*

*write: ty_kna1-kunnr.

*

*endloop.

data: s_layout type slis_layout_alv.

s_layout-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

IS_LAYOUT = s_layout

IT_FIELDCAT = t_fcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = ty_kna1

  • 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.

THanks,

Naren

Read only

Clemenss
Active Contributor
0 Likes
519

Hi,

I think most ALV errors are caused by bas field catalog. Best is to build standard field catalog and then modify:


CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_structure_name = 'KNA1'
  CHANGING
    ct_fieldcat = t_fcat
  EXCEPTIONS
    others = 0.
delete t_fcat where not fieldname = 'KUNNR'.

This field catalog has much more: F1 Help, I/O Conversion and everything.

Regards,

Clemens

Read only

Former Member
0 Likes
519

data : repid like sy-repid.

repid = sy-repid.

w_fcat-fieldname = 'KUNNR'.

w_fcat-seltext_m = 'Customer'.

w_fcat-col_pos = 1.

append w_fcat to t_fcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = 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 =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = t_fcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = ty_kna1

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

  • 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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = ty_kna1

  • 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.

if it does not work after the changes i have told justcheck in debug mode whether your itab is getting populated or not. before calling the reuse alv in debug mode.

regards

shiba dutta