Skip to Content
0
Former Member
Jul 11, 2007 at 07:53 AM

Reg: ALV Field catalog refresh

312 Views

Hello All,

Initially I have to display an ALV grid. Upon a buttons click(User Command) , an additional col should be displayed for which the field catalog of the ALV needs to be changed. Iam using FM ''REUSE_ALV_GRID_DISPLAY'.My question is , how cld v refresh filedcatalog ? To refresh the grid data , we use selfield-refresh = 'X'. Is there any thing some thing like that to refresh fieldcat or v have to build the fieldcat again?

I have pasted part of code below:

*************************************************************

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_structure_name = 'TRIGS_IGT_WRKLIST'

CHANGING

ct_fieldcat = c_tab_fieldcat_main.

LOOP AT c_tab_fieldcat_main ASSIGNING <l_wa_fieldcat_main>.

IF <l_wa_fieldcat_main>-fieldname = 'BUSTRANSCAT_TEXT' OR

<l_wa_fieldcat_main>-fieldname = 'VALUATION_AREA' OR

<l_wa_fieldcat_main>-fieldname = 'VALUATION_CLASS' OR

<l_wa_fieldcat_main>-fieldname = 'COMPANY_CODE' OR

<l_wa_fieldcat_main>-fieldname = 'PRODUCT_TYPE' OR

<l_wa_fieldcat_main>-fieldname = 'SECURITY_ACCOUNT' OR

<l_wa_fieldcat_main>-fieldname = 'SECURITY_ID' OR

<l_wa_fieldcat_main>-fieldname = 'IGT_STATUS_TEXT' OR

<l_wa_fieldcat_main>-fieldname = 'POSDATE' OR

<l_wa_fieldcat_main>-fieldname = 'TRLDATE' OR

<l_wa_fieldcat_main>-fieldname = 'COMPANY_ID' OR

<l_wa_fieldcat_main>-fieldname = 'COUNTERPARTY' OR

<l_wa_fieldcat_main>-fieldname = 'UNITS' OR

<l_wa_fieldcat_main>-fieldname = 'POSITION_CURR' OR

<l_wa_fieldcat_main>-fieldname = 'DEAL_NUMBER' OR

<l_wa_fieldcat_main>-fieldname = 'POSITION_AMT' .

ELSE.

<l_wa_fieldcat_main>-no_out = 'X'.

ENDIF.

  • Assign postion

IF <l_wa_fieldcat_main>-fieldname = 'BUSTRANSCAT_TEXT'.

<l_wa_fieldcat_main>-col_pos = 2.

<l_wa_fieldcat_main>-ddictxt = 'M'.

<l_wa_fieldcat_main>-outputlen = '5'.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'COMPANY_CODE'.

<l_wa_fieldcat_main>-col_pos = 3.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'VALUATION_AREA'.

<l_wa_fieldcat_main>-col_pos = 4.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'PRODUCT_TYPE'.

<l_wa_fieldcat_main>-col_pos = 5.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'SECURITY_ID'.

<l_wa_fieldcat_main>-col_pos = 6.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'SECURITY_ACCOUNT'.

<l_wa_fieldcat_main>-col_pos = 7.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'DEAL_NUMBER'.

<l_wa_fieldcat_main>-col_pos = 8.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'IGT_STATUS_TEXT'.

<l_wa_fieldcat_main>-col_pos = 9.

<l_wa_fieldcat_main>-ddictxt = 'M'.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'POSDATE'.

<l_wa_fieldcat_main>-col_pos = 10.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'TRLDATE'.

<l_wa_fieldcat_main>-col_pos = 11.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'COMPANY_ID'.

<l_wa_fieldcat_main>-col_pos = 12.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'UNITS'.

<l_wa_fieldcat_main>-col_pos = 13.

ENDIF.

IF <l_wa_fieldcat_main>-fieldname = 'POSITION_AMT'.

<l_wa_fieldcat_main>-col_pos = 14.

ENDIF.

ENDLOOP.

CASE sy-ucomm.

WHEN 'MATCH'.

READ TABLE c_tab_fieldcat_main ASSIGNING <l_wa_fieldcat_main>

WITH KEY fieldname = 'MATCHED'.

CHECK sy-subrc EQ 0.

<l_wa_fieldcat_main>-col_pos = 1.

<l_wa_fieldcat_main>-seltext_s = 'Matched Pairs'.

<l_wa_fieldcat_main>-seltext_m = 'Matched Pairs'.

<l_wa_fieldcat_main>-seltext_l = 'Matched Pairs'.

<l_wa_fieldcat_main>-no_out = ' '.

WHEN 'REVERSAL'.

READ TABLE c_tab_fieldcat_main ASSIGNING <l_wa_fieldcat_main>

WITH KEY fieldname = 'ICON_REVERSAL'.

CHECK sy-subrc EQ 0.

<l_wa_fieldcat_main>-col_pos = 1.

<l_wa_fieldcat_main>-icon = 'X'.

<l_wa_fieldcat_main>-outputlen = 3.

<l_wa_fieldcat_main>-no_out = ' '.

ENDCASE.

******************************************

Thanks,

Sri