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: 

The structure _name in the resue_alv_filedcatalog_merge.

Former Member
0 Kudos

Hi

In

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = ALV_PROG_NAME

I_INTERNAL_TABNAME = ALV_ITAB_NAME

I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = ALV_PROG_NAME

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = L_FIELDCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

In parameter I_STRUCTURE_NAME =

if we define the structure like mara ,then filedcatalog is being prepared,

but if we define the structure in the program with types and write that structure in this parameter it is not taking.

but if we want to prepare the filedcatalog with program structure how can we prepare it?

what is the possible cause on not preparing the filedcatalog with the program structure

Thanks

Jatender

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can manually build the fieldcat itab rather than using a dictionary structure.

FIELDNAME refers to the field in your data itab that will be shown in the column

  
 data: fieldcat_ln like line of it_fieldcat,
          col_pos type i.

** column 1 **

  add 1 to col_pos.
  fieldcat_ln-ref_tabname = 'CEPCT'.
  fieldcat_ln-ref_fieldname = 'KTEXT'.
  fieldcat_ln-fieldname = 'KTEXT'.
  fieldcat_ln-do_sum = space.
  fieldcat_ln-col_pos = col_pos.
  fieldcat_ln-no_out = 'X'.
  fieldcat_ln-qfieldname = space.
  fieldcat_ln-reptext_ddic = text-039.
  fieldcat_ln-seltext_l = text-039.
  fieldcat_ln-seltext_m = text-039.
  fieldcat_ln-seltext_s = text-039.

  append fieldcat_ln to it_fieldcat.
  clear fieldcat_ln.

** column 2 etc **

Edited by: Kev Mycock on Jul 15, 2008 5:40 AM

Edited by: Kev Mycock on Jul 15, 2008 5:42 AM

5 REPLIES 5

Former Member
0 Kudos

You can manually build the fieldcat itab rather than using a dictionary structure.

FIELDNAME refers to the field in your data itab that will be shown in the column

  
 data: fieldcat_ln like line of it_fieldcat,
          col_pos type i.

** column 1 **

  add 1 to col_pos.
  fieldcat_ln-ref_tabname = 'CEPCT'.
  fieldcat_ln-ref_fieldname = 'KTEXT'.
  fieldcat_ln-fieldname = 'KTEXT'.
  fieldcat_ln-do_sum = space.
  fieldcat_ln-col_pos = col_pos.
  fieldcat_ln-no_out = 'X'.
  fieldcat_ln-qfieldname = space.
  fieldcat_ln-reptext_ddic = text-039.
  fieldcat_ln-seltext_l = text-039.
  fieldcat_ln-seltext_m = text-039.
  fieldcat_ln-seltext_s = text-039.

  append fieldcat_ln to it_fieldcat.
  clear fieldcat_ln.

** column 2 etc **

Edited by: Kev Mycock on Jul 15, 2008 5:40 AM

Edited by: Kev Mycock on Jul 15, 2008 5:42 AM

Former Member
0 Kudos

hi

following is the reason

If the internal output table is defined via an ABAP/4 Dictionary structure (INCLUDE STRUCTURE struct or LIKE struct), the field catalog can be built-up automatically by passing the structure name.

The field catalog is internally built up for this structure as follows:

All fields are in the list (NO_OUT = SPACE) except fields of data type CLNT.

The key fields of the Dictionary structure are also key fields in the field catalog.

Dictionary references to unit fields are copied if the reference fields are in the structure.

If a field catalog is also passed as parameter, the structure information is combined with this field catalog.

For further information about the automatic build-up of the field catalog, see the documentation of the function module REUSE_ALV_FIELDCATALOG_MERGE.

for more info goto the documnetation of this FM

Cheers

Snehi

Former Member
0 Kudos

Hi,

To build fieldcatalog programatically, you need to write the below code

For every filed u need to do like this. In this way u can build the catalog. Assign this gt_fieldcat to the 'REUSE_ALV_GRID_DISPLAY'.

PERFORM   build_fldcat  USING c_tab_nam 
                                                  c_knuma
                                                  'Agreement'(007) 
                                                   'Agr.No'(036).

  PERFORM   build_fldcat  USING c_tab_nam 
                                                  c_zzagrcat
                                                  'Category'(010) 
                                                  'Catg'(037).

  PERFORM   build_fldcat  USING c_tab_nam 
                                                  c_vkorg
                                                  'Sales Organization'(017)  
                                                  'S.Org'(038).

FORM build_fldcat  USING    pv_tabnam
                                          pv_fldnam
                                          pv_seltxt_l
                                          pv_seltxt_s.

  CLEAR gs_fieldcat.
  gs_fieldcat-tabname     = pv_tabnam.
  gs_fieldcat-fieldname   = pv_fldnam.
  gs_fieldcat-seltext_l   = pv_seltxt_l.
  gs_fieldcat-seltext_s   = pv_seltxt_s.
  APPEND gs_fieldcat TO  gt_fieldcat.

ENDFORM.                    " BUILD_FIELDCAT

Thanks,

Shailaja

Former Member
0 Kudos

hiiii

you can define your own structure there



DATA:
    i_fieldcat     TYPE slis_t_fieldcat_alv,
    wa_fieldcat    LIKE LINE OF i_fieldcat,
wa_output TYPE type_output,
  i_output  TYPE STANDARD TABLE OF type_output,
    wa_layout      TYPE slis_layout_alv,  "Layout
    wa_variant     TYPE disvariant.

  wa_variant-report = sy-repid.

  wa_layout-colwidth_optimize = 'X'.
  wa_layout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
   EXPORTING
     i_program_name               = sy-repid
     i_internal_tabname           = 'I_OUTPUT'
   i_structure_name             = 'I_OUTPUT'
*   I_CLIENT_NEVER_DISPLAY       = 'X'
*   I_INCLNAME                   = sy-repid
*   I_BYPASSING_BUFFER           =
*   I_BUFFER_ACTIVE              =
    CHANGING
      ct_fieldcat                  = i_fieldcat
 EXCEPTIONS
   inconsistent_interface       = 1
   program_error                = 2
   OTHERS                       = 3

regards

twinkal

Edited by: twinkal patel on Jul 15, 2008 11:58 AM

Former Member
0 Kudos

u can prepare the field catalog with program structure by using the FM REUSE_ALV_FIELDCATALOG_MERGE.

Check this code sample:

1. 1st declare the type for the internal table

types: begin of ty_purchasing,

vrsio like s012-vrsio, " Version number in the

" info structure

spwoc like s012-spwoc, " Period to analyze-week

ekorg like s012-ekorg, " Purchasing organization

lifnr like s012-lifnr, " Vendor no.

matnr like s012-matnr, " Material no.

werks like s012-werks, " Plant

basme like s012-basme, " Base unit of measure

menge like s012-menge, " Purchase order quantity

netwr like s012-netwr, " Effective order value

name1 like lfa1-name1, " Vendor name

maktx like makt-maktx, " Material description

ekgrp like marc-ekgrp, " Purchasing group

end of ty_purchasing.

All fields must be declared with LIKE not with TYPE otherwise FM

REUSE_ALV_FIELDCATALOG_MERGE will not work.

2. Define the internal table

data: i_purchasing type standard table of ty_purchasing initial size 0.

3. Pass the internal table name to fm REUSE_ALV_FIELDCATALOG_MERGE

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = sy-repid " Internal table

" declaration program

i_internal_tabname = 'I_PURCHASING'" Output table name

changing

ct_fieldcat = i_fieldcat " Field catalog with

" field descriptions

exceptions

inconsistent_interface = 1

program_error = 2

others = 3

.

if sy-subrc <> 0.

message i000 with text-012. " Error using function

" module REUSE_ALV_

" FIELDCATALOG_MERGE

leave list-processing.

endif.

Regards,

joy.