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 List checkbox problem

Former Member
0 Kudos

Hi Guys,

I have a requirement in ALV list where i need to display and be able to use checkboxes in ALV List. Heres the problem im able to display the checkboxes in alv list by using an extra field in the internal table

DATA: check(1) type c

and also in the lay out i set the parameters

alv_layout-box_fieldname = 'check'.

alv_layout-box_tabname = 'bestand'.

bestand is my internal table name.

But when i check the rows in the alv list the values are not getting reflected in the internal table. Is there any thing else that i need to do .

My requirement is based on the rows i checked i should be able to save them in the database or use them in some function module.

7 REPLIES 7

Former Member
0 Kudos

Hi,

you have to capture the lines with flag 'X', i.e for the selected lines.

Then you can move to other internal table for passing to the function module etc as per your requirement.

Former Member
0 Kudos

Hi,

do you set: RS_SELFIELD-REFRESH = 'X'.

in your user-command form?

Regards, Dieter

Former Member
0 Kudos

Hi,

Please check these links for how to use a checkbox in a ALV report.

How can I display a checkbox in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=88376

http://www.sapfans.com/forums/viewtopic.php?t=40968

http://www.sapfans.com/forums/viewtopic.php?t=6919

Hope this helps.

ashish

Former Member
0 Kudos

Hi Guys,

Thanks for that quick reply, But Dieter Gröhn where do i set this statement in the form user_command, should i use this statement at the starting of the form or use some condition.

And how do we set the flag for the only rows checked by the user.

Former Member
0 Kudos

Hi Ashok,

But when i go into debug mode i cannot see the values of this field being set in the internal table. for all the rows they are being blank. I dont understand why the check boxes are not responding to the user inputs. Can somebody send me the proper code for using checkboxes in ALV List.

Guys its a little urgent. It ll be great if you guys find something out for me.

0 Kudos

Hi Venkat,

did you tried what i mentioned?

Regards, Dieter

Former Member
0 Kudos

FORM user_command USING rf_ucomm LIKE sy-ucomm

rs TYPE slis_selfield.

rs-refresh = 'X'.

  • Catch detail list

IF rs-tabname = '1'.

rs-tabname = 'BESTAND'.

ENDIF.

  • Double click

IF rf_ucomm = '&IC1'.

rf_ucomm = 'BEST'.

ENDIF.

  • Read table.

CASE rs-tabname.

WHEN 'HEADER'.

CLEAR bestand.

READ TABLE header INDEX rs-tabindex.

MOVE-CORRESPONDING header TO bestand.

WHEN 'BESTAND'.

READ TABLE bestand INDEX rs-tabindex."

ENDCASE.

CHECK sy-subrc = 0.

  • Execute command

CASE rf_ucomm.

WHEN 'BEST' OR 'HIST'.

IF rs-tabname = 'BESTAND'.

IF rf_ucomm = 'BEST'.

CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'

EXPORTING

i_ebeln = bestand-ebeln

i_enjoy = 'X'

EXCEPTIONS

not_found = 1

no_authority = 2

invalid_call = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ELSE.

SUBMIT rm06ehbe AND RETURN

WITH s_ebeln = bestand-ebeln

WITH s_ebelp = bestand-ebelp

WITH lesen = 'Y'.

ENDIF.

ELSE.

MESSAGE s131(m8).

ENDIF.

WHEN 'AUTH'.

CALL METHOD cl_mmim_auth=>display.

WHEN 'DETAIL'.

PERFORM detail_list.

WHEN 'MMBE'.

SET PARAMETER ID 'MAT' FIELD bestand-matnr.

SET PARAMETER ID 'WRK' FIELD bestand-werks.

CALL TRANSACTION 'MMBE' AND SKIP FIRST SCREEN.

WHEN 'POST'.

PERFORM POSTING.

ENDCASE.

CLEAR rf_ucomm.

ENDFORM. "user_command

I put that staement in the first line of the form.

After i Put i dont think that made any change.