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: 

Problem with FM 'REUSE_ALV_FIELDCATALOG_MERGE'

Former Member
0 Kudos

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.

6 REPLIES 6

Former Member
0 Kudos

Hi,

I have also faced same problem. Your program should not exceed more than 71 lines horizontally. Please check the lines.

'Reward if it is useful'

Thanks,

Brunda

0 Kudos

Hi ,

Pass the name of the internal table in quotes.

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = ws_repid

i_internal_tabname = 'I_TAB'

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.

Edited by: Mohammed Ahasanullah Mulla on Apr 1, 2008 8:21 AM

Edited by: Mohammed Ahasanullah Mulla on Apr 1, 2008 8:30 AM

Former Member
0 Kudos

Hi,

The problem is that the internal table i_itab is not having a header line.

u r getting the dump because the FM REUSE_ALV_FIELDCATALOG_MERGE is unable build the fieldcat lt_fieldcat.

declare the internal table with header line and you will get the ALV display in the output.

reward points if useful.

Regards,

Phani.

venkat_o
Active Contributor
0 Kudos

Hi Amaradeep, Please check the code. I have just changed ur fieldcatalog portion. Its working. You can build fieldcatalog internal table either by using the FM 'REUSE_ALV_FIELDCATALOG_MERGE' or manually. I have used second one.


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: 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:  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.
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
*----------------------------------------------------------------------*
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
  lfa1~lifnr = ekko~lifnr
  INNER JOIN ekpo ON
  ekko~ebeln = ekpo~ebeln
  INTO TABLE i_itab
  WHERE lfa1~lifnr IN s_lifnr.

ENDFORM. " fetch_data
*&---------------------------------------------------------------------*
*&      Form  fieldcatalog
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM fieldcatalog .

  PERFORM field_catalog_1 USING:
      'I_ITAB' 'LIFNR' 'Account Number of Vendor or Creditor',
      'I_ITAB' 'NAME1' 'Name',
      'I_ITAB' 'LAND1' 'Country Key',
      'I_ITAB' 'EBELN' 'Purchasing Document Number',              "Change Text here
      'I_ITAB' 'EBELP' 'Item Number of Purchasing Document',
      'I_ITAB' 'MATNR' 'Material No',
      'I_ITAB' 'MENGE' 'Purchase Order Quantity',
      'I_ITAB' 'NETWR' 'Net Order Value in PO Currency'.


*  DATA:l_program TYPE sy-repid.
*  l_program = sy-repid.
*  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
*    EXPORTING
*      i_program_name         = l_program
*      i_internal_tabname     = 'I_ITAB'
*      i_inclname             = l_program
*    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
*----------------------------------------------------------------------*
FORM display .
  DATA:l_program TYPE sy-repid.

  l_program = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
     i_callback_program                = l_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                       =  lt_fieldcat
*   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
*   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.

ENDFORM.                    "display

*&---------------------------------------------------------------------*
*&      Form  field_catalog
*&---------------------------------------------------------------------*
FORM field_catalog_1 USING l_table l_field l_text.

  lf_fieldcat-fieldname = l_field.
  lf_fieldcat-tabname   = l_table.
  lf_fieldcat-seltext_m = l_text.

  APPEND lf_fieldcat TO lt_fieldcat.
  CLEAR lf_fieldcat.

ENDFORM.                    " field_catalog
I hope that it helps. Regards, Venkat.O

Former Member
0 Kudos

Hi,

This is your modified code,Just have a look.

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.

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 .

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-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_callback_program = sy-repid

it_fieldcat = lt_fieldcat

tables

t_outtab = i_itab

exceptions

program_error = 1

others = 2

.

endform.

Develop the fieldcatalog either manually or by using function module.

If you want to use function module,pass the internal name within quots to the parameter.

Regards,

Chandu

Former Member
0 Kudos

Hi Amardeep,

Fieldcatalog can be built only from Global structures,i suppose.

So u just do one thing, go to SE11, create a global structure of the same type u want it to be displayed in the ALV.

Then assign that structure name to the I_STRUCTURE parameter in that FM. I hope that will definitely works.

Try this & let me know in case of any concerns.

Dont forget to reward points if helpful.

Pavan.