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] Disable Check box for some rows / Group field sudnt be repeated

Former Member
0 Kudos
544

Hi,

ALV List created through :

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

My Code for layout:

FORM form_build_layout_1301 CHANGING value(gs_layout_1301) TYPE
slis_layout_alv.
  gs_layout_1301-colwidth_optimize = 'X'. 
  gs_layout_1301-totals_only = 'X'.
  gs_layout_1301-totals_text = 'Total'.
  gs_layout_1301-totals_before_items = 'X'.
  gs_layout_1301-zebra = 'X'.
  gs_layout_1301-box_fieldname     = 'FLAG'.
  gs_layout_1301-detail_popup = 'X'. 
  SKIP.
ENDFORM.

<b>1.</b>

As you can see the itab-Flag (type char length 1) field is being used to show a check box infront of each rows.

these check boz will be selelected and a button will be pressed to create a PO order. Some rows shown here should have these check box disable. I know how to disable all the check box for entire ALV rows. but that is not what we want here.

<b>2.</b>

My ALV records are grouped on the basis of plant and sold-to party. code :

FORM form_build_sortcat_1301 CHANGING value(it_sort) TYPE
slis_t_sortinfo_alv.
  DATA ls_sort LIKE LINE OF  it_sort .

  CLEAR ls_sort.
  ls_sort-spos = '1' .
  ls_sort-fieldname = 'KUNNR'.
  ls_sort-up = 'X' . "A to Z
* Uncomment it, if you want to hav sum on the basis of subordernumber
*  ls_sort-subtot = 'X'.
*  ls_sort-expa = 'X'.
  ls_sort-down = space .
  APPEND ls_sort TO it_sort .


  CLEAR ls_sort.
  ls_sort-spos = '1' .
  ls_sort-fieldname = 'WERKS' .
  ls_sort-up = 'X' . "A to Z
* Uncomment it, if you want to hav sum on the basis of subordernumber
*  ls_sort-subtot = 'X'. 
*  ls_sort-expa = 'X'.
  ls_sort-down = space .
  APPEND ls_sort TO it_sort .
ENDFORM.

Whant we have is plant, sold-to in an orange stripe and then related record with check box in normal rows. but these rows are showing plant, sold-to (repeate) in front of each rows.

V want to see plant and sold-to in the sub-total line only and not repeatedly. i have tried

  gs_layout_1301-row = 1

but it is not giving me required GUI

1 ACCEPTED SOLUTION

Former Member
0 Kudos
145

Hi Anurag,

1.

As you can see the itab-Flag (type char length 1) field is being used to show a check box infront of each rows.

these check boz will be selelected and a button will be pressed to create a PO order. Some rows shown here should have these check box disable. I know how to disable all the check box for entire ALV rows. but that is not what we want here.

<b>

For all the lines in your internal table that you want to disable, just fill field FLAG = '1' (if you want it marked and disabled) or FLAG = '2' (if you dont want it marked and just want it disabled).</b>

I will get back to you on <b>2.</b> in the same post shortly.

Hope this helps..

Sri

6 REPLIES 6

Former Member
0 Kudos
146

Hi Anurag,

1.

As you can see the itab-Flag (type char length 1) field is being used to show a check box infront of each rows.

these check boz will be selelected and a button will be pressed to create a PO order. Some rows shown here should have these check box disable. I know how to disable all the check box for entire ALV rows. but that is not what we want here.

<b>

For all the lines in your internal table that you want to disable, just fill field FLAG = '1' (if you want it marked and disabled) or FLAG = '2' (if you dont want it marked and just want it disabled).</b>

I will get back to you on <b>2.</b> in the same post shortly.

Hope this helps..

Sri

0 Kudos
145

Hi Srikanth ,

<b>flag 2 is brilliant!</b>

Never knew that lvc_s_styl kind of thing is implemented in the alv list in such a simple way.

Though we may argue that it is not as versatile as lvc_s_styl data variable.

0 Kudos
145

Hi Anurag,

Yes I agree it is much simpler compared to styles, the only thing I would like to add is that styles are designed to cover more functionality.

And now about <b>2.</b>, I have tried various things but it seems there is no simple solution for this.

I think you can try subscribing for BEFORE_LINE_OUTPUT event and then clear out the corresponding fields if the the line that is going to be output (TABINDEX is passed in ls_lineinfo) and is not a subtotal line (SUBTOTAL flag of structure ls_lineinfo will be empty).

Something like the following,

gt_events-name = slis_ev_before_line_output.

gt_events-form = 'BEFORE_LINE_OUTPUT'.

APPEND gt_events.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

....

....

it_events = gt_events[]

....

....

and then,

----


  • FORM before_line_output *

----


  • ........ *

----


  • --> LS_LINEINFO *

----


FORM before_line_output USING ls_lineinfo TYPE slis_lineinfo.

****Read your internal table with LS_LINEINFO-TABINDEX and do your processing..

ENDFORM.

Hope this helps..

Sri

0 Kudos
145

i am unable to disable the checkbox even after passing 2 into the field, is there anything else i am supposed to do?

this is my field layout

st_layout-zebra = 'X'.

st_layout-expand_all = 'X'.

st_layout-colwidth_optimize = 'X'.

st_layout-no_sumchoice ='X'.

st_layout-no_totalline = 'X'.

st_layout-no_subtotals = 'X'.

st_layout-cell_merge = ' '.

st_layout-box_fieldname = 'UPDATE'. " fieldname for checkbox

st_layout-box_tabname = 'I_OUTPUT'." tabname for checkbox

0 Kudos
145

Even I tried passing "2" in the checkbox field of itab but not getting it to work. Anyone has any ideas?

Thx

0 Kudos
145

Hi Srikanth,

Thanks!! for this reply, it really helped me to disable check box in some cases, otherwise I have to be change layout properties and would do work around LVC_S_LAYO. Now, I am simply populated the flag with 2 for making it disable.

Many Thanks / Himanshu Gupta