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 Check box

Former Member
0 Kudos
375

Hi friends,

In my alv display using classic alv, I have declared a field as chek box. When I check this field for any record and press a button called "CHANGE"(This is my PF-Status), I am refreshing my alv and displaying only those records which are checked.

The issue now is, when the same list is being displayed using grid_display, the check box field appears blank. Do we need to follow a different method to declare a field as check box when we use grid_display ??

Also it would be great if anybody could provide me with the basic differences between reuse_alv_list_display and reuse_alv_grid_display other than their report appearance.

Many Thanks in advance.

Gayathri.

7 REPLIES 7

Former Member
0 Kudos
180

Hi,

U can see the output difference in the following link

http://www.sapdevelopment.co.uk/reporting/alvhome.htm

Hope this helps.

Just to remind: u havent closed some threads already opened by u.

0 Kudos
180

Whether you use REUSE LIST DISPLAY OR GRID DISPLAY it is going to be the same FIELD CATALOG that you are going to use.

I think from code, you are NOT handling the same properly.

If you can publish the code as well, we can take a look and let you know.

Regarding the difference between LIST and GRID as JUDITH has pointed the web site clearly shows you the difference. Its just the change in the way the report is displayed. The functionality remains the same.

Regards,

Ravi

Former Member
0 Kudos
180

Hi

Have you check the internal table when you click refresh.

The value of checkbox field which you checked has updated?

Former Member
0 Kudos
180

Hi Ravi,

I have attached my piece of code as below.

Below is the fieldcat that I have declared

LOOP AT t_fcat1 INTO w_fcat1.

IF w_fcat1-fieldname = 'INDX'.

w_fcat1-key = 'X'.

w_fcat1-seltext_l = 'S.No'.

MODIFY t_fcat1 FROM w_fcat1.

ELSEIF w_fcat1-fieldname = 'CHEK_BOX'.

w_fcat1-seltext_l = 'EDIT'.

MODIFY t_fcat1 FROM w_fcat1.

ELSEIF w_fcat1-fieldname = 'LIGHTS'.

w_fcat1-seltext_l = 'LIGHTS'.

MODIFY t_fcat1 FROM w_fcat1.

ELSEIF w_fcat1-fieldname = 'VKORG'.

w_fcat1-key = ' '.

w_fcat1-seltext_l = 'SalesOrg'.

MODIFY t_fcat1 FROM w_fcat1.

ELSEIF w_fcat1-fieldname = 'VTWEG'.

w_fcat1-key = ' '.

w_fcat1-seltext_l = 'DistChnl'.

MODIFY t_fcat1 FROM w_fcat1.

ELSEIF w_fcat1-fieldname = 'SPART'.

w_fcat1-key = ' '.

w_fcat1-seltext_l = 'Divi'.

MODIFY t_fcat1 FROM w_fcat1.

ENDIF.

ENDLOOP.

My List Display Function.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

i_callback_program = c_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

i_structure_name = 'T_CUSTOMER'

is_layout = t_layout

it_fieldcat = t_fcat1

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

it_sort = t_sort

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

i_save = 'A'

is_variant = t_variant1

it_events = t_event

  • IT_EVENT_EXIT =

is_print = t_print

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = t_customer

EXCEPTIONS

program_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

My Grid Display Function.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

  • I_INTERFACE_CHECK = ' '

i_callback_program = c_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

i_callback_top_of_page = 'F100_TOP_OF_PAGE'

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

i_structure_name = 'T_CUSTOMER'

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

is_layout = t_layout

it_fieldcat = t_fcat1

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

it_sort = t_sort

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

i_save = 'A'

is_variant = t_variant1

it_events = t_event

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = t_customer

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

In my start-of-selection I am not giving any value for the checkbox field. This is updated dynamically from the alv report.

Thanks,

Gayathri.

0 Kudos
180

Hi Gayathri,

Modify your code like this.

ElseiF w_fcat1-fieldname = 'CHEK_BOX'.

w_fcat1-col_pos = 1.

w_fcat1-seltext_l = 'EDIT'.

w_fcat1-Checkbox = 'X'.

w_fcat1-EDIT = 'X'.

MODIFY t_fcat1 FROM w_fcat1.

......

Former Member
0 Kudos
180

Hi Gayathri,

If you are using ALV Grid Display, define a field 'SELECTED' in the structure of the internal table you have defined and while filling the layout,

LAYOUT-BOX_FIELDNAME = 'SELECTED'.

and pass the layout to the parameter IS_LAYOUT of the GRID Display, and later you can handle the report display of the selected records in the user command.

Regards,

Phani

Former Member
0 Kudos
180

Hi Phani,

I have already defined my check box field in my layout.

The name of my checkbox field is CHEK_BOX.

and in my layout I am mentioning it as

t_layout-box_fieldname = 'CHEK_BOX'.

It does not work still.

Please give in your further suggestions.

Regards,

Gayathri.