Skip to Content
0
Former Member
Apr 01, 2008 at 06:09 AM

Problem with FM 'REUSE_ALV_FIELDCATALOG_MERGE'

14 Views

Hi all,

I am using FM REUSE_ALV_FIELDCATALOG_MERGE to build catalog automatically in my program.But it is not working .My program is giving dump at this FM.Can anyone please help me in this regard .

Points assured.

I am pasting my whole code below.

report zhalvfinal.

tables:lfa1,ekko,ekpo.

types:begin of itab,

lifnr type lifnr,

name1 type name1,

land1 type land1,

ebeln type ebeln,

ebelp type ebelp,

matnr type matnr,

menge type bstmg,

netwr type bwert,

end of itab.

data:ws_repid type sy-repid value 'ZHALVFINAL'.

data: i_itab type standard table of itab. " with header line .

type-pools : slis.

data: lt_fieldcat type slis_t_fieldcat_alv,

lf_fieldcat type slis_fieldcat_alv.

*data: lh_index like lf_fieldcat-col_pos.

data: l_layout type slis_layout_alv.

data : l_sort type slis_t_sortinfo_alv,

w_sort type slis_sortinfo_alv.

selection-screen begin of block b with frame title text-001.

selection-screen skip 2.

select-options: s_lifnr for lfa1-lifnr.

*parameters:p_lifnr type lfa1-lifnr.

*select-options:s_lifnr for lfa1-lifnr with no-intervals.

selection-screen end of block b.

start-of-selection.

perform fetch_data.

perform fieldcatalog.

perform display.

end-of-selection.

perform fetch_data.

&----


*& Form fetch_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form fetch_data .

select lfa1~lifnr

lfa1~name1

lfa1~land1

ekko~ebeln

ekpo~ebelp

ekpo~matnr

ekpo~menge

ekpo~netwr

from lfa1

inner join ekko on

lfa1lifnr = ekkolifnr

inner join ekpo on

ekkoebeln = ekpoebeln

into table i_itab

where lfa1~lifnr in s_lifnr.

endform. " fetch_data

&----


*& Form fieldcatalog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form fieldcatalog .

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = ws_repid

i_internal_tabname = i_itab

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = ws_repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

changing

ct_fieldcat = lt_fieldcat

exceptions

inconsistent_interface = 1

program_error = 2

others = 3

.

if sy-subrc <> 0.

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

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

endif.

  • clear lf_fieldcat.

  • lf_fieldcat-fieldname = 'LIFNR'.

  • lf_fieldcat-ref_tabname = 'LFA1'.

  • lf_fieldcat-ref_fieldname = 'LIFNR'.

  • lf_fieldcat-fix_column = 'X'.

  • lf_fieldcat-emphasize = 'C210'.

  • lf_fieldcat-col_pos = 4.

*

  • append lf_fieldcat to lt_fieldcat.

*

  • clear lf_fieldcat.

  • lf_fieldcat-fieldname = 'NAME1'.

  • lf_fieldcat-ref_tabname = 'LFA1'.

  • lf_fieldcat-ref_fieldname = 'NAME1'.

  • lf_fieldcat-fix_column = 'X'.

  • lf_fieldcat-emphasize = 'C310'.

*

  • append lf_fieldcat to lt_fieldcat.

*

  • clear lf_fieldcat.

  • lf_fieldcat-fieldname = 'LAND1'.

  • lf_fieldcat-ref_tabname = 'LFA1'.

  • lf_fieldcat-ref_fieldname = 'LAND1'.

  • lf_fieldcat-fix_column = 'X'.

  • lf_fieldcat-emphasize = 'C410'.

*

  • append lf_fieldcat to lt_fieldcat.

*

*

  • clear lf_fieldcat.

  • lf_fieldcat-fieldname = 'EBELN'.

  • lf_fieldcat-ref_tabname = 'EKKO'.

  • lf_fieldcat-ref_fieldname = 'EBELN'.

  • lf_fieldcat-fix_column = 'X'.

  • lf_fieldcat-emphasize = 'C510'.

  • lf_fieldcat-do_sum = 'X'.

*

  • append lf_fieldcat to lt_fieldcat.

*

*

  • clear lf_fieldcat.

  • lf_fieldcat-fieldname = 'EBELP'.

  • lf_fieldcat-ref_tabname = 'EKPO'.

  • lf_fieldcat-ref_fieldname = 'EBELP'.

  • lf_fieldcat-fix_column = 'X'.

  • lf_fieldcat-emphasize = 'C510'.

  • lf_fieldcat-do_sum = 'X'.

*

  • append lf_fieldcat to lt_fieldcat.

*

*

  • clear lf_fieldcat.

  • lf_fieldcat-fieldname = 'MATNR'.

  • lf_fieldcat-ref_tabname = 'EKPO'.

  • lf_fieldcat-ref_fieldname = 'MATNR'.

  • lf_fieldcat-fix_column = 'X'.

  • lf_fieldcat-emphasize = 'C510'.

  • lf_fieldcat-do_sum = 'X'.

*

  • append lf_fieldcat to lt_fieldcat.

*

  • clear lf_fieldcat.

  • lf_fieldcat-fieldname = 'MENGE'.

  • lf_fieldcat-ref_tabname = 'EKPO'.

  • lf_fieldcat-ref_fieldname = 'MENGE'.

  • lf_fieldcat-fix_column = 'X'.

  • lf_fieldcat-qfieldname = 'MEINS'.

  • lf_fieldcat-emphasize = 'C510'.

  • lf_fieldcat-do_sum = 'X'.

*

  • append lf_fieldcat to lt_fieldcat.

*

  • clear lf_fieldcat.

  • lf_fieldcat-fieldname = 'NETWR'.

  • lf_fieldcat-ref_tabname = 'EKPO'.

  • lf_fieldcat-ref_fieldname = 'NETWR'.

  • lf_fieldcat-fix_column = 'X'.

  • lf_fieldcat-seltext_l = 'SUM OF PRICE'.

  • lf_fieldcat-emphasize = 'C510'.

  • lf_fieldcat-do_sum = 'X'.

  • *

    • append lf_fieldcat to lt_fieldcat.

    endform. " fieldcatalog

    &----


    *& Form DISPLAY

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form display .

    call function 'REUSE_ALV_GRID_DISPLAY'

    exporting

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER = ' '

    • I_BUFFER_ACTIVE = ' '

    i_callback_program = ws_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 = lt_fieldcat

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • I_SAVE = 'X'

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