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: 

generation of field catalog

Former Member
0 Kudos
160

data:begin of lt_spfli occurs 0,

carrid type spfli-carrid,

connid type spfli-connid,

end of lt_spfli.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = PROG_NAME

I_INTERNAL_TABNAME = 'LT_SPFLI'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = PROG_NAME

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = LT_FIELDCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

here the table lt_spfli is with the header line. when we use the table without the header line, the catalog is not generated.

is there a way to generate catalog by passing the table without the header line?

Please help.

8 REPLIES 8

Former Member
0 Kudos
129

sorry for the inconvnience

Former Member
0 Kudos
129

Hi pramod,

chk this program.Execute in ur system.

&----


*& Report Z_NVK_ALVDEMO

*&

&----


*&

*&

&----


report z_nvk_alvdemo.

type-pools: slis.

tables :vbap.

data: begin of it_vbap occurs 0,

vbeln like vbap-vbeln,

posnr like vbap-posnr,

matnr like vbap-matnr,

matwa like vbap-matwa,

pmatn like vbap-pmatn,

charg like vbap-charg,

matkl like vbap-matkl,

arktx like vbap-arktx,

pstyv like vbap-pstyv,

posar like vbap-posar,

end of it_vbap ,

it_fieldcat type slis_t_fieldcat_alv,

wa_fieldcat type slis_fieldcat_alv,

it_events type slis_t_event,

wa_event type slis_alv_event,

v_top type slis_formname value 'TOP_OF_PAGE'.

data:repid like sy-repid.

parameters : p_list radiobutton group g1,

p_grid radiobutton group g1.

select-options:s_vbeln for vbap-vbeln.

start-of-selection.

select

vbeln

posnr

matnr

matwa

pmatn

charg

matkl

arktx

pstyv

posar

from vbap

into table it_vbap

where vbeln in s_vbeln.

repid = sy-repid.

perform populate_field_cat.

if p_list = 'X'.

perform display_list.

else.

perform display_grid.

endif.

&----


*& Form POPULATE_FIELD_CAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form populate_field_cat .

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = repid

i_internal_tabname = 'IT_VBAP'

  • I_STRUCTURE_NAME = I_STRUCTURE_NAME

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = repid

  • I_BYPASSING_BUFFER = I_BYPASSING_BUFFER

  • I_BUFFER_ACTIVE = I_BUFFER_ACTIVE

changing

ct_fieldcat = it_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.

endform. " POPULATE_FIELD_CAT

&----


*& Form display_list

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display_list .

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

  • I_INTERFACE_CHECK = ' '

i_bypassing_buffer = 'X'

i_buffer_active = ' '

i_callback_program = repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_STRUCTURE_NAME = I_STRUCTURE_NAME

  • IS_LAYOUT = IS_LAYOUT

it_fieldcat = it_fieldcat

  • IT_EXCLUDING = IT_EXCLUDING

  • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

  • IT_SORT = IT_SORT

  • IT_FILTER = IT_FILTER

  • IS_SEL_HIDE = IS_SEL_HIDE

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT = IS_VARIANT

it_events = it_events

  • IT_EVENT_EXIT = IT_EVENT_EXIT

  • IS_PRINT = IS_PRINT

  • IS_REPREP_ID = IS_REPREP_ID

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IR_SALV_LIST_ADAPTER = IR_SALV_LIST_ADAPTER

  • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

  • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

tables

t_outtab = it_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.

endform. " display_list

&----


*& Form display_grid

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display_grid .

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_STRUCTURE_NAME

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE = I_GRID_TITLE

  • I_GRID_SETTINGS = I_GRID_SETTINGS

  • IS_LAYOUT = IS_LAYOUT

it_fieldcat = it_fieldcat

  • IT_EXCLUDING = IT_EXCLUDING

  • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

  • IT_SORT = IT_SORT

  • IT_FILTER = IT_FILTER

  • IS_SEL_HIDE = IS_SEL_HIDE

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT = IS_VARIANT

  • IT_EVENTS = IT_EVENTS

  • IT_EVENT_EXIT = IT_EVENT_EXIT

  • IS_PRINT = IS_PRINT

  • IS_REPREP_ID = 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_ALV_GRAPHICS

  • IT_HYPERLINK = IT_HYPERLINK

  • IT_ADD_FIELDCAT = IT_ADD_FIELDCAT

  • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

  • IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

  • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

tables

t_outtab = it_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.

endform. " display_grid

regards,

keerthi

0 Kudos
129

here the table it_vbap is with the header line ( occurs 0),i wanted to know for the table without the haeder line

Former Member
0 Kudos
129

I think No.

But u can create a structure in Dictionary and use this structue in fieldcatalog merge FM.

it will work.

Regards,

SAI

Former Member
0 Kudos
129

the given solutions are not to the point.

0 Kudos
129

Hi Pramod ,

To create a field catalog for an internal table without header line , the internal table must be defined in the top include , this may seem a bit strange but it works.

Here is the code .

Main porgram

INCLUDE ZAR_TEST1_TOP                           .                      "

start-of-selection.

       report = sy-repid.

call function 'REUSE_ALV_FIELDCATALOG_MERGE'
 exporting
   i_program_name               = report
   i_internal_tabname           = 'IT_1'
*   I_STRUCTURE_NAME             =
*   I_CLIENT_NEVER_DISPLAY       = 'X'
   i_inclname                   = 'ZAR_TEST1_TOP'  " Name of my top include
*   I_BYPASSING_BUFFER           =
*   I_BUFFER_ACTIVE              =
  changing
    ct_fieldcat                  = catalog
 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.

do 10 times.

'ZAR_TEST1_TOP' My top include program

type-pools: slis.

types: begin of ty_1 ,
         matnr like mara-matnr ,
         meins like mara-meins ,
        end of ty_1.

data : it_1 type table of ty_1. " Table wihout header line
data :       catalog type slis_t_fieldcat_alv,
       report type sy-repid.

Hope this helps.

Reward points if reply is helpful.

Regards

Arun

Former Member
0 Kudos
129

hi,

in declaration part u have used type use<b> like</b> in place of type.

just see i have tried ur code by modifying type to like and its working fine.

here i am pasting it.

type-pools : slis.

data:begin of lt_spfli occurs 0,

carrid like spfli-carrid,

connid like spfli-connid,

end of lt_spfli.

select carrid connid from spfli into table lt_spfli up to 10 rows.

data : lt_fieldcat type slis_t_fieldcat_alv.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = sy-repid

I_INTERNAL_TABNAME = 'LT_SPFLI'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = sy-repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = LT_FIELDCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3.

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

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE = I_GRID_TITLE

  • I_GRID_SETTINGS = I_GRID_SETTINGS

  • IS_LAYOUT = IS_LAYOUT

IT_FIELDCAT = lt_fieldcat

  • IT_EXCLUDING = IT_EXCLUDING

  • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

  • IT_SORT = IT_SORT

  • IT_FILTER = IT_FILTER

  • IS_SEL_HIDE = IS_SEL_HIDE

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT = IS_VARIANT

  • IT_EVENTS = IT_EVENTS

  • IT_EVENT_EXIT = IT_EVENT_EXIT

  • IS_PRINT = IS_PRINT

  • IS_REPREP_ID = 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_ALV_GRAPHICS

  • IT_HYPERLINK = IT_HYPERLINK

  • IT_ADD_FIELDCAT = IT_ADD_FIELDCAT

  • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

  • IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

  • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

tables

t_outtab = lt_spfli

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

if helpful reward some points.

thanks.

Praveen.

Former Member
0 Kudos
129

Hi,

Create a Structure of that internal table in the Data Dictionary. and pass that structure name to the 'I_STRUCTURE_NAME' paramter in the FM, pass the internal table without header line, dont know its mandatory or not to pass the internal table.