Skip to Content
0
Former Member
Apr 12, 2007 at 12:54 PM

alv list display problem-urgennt

25 Views

hi all,

my requirement is

1. i am diplaying output using alv list display.

using following field catalog

i_field-key = 'X'.

i_field-col_pos = 1.

i_field-ddictxt = 'S'.

i_field-seltext_s = '@11@'.

i_field-checkbox = 'X'. <- Using this command i am getting checkbox

i_field-input = 'X'.

i am getting checkbox befor the record

forexample :

checkbox runrate a01 maheed

when i select this checkbox and i click delete button(here i am using my own pf status) this entry is deleting from internal table as we ass screen is getting refresh so i am not seeing that deleted entry in the output. this is ok. now the problem is after refreshing the screen if i click save button this action has to update i.e. this deleted entry will remove from that ztable this is not happening in my code.anybody can send me the code how to perform that action.

i am sending my code below.

type-pools : slis.

tables : zuser_secobjects.

data : t_header1 like zuser_secobjects.

data : begin of it_secobjects occurs 0.

include structure t_header1.

data : checkbox type c,

  • action type c,

end of it_secobjects.

data : begin of it_secobjects1 occurs 0.

include structure ZUSER_SECOBJECTS.

data : checkbox type c,

end of it_secobjects1.

data : wa_ita like line of it_secobjects.

data : i_field type slis_t_fieldcat_alv with header line.

data : w_field like line of i_field.

data : i_sort type slis_t_sortinfo_alv.

data : w_sort like line of i_sort.

data : it_filt1 type slis_t_filter_alv with header line.

data:

i_tabname type tabname,

i_repid like sy-repid,

is_lout type slis_layout_alv.

data : it_filt type slis_t_filter_alv with header line,

it_evts type slis_t_event with header line.

DATA : is_vari type disvariant.

constants : c_default_vari value 'X',

c_save_vari value 'U',

c_checkfield type slis_fieldname value 'ACTION',

c_f2code type sy-ucomm value '&ETA'.

data : chk_box type slis_fieldname.

selection-screen: begin of block b1 with frame title text-t01.

parameters : p_appln type zuser_secobjects-appln.

parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,

p_partnr type zuser_secobjects-appln_partner,

p_ptype type zuser_secobjects-partner_type default '02',

p_upostn type zuser_secobjects-user_position,

p_sdate like likp-erdat default sy-datum,

p_edate(10) default '12/31/9999',

p_revnum type zuser_secobjects-revnum,

p_cted type zuser_secobjects-created_by,

p_cdate type zuser_secobjects-creation_date,

p_ctime type zuser_secobjects-creation_time,

p_chnby type zuser_secobjects-changed_by,

p_cdate1 type zuser_secobjects-changed_date,

p_ctime1 type zuser_secobjects-changed_time.

selection-screen: end of block b1.

form user_command using p_ucomm like sy-ucomm

rs_selfield type slis_selfield.

case p_ucomm.

when 'SELECT_ALL'. " SELALL is the FCODE of ur push button

loop at it_secobjects into wa_ita.

wa_ita-checkbox = 'X'.

modify it_secobjects from wa_ita.

endloop.

rs_selfield-refresh = 'X'. "<- ADD THIS

when 'DESLCT_ALL'.

loop at it_secobjects into wa_ita.

wa_ita-checkbox = ' '.

modify it_secobjects from wa_ita.

endloop.

rs_selfield-refresh = 'X'. "<- ADD THIS

  • is_lout-f2code = c_f2code.

  • is_lout-box_fieldname = c_checkfield.

  • is_lout-get_selinfos = 'X'.

  • is_lout-detail_popup = 'X'.

  • is_lout-detail_initial_lines = 'X'.

WHEN 'DELETE'.

loop at it_SECOBJECTS where checkbox eq 'X'.

delete it_SECOBJECTS.

endloop.

RS_SELFIELD-REFRESH = 'X'.

when 'SAVE'.

LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.

MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.

APPEND IT_SECOBJECTS1.

CLEAR IT_SECOBJECTS1.

DELETE IT_SECOBJECTS.

ENDLOOP.

DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.

ENDCASE.

endform.

&----


*& Form delete

&----


form delete.

data : begin of is_secobjects occurs 0.

include structure zuser_secobjects.

data : checkbox type c.

data : end of is_secobjects.

is_secobjects-checkbox = 'X'.

modify is_secobjects

from it_secobjects

transporting checkbox

where checkbox = 'X'.

endform.

&----


*& Form get_data

&----


form get_data.

select * from zuser_secobjects

into table it_secobjects.

endform. " get_data

&----


*& Form prepare_fieldcatalog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form prepare_fieldcatalog.

clear: w_field,i_field.

refresh:i_field.

i_field-key = 'X'.

i_field-col_pos = 1.

i_field-ddictxt = 'S'.

i_field-seltext_s = '@11@'.

  • i_field-checkbox = 'X'.

i_field-input = 'X'.

i_field-fieldname = 'HEADER'.

i_field-outputlen = 0.

append i_field.

clear i_field.

w_field-fieldname = 'APPLN'.

w_field-tabname = 'IT_SECOBJECTS'.

w_field-seltext_l = text-m01.

w_field-outputlen = '10'.

w_field-col_pos = 1.

append w_field to i_field.

clear w_field.

w_field-fieldname = 'APPLN_USER'.

w_field-tabname = 'IT_SECOBJECTS'.

w_field-just = 'C'.

w_field-seltext_l = text-m02.

w_field-outputlen = '7'.

w_field-col_pos = 2.

append w_field to i_field.

clear w_field.

w_field-fieldname = 'INACTIVE'.

w_field-tabname = 'IT_SECOBJECTS'.

w_field-just = 'C'.

w_field-seltext_l = text-m02.

w_field-outputlen = '7'.

w_field-col_pos = 3.

append w_field to i_field.

clear w_field.

endform. " prepare_fieldcatalog

&----


*& Form ALV_LIST_DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form alv_list_display.

i_repid = sy-repid.

is_lout-box_fieldname = 'CHECKBOX'.

it_filt-fieldname = 'ACTION'.

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = i_repid

i_callback_pf_status_set = 'PF_STATUS_SET'

i_callback_user_command = 'USER_COMMAND'

is_layout = is_lout

it_fieldcat = i_field[]

it_filter = it_filt[]

it_events = it_evts[]

i_default = c_default_vari

i_save = c_save_vari

is_variant = is_vari

tables

t_outtab = it_secobjects.

endform. " ALV_LIST_DISPLAY

&----


*& Form display

&----


  • text

----


  • -->P_I_OBJECT text

----


form display using object.

case object.

ENDCASE.

endform. " display