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: 

ALV Problem:Modify ALV layout row by row

Former Member
0 Kudos

Hi buddies,

There is one checkbox column in my ALV Grid. And I want to set the status of this checkbox row by row .For example: when a field 'MENGE > 0' ,the checkbox is disabled, when 'MENGE <= 0' ,the checkbox is enabled.

Could I do this in ALV Grid?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

chk the standard program BCALV_EDIT_05 with the same functionality

u have to use OO ALV

4 REPLIES 4

Former Member
0 Kudos

chk the standard program BCALV_EDIT_05 with the same functionality

u have to use OO ALV

0 Kudos

Hi Chandrasekhar,

Thank you, BCALV_EDIT_05 is just what I need...

Former Member
0 Kudos

It has nothing to do with the layout.

check MENGE field and set the field to X in the internal table holding the data. Now make sure the CHECKBOX field is set to X in the field catalog table for the specific field.

Regards,

Ravi

Note - Please mark all the helpful answers

Former Member
0 Kudos

Hello Jie,

check the code and modify according to your needs..

here depending upon some field value i am displaying the icons (icon_green,icon_red etc) ...

  • select data from table z08os_mba_val

PERFORM fetch_data CHANGING g_t_mba_val.

  • fieldcat population.

PERFORM fieldcat_population.

&----


*& Form fetch_data

&----


  • This routine is used to Fetch data.

----


FORM fetch_data CHANGING p_gt_mba_val LIKE g_t_mba_val[].

DATA : l_v_mba. " for mba value

  • Get data

SELECT * FROM z08os_mba_val

INTO CORRESPONDING FIELDS OF TABLE p_gt_mba_val

WHERE matnr IN so_matnr

AND locno IN so_locno

AND ezkl_10 IN so_prodh.

IF sy-subrc <> 0.

MESSAGE e005.

EXIT.

ENDIF.

SORT p_gt_mba_val BY matnr locno.

  • mba ratings

SELECT * FROM z08os_mba

INTO TABLE g_t_mba.

IF sy-subrc <> 0.

MESSAGE e050(z08os_ersatz) WITH text-001.

EXIT.

ENDIF.

*Fill Icons for MBA rating

LOOP AT p_gt_mba_val INTO g_s_mba_val.

LOOP AT g_t_mba INTO g_s_mba.

IF g_s_mba_val-mba GE g_s_mba-mba_low AND

g_s_mba_val-mba LE g_s_mba-mba_high.

l_v_mba = g_s_mba-mba.

CASE l_v_mba.

WHEN 'W'.

g_s_mba_val-icon = ICON_GREEN_LIGHT.

MODIFY p_gt_mba_val FROM g_s_mba_val.

WHEN 'G'.

g_s_mba_val-icon = ICON_YELLOW_LIGHT .

MODIFY p_gt_mba_val FROM g_s_mba_val.

WHEN 'R'.

g_s_mba_val-icon = ICON_RED_LIGHT.

MODIFY p_gt_mba_val FROM g_s_mba_val.

ENDCASE.

EXIT.

ENDIF.

CLEAR g_s_mba.

ENDLOOP.

  • Icons for Newly launched products

IF g_s_mba_val-flag_new = 'X'.

g_s_mba_val-new_prod = icon_set_b.

MODIFY p_gt_mba_val FROM g_s_mba_val.

ENDIF.

CLEAR g_s_mba_val.

ENDLOOP.

ENDFORM. " fetch_data

&----


*& Form fieldcat_population

&----


  • This routine is used to Populate Field catalog

----


FORM fieldcat_population .

REFRESH g_t_fcat. CLEAR g_t_fcat.

REFRESH g_t_fcat_alv. CLEAR g_t_fcat_alv.

  • material

g_t_fcat-fieldname = 'MATNR'.

g_t_fcat-ref_table = 'Z08OS_MBA_VAL'.

APPEND g_t_fcat. CLEAR g_t_fcat.

  • Location no

g_t_fcat-fieldname = 'LOCNO'.

g_t_fcat-ref_table = 'Z08OS_MBA_VAL'.

APPEND g_t_fcat. CLEAR g_t_fcat.

  • MBA value

g_t_fcat-fieldname = 'MBA'.

g_t_fcat-ref_table = 'Z08OS_MBA_VAL'.

APPEND g_t_fcat. CLEAR g_t_fcat.

  • Ratings

g_t_fcat-fieldname = 'NEW_PROD'.

g_t_fcat-tabname = 'G_T_MBA_VAL'.

g_t_fcat-datatype = 'CHAR'.

g_t_fcat-outputlen = '12'.

g_t_fcat-icon = 'X'.

g_t_fcat-reptext = text-033.

APPEND g_t_fcat. CLEAR g_t_fcat.

*Product hierarchy

g_t_fcat-fieldname = 'EZKL_10'.

g_t_fcat-ref_table = 'Z08OS_MBA_VAL'.

APPEND g_t_fcat. CLEAR g_t_fcat.

  • Ratings

g_t_fcat-fieldname = 'ICON'.

g_t_fcat-tabname = 'G_T_MBA_VAL'.

g_t_fcat-datatype = 'CHAR'.

g_t_fcat-outputlen = '8'.

g_t_fcat-icon = 'X'.

g_t_fcat-reptext = text-032.

APPEND g_t_fcat. CLEAR g_t_fcat.

g_t_fcat_alv[] = g_t_fcat[].

ENDFORM. " fieldcat_population

regards,

srini