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

regarding alv

Former Member
0 Likes
1,018

hi experts,

i am using reuse_alv_fieldcatalog_merge in my alv report.

i am getting the output.but if i want to add some features of fieldcatalog for some fields of alv like it_fieldcatalog-hotspot,

it_fieldcatalog-dosum,

it_fieldcatalog-edit, how can i modify the field catalog

or how can i add these features to fieldcatalog.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
992

Simply loop at the interna table of your field catalog and set the values.

Loop at it_fc into wa_fc.

  if wa_Fc-fieldname = 'SOME_FIELD'.
     wa_fc-do_sum = 'X'.
  endif.

  modify it_Fc from wa_fc index sy-tabix.

endloop.

Regards,

RIch Heilman

hi experts,

i am using reuse_alv_fieldcatalog_merge in my alv report.

i am getting the output.but if i want to add some features of fieldcatalog for some fields of alv like it_fieldcatalog-hotspot,

it_fieldcatalog-dosum,

it_fieldcatalog-edit, how can i modify the field catalog

or how can i add these features to fieldcatalog.

6 REPLIES 6
Read only

Former Member
0 Likes
992

u will get an output from the FM right. then loop at that, and do whatever modifications u wnat to do.

see below code.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = REPORTNAME

I_INTERNAL_TABNAME = 'SHIP-TAB'

I_INCLNAME = DATAREP

CHANGING

CT_FIELDCAT = FIELDST

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3.

LOOP AT FIELDST INTO L_FIELDS.

L_TABIX = SY-TABIX.

L_FIELDS-KEY = ' '.

CASE L_FIELDS-FIELDNAME.

WHEN 'VBELN'.

L_FIELDS-KEY = 'X'.

WHEN 'POSNR'.

L_FIELDS-KEY = 'X'.

WHEN 'ETENR'.

L_FIELDS-KEY = 'X'.

WHEN 'FIRSTDTE'.

L_FIELDS-SELTEXT_L = TEXT-H01.

L_FIELDS-SELTEXT_M = TEXT-H01.

L_FIELDS-SELTEXT_S = TEXT-H01.

L_FIELDS-REPTEXT_DDIC = TEXT-H01.

WHEN 'ERSDA'.

L_FIELDS-SELTEXT_L = TEXT-H02.

L_FIELDS-SELTEXT_M = TEXT-H02.

L_FIELDS-SELTEXT_S = TEXT-H02.

L_FIELDS-REPTEXT_DDIC = TEXT-H02.

ENDCASE.

MODIFY FIELDST FROM L_FIELDS INDEX L_TABIX.

ENDLOOP.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
993

Simply loop at the interna table of your field catalog and set the values.

Loop at it_fc into wa_fc.

  if wa_Fc-fieldname = 'SOME_FIELD'.
     wa_fc-do_sum = 'X'.
  endif.

  modify it_Fc from wa_fc index sy-tabix.

endloop.

Regards,

RIch Heilman

Read only

former_member219399
Active Participant
0 Likes
992

Hi,

try this coding...

LOOP AT lt_fieldcat INTO ls_fieldcat.

IF ls_fieldcat-fieldname = ur field name.

ls_fieldcat-hotspot = char_x.

MODIFY lt_fieldcat FROM ls_fieldcat.

CLEAR ls_fieldcat.

ENDIF.

ENDLOOP.

Read only

Former Member
0 Likes
992

hi

chk this thread

Read only

Former Member
0 Likes
992

Hi Narasimha,

Ur internal table that r u passing in FM is of type <b>SLIS_T_FIELDCAT_ALV</b> . It is having field :

<b> hotspot_fieldname type slis_fieldname</b>

Mark this field as 'X".and modify the field catalog table.

U can do the same thing with other options also.

Reward pointsf helpful.

Regards,

Hemant

Read only

Former Member
0 Likes
992

Hi,

Refer to the following code:

data: iline type table of zstock with header line.

data: gt_fieldcat type slis_t_fieldcat_alv.

perform setup-fieldcatalog using gt_fieldcat[].

form setup-fieldcatalog using fieldcat type slist_fieldcat_alv.

data: ls_fieldcat type slis_fieldcat_alv.

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_internal_tabname = 'ILINE'

i_structure_name = 'ZSTOCK'

changing

ct_fieldcat = _fieldcat.

loop at fieldcat into lsfieldcat.

case ls_fieldcat-fieldname.

when 'DEPT'.

ls_fieldcat-no_out = 'X'.

when 'DESCR'.

ls_fieldcat-no_out = 'X'.

when 'GOOD_PRD'.

ls_fieldcat-do_sum = 'X'.

endcase.

modify fieldcat from lsfieldcat.

endloop.

endform. " FIELDCATALOG

Hope this helps.

Reward if helpful.

Regards,

Sipra