Application Development and Automation 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: 
Read only

REUSE checkbox values not saved after user-command

former_member194669
Active Contributor
0 Likes
599

Hi,

I have an ALV grid using REUSE_ALV_GRID_DISPLAY within i have checkbox editable field. Initially all lines in the grid are checked. (user can deselect some of the lines)

After display of ALV grid user deselect some of the lines in the grid and he press ENTER Here i am updating only checked data the alv grid data to a custom table.But my problem is user deselect some of lines in the gird and press ENTER, but the output table from the grid still showing all lines are checked. ie grid results not showing in the output table.

Here is code


  data: pt_grpfcat      type slis_t_fieldcat_alv,
        ps_grpfcat      like line of pt_grpfcat,
        pt_grpself      type slis_selfield,
        pt_grplayout2   type slis_layout_alv,
        pv_grptitle(20) type c,
        p_grpexcltab2   type slis_t_extab with header line,
        p_header        type  slis_formname.

  ps_grpfcat-fieldname = 'BOX'.
  ps_grpfcat-checkbox  = c_x.
  ps_grpfcat-edit      = c_x.
  ps_grpfcat-seltext_m = text-272.
  ps_grpfcat-outputlen = 3.
  append ps_grpfcat to pt_grpfcat[].
  clear ps_grpfcat.

  ps_grpfcat-fieldname = 'WERKS'.
  ps_grpfcat-outputlen = 4.
  ps_grpfcat-seltext_m = 'Plants'.
  append ps_grpfcat to pt_grpfcat[].
  clear ps_grpfcat.

  ps_grpfcat-fieldname = 'NAME1'.
  ps_grpfcat-outputlen = 40.
  ps_grpfcat-seltext_m = 'Description'.
  append ps_grpfcat to pt_grpfcat[].
  clear ps_grpfcat.

  select * from t001w into table i_t001w_1.

  if p_plgrp ne c_gl.
    select * from yfe024 into table i_yfe024
             where plgrp eq p_plgrp.
  else.
    select * from yfe024 into table i_yfe024
             where plgrp ne space.
  endif.
*
  refresh : i_grpoutput. clear : i_grpoutput.

  pt_grplayout2-zebra = c_x.

  refresh i_events. clear i_events.
*
  if not i_yfe024[] is initial.
    loop at i_yfe024 into wa_yfe024.
      read table i_t001w_1 into wa_t001w_1
                  with key werks = wa_yfe024-werks.
      if sy-subrc eq 0.
        move : c_x            to i_grpoutput-box,
               wa_t001w_1-werks to i_grpoutput-werks,
               wa_t001w_1-name1 to i_grpoutput-name1.
        append i_grpoutput.
      endif.
    endloop.
  endif.

  pv_grptitle = text-t01.

  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      it_fieldcat                 = pt_grpfcat[]
      it_excluding                = p_grpexcltab2[]
      is_layout                   = pt_grplayout2
      i_callback_program          = sy-repid
      i_callback_html_top_of_page = p_header
      i_callback_pf_status_set    = v_status_set1
      i_callback_user_command     = v_user_command1
      i_screen_start_column       = 5
      i_screen_start_line         = 5
      i_screen_end_column         = 70
      i_screen_end_line           = 15
      it_events                   = i_events[]
    tables
      t_outtab                    = i_grpoutput.

endform.                                 " F_f4_help_fieldname
*
*&---------------------------------------------------------------------*
* Form  f_user_command1                                                *
*&---------------------------------------------------------------------*
* This form will handle the user command from fm REUSE                 *
*----------------------------------------------------------------------*
form f_user_command1 using p_ucomm type sy-ucomm
                     rs_selfield type  slis_selfield.
  case p_ucomm.
    when 'YCNC'.
      leave to screen 0.
    when 'YNTR'.
      perform f_upload_readions.
      leave to screen 0.
  endcase.
endform.                                 " F_user_command1
*
*&---------------------------------------------------------------------*
* Form f_pf_status_set1                                                *
*&---------------------------------------------------------------------*
* For setting PF status to REUSE                                       *
*&---------------------------------------------------------------------*
form f_pf_status_set1 using rt_extab type slis_t_extab..
  set pf-status '9001'.
  set titlebar '9001' with v_plgrp.
endform.                                 " F_pf_status_set1
*
*&---------------------------------------------------------------------*
* Form f_upload_readions                                               *
*&---------------------------------------------------------------------*
* For upload plants under regions to load into YSCCPLNT                *
*&---------------------------------------------------------------------*
form f_upload_readions.
  if not i_grpoutput[] is initial.
    loop at i_grpoutput where box eq c_x.
      read table i_ysccplnttemp with key werks = i_grpoutput-werks
                                         updkz = space.
      if sy-subrc ne 0.
        move i_grpoutput-werks to i_ysccplnttemp-werks.
        move v_affind          to i_ysccplnttemp-affind.
        append i_ysccplnttemp. clear i_ysccplnttemp.
      endif.
    endloop.
  endif.
endform.                                 " F_upload_readions
*

Any suggestions?

Thanks

aRs

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
557

form f_user_command1 using p_ucomm type sy-ucomm

rs_selfield type slis_selfield.

<b>Data ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data</b>

case p_ucomm.

when 'YCNC'.

leave to screen 0.

when 'YNTR'.

perform f_upload_readions.

leave to screen 0.

endcase.

endform.

Hi,

I have an ALV grid using REUSE_ALV_GRID_DISPLAY within i have checkbox editable field. Initially all lines in the grid are checked. (user can deselect some of the lines)

After display of ALV grid user deselect some of the lines in the grid and he press ENTER Here i am updating only checked data the alv grid data to a custom table.But my problem is user deselect some of lines in the gird and press ENTER, but the output table from the grid still showing all lines are checked. ie grid results not showing in the output table.

Here is code


  data: pt_grpfcat      type slis_t_fieldcat_alv,
        ps_grpfcat      like line of pt_grpfcat,
        pt_grpself      type slis_selfield,
        pt_grplayout2   type slis_layout_alv,
        pv_grptitle(20) type c,
        p_grpexcltab2   type slis_t_extab with header line,
        p_header        type  slis_formname.

  ps_grpfcat-fieldname = 'BOX'.
  ps_grpfcat-checkbox  = c_x.
  ps_grpfcat-edit      = c_x.
  ps_grpfcat-seltext_m = text-272.
  ps_grpfcat-outputlen = 3.
  append ps_grpfcat to pt_grpfcat[].
  clear ps_grpfcat.

  ps_grpfcat-fieldname = 'WERKS'.
  ps_grpfcat-outputlen = 4.
  ps_grpfcat-seltext_m = 'Plants'.
  append ps_grpfcat to pt_grpfcat[].
  clear ps_grpfcat.

  ps_grpfcat-fieldname = 'NAME1'.
  ps_grpfcat-outputlen = 40.
  ps_grpfcat-seltext_m = 'Description'.
  append ps_grpfcat to pt_grpfcat[].
  clear ps_grpfcat.

  select * from t001w into table i_t001w_1.

  if p_plgrp ne c_gl.
    select * from yfe024 into table i_yfe024
             where plgrp eq p_plgrp.
  else.
    select * from yfe024 into table i_yfe024
             where plgrp ne space.
  endif.
*
  refresh : i_grpoutput. clear : i_grpoutput.

  pt_grplayout2-zebra = c_x.

  refresh i_events. clear i_events.
*
  if not i_yfe024[] is initial.
    loop at i_yfe024 into wa_yfe024.
      read table i_t001w_1 into wa_t001w_1
                  with key werks = wa_yfe024-werks.
      if sy-subrc eq 0.
        move : c_x            to i_grpoutput-box,
               wa_t001w_1-werks to i_grpoutput-werks,
               wa_t001w_1-name1 to i_grpoutput-name1.
        append i_grpoutput.
      endif.
    endloop.
  endif.

  pv_grptitle = text-t01.

  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      it_fieldcat                 = pt_grpfcat[]
      it_excluding                = p_grpexcltab2[]
      is_layout                   = pt_grplayout2
      i_callback_program          = sy-repid
      i_callback_html_top_of_page = p_header
      i_callback_pf_status_set    = v_status_set1
      i_callback_user_command     = v_user_command1
      i_screen_start_column       = 5
      i_screen_start_line         = 5
      i_screen_end_column         = 70
      i_screen_end_line           = 15
      it_events                   = i_events[]
    tables
      t_outtab                    = i_grpoutput.

endform.                                 " F_f4_help_fieldname
*
*&---------------------------------------------------------------------*
* Form  f_user_command1                                                *
*&---------------------------------------------------------------------*
* This form will handle the user command from fm REUSE                 *
*----------------------------------------------------------------------*
form f_user_command1 using p_ucomm type sy-ucomm
                     rs_selfield type  slis_selfield.
  case p_ucomm.
    when 'YCNC'.
      leave to screen 0.
    when 'YNTR'.
      perform f_upload_readions.
      leave to screen 0.
  endcase.
endform.                                 " F_user_command1
*
*&---------------------------------------------------------------------*
* Form f_pf_status_set1                                                *
*&---------------------------------------------------------------------*
* For setting PF status to REUSE                                       *
*&---------------------------------------------------------------------*
form f_pf_status_set1 using rt_extab type slis_t_extab..
  set pf-status '9001'.
  set titlebar '9001' with v_plgrp.
endform.                                 " F_pf_status_set1
*
*&---------------------------------------------------------------------*
* Form f_upload_readions                                               *
*&---------------------------------------------------------------------*
* For upload plants under regions to load into YSCCPLNT                *
*&---------------------------------------------------------------------*
form f_upload_readions.
  if not i_grpoutput[] is initial.
    loop at i_grpoutput where box eq c_x.
      read table i_ysccplnttemp with key werks = i_grpoutput-werks
                                         updkz = space.
      if sy-subrc ne 0.
        move i_grpoutput-werks to i_ysccplnttemp-werks.
        move v_affind          to i_ysccplnttemp-affind.
        append i_ysccplnttemp. clear i_ysccplnttemp.
      endif.
    endloop.
  endif.
endform.                                 " F_upload_readions
*

Any suggestions?

Thanks

aRs

2 REPLIES 2
Read only

Former Member
0 Likes
558

form f_user_command1 using p_ucomm type sy-ucomm

rs_selfield type slis_selfield.

<b>Data ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data</b>

case p_ucomm.

when 'YCNC'.

leave to screen 0.

when 'YNTR'.

perform f_upload_readions.

leave to screen 0.

endcase.

endform.

Read only

Former Member
0 Likes
557

Add this...


DATA: GC_GLAY TYPE LVC_S_GLAY.

GC_GLAY-EDT_CLL_CB = 'X'.

*Add this to your ALV call...
      I_GRID_SETTINGS          = GC_GLAY

Greetings,

Blag.