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 CheckBox Probs

kesavadas_thekkillath
Active Contributor
0 Kudos
119

i have displayed a alv with check boxes..

and two fields as editable..

now every thing is displayed exzactly..

i will i select a check box and input values to that fields

but when capturing the user command the internal table values are not modified

no 'X' in check box field...null vaues in the modified field..

whatz the problem

1 ACCEPTED SOLUTION

Former Member
0 Kudos
84

hi,

even i faced the same problem when i have a similar requirement. in order to populate' X' value in internal table.

set the fcode to '&REFRESH'

THEN USE EVENT_EXIT STRUCTURE IN SLIS.

populate the fields event_exit-after = 'X'.

pass it to grid display.

u will definitiely get it.

Rewards if useful.

Rgds.,

subash.

12 REPLIES 12

Former Member
0 Kudos
84

Hi,

In the structure of final internal table take one char field for checkbox.In the subroutine for 'USER_COMMAND',write :

Loop at itab where checkbox = 'X'.

-


endloop.

Former Member
0 Kudos
84

Are you using OOPS ALV? If so use method CHECK_CHANGED_DATA of Grid object to get the modified data in your internal table.

In the user command, call this method in the first statement, then write your code.

Regards,

Lakshmi.

Edited by: Santhanalakshmi V on Jun 16, 2008 1:46 PM

0 Kudos
84

normal ALV...

0 Kudos
84

For checkbox in normal ALV:

1. Declare a field in internal table of type CHAR1.

2. Assign that field name to parameter box_fieldname in Layout structure

Then in the user command that field is automatically updated with the modification. (X when checked).

For other fields i don't have an idea.

Regards,

Lakshmi.

0 Kudos
84

in list display its coming as 'X.

but in list display how to make the field editable

0 Kudos
84

In the fieldcatelog set the EDIT parameter to X for this check box field. Then it will come in editable mode.

It works with ALV Grid also. REUSE_ALV_GRID_DISPLAY.

I think editing other fields and obtaining the values back in the internal table is only possible in OOPS ALV.

Regards,

Lakshmi.

0 Kudos
84

This is my code..pl find out if i have missed out any thing..

everything is appearing corrctly...but no reflected in the itab



REPORT  zbbnd_updation_ksd .

TABLES:zbbndmast.

DATA:diff TYPE i.

TYPES:BEGIN OF st_ce1tvse,
      sel TYPE CHAR1,
      kokrs TYPE zbbndmast-kokrs,
      period TYPE zbbndmast-period,
      budat TYPE zbbndmast-budat,
      kndnr TYPE zbbndmast-kndnr,
      kdgrp TYPE zbbndmast-kdgrp,
      land1 TYPE zbbndmast-land1,
      vkorg TYPE zbbndmast-vkorg,
      vtweg TYPE zbbndmast-vtweg,
      spart TYPE zbbndmast-spart,
      werks TYPE zbbndmast-werks,
      prctr TYPE zbbndmast-prctr,
      gsber TYPE zbbndmast-gsber,
      artnr TYPE zbbndmast-artnr,
      matkl TYPE zbbndmast-matkl,
      mvgr1 TYPE zbbndmast-mvgr1,
      mvgr2 TYPE zbbndmast-mvgr2,
      mvgr3 TYPE zbbndmast-mvgr3,
      mvgr4 TYPE zbbndmast-mvgr4,
      mvgr5 TYPE zbbndmast-mvgr5,
      frwae TYPE zbbndmast-frwae,
      absmg TYPE zbbndmast-absmg,
      erlos TYPE zbbndmast-erlos,
      absmgval TYPE zbbndmast-absmgval,
      erlosval TYPE zbbndmast-erlosval,
      mvg1d TYPE tvm1t-bezei,
      mvg3d TYPE tvm3t-bezei,
      mvg2d TYPE tvm2t-bezei,
      mvg4d TYPE tvm4t-bezei,
      mvg5d TYPE tvm5t-bezei,
      wgbez TYPE t023t-wgbez,
      vtwegd TYPE tvtwt-vtext,
      spartd TYPE tspat-vtext,
      prctrd TYPE cepct-ktext,
      kdgrpd TYPE t151t-ktext,
     END OF st_ce1tvse.

TYPES:BEGIN OF st_tvm3t,
      mvgr3 TYPE tvm3t-mvgr3,
      bezei TYPE tvm3t-bezei,
     END OF st_tvm3t.

DATA:it_tvm3t TYPE STANDARD TABLE OF st_tvm3t INITIAL SIZE 0.
DATA:wa_tvm3t TYPE st_tvm3t.

TYPES:BEGIN OF st_tvm2t,
      mvgr2 TYPE tvm2t-mvgr2,
      bezei TYPE tvm2t-bezei,
     END OF st_tvm2t.

DATA:it_tvm2t TYPE STANDARD TABLE OF st_tvm2t INITIAL SIZE 0.
DATA:wa_tvm2t TYPE st_tvm2t.

TYPES:BEGIN OF st_tvm4t,
    mvgr4 TYPE tvm4t-mvgr4,
    bezei TYPE tvm4t-bezei,
   END OF st_tvm4t.

DATA:it_tvm4t TYPE STANDARD TABLE OF st_tvm4t INITIAL SIZE 0.
DATA:wa_tvm4t TYPE st_tvm4t.

TYPES:BEGIN OF st_tvm5t,
    mvgr5 TYPE tvm5t-mvgr5,
    bezei TYPE tvm5t-bezei,
   END OF st_tvm5t.

DATA:it_tvm5t TYPE STANDARD TABLE OF st_tvm5t INITIAL SIZE 0.
DATA:wa_tvm5t TYPE st_tvm5t.

TYPES:BEGIN OF st_tvm1t,
    mvgr1 TYPE tvm1t-mvgr1,
    bezei TYPE tvm1t-bezei,
   END OF st_tvm1t.

DATA:it_tvm1t TYPE STANDARD TABLE OF st_tvm1t INITIAL SIZE 0.
DATA:wa_tvm1t TYPE st_tvm1t.


TYPES:BEGIN OF st_maktx,
        matnr TYPE marc-matnr,
        maktx TYPE makt-maktx,
     END OF st_maktx.

DATA:it_maktx TYPE STANDARD TABLE OF st_maktx INITIAL SIZE 0.
DATA:wa_maktx TYPE st_maktx.

TYPES:BEGIN OF st_matkl,
        matkl TYPE t023t-matkl,
        wgbez TYPE  t023t-wgbez,
      END OF st_matkl.

DATA: it_matkl TYPE STANDARD TABLE OF st_matkl INITIAL SIZE 0.
DATA:wa_matkl TYPE st_matkl.

TYPES:BEGIN OF st_vtweg,
      vtweg TYPE tvtwt-vtweg,
      vtext TYPE tvtwt-vtext,
      END OF st_vtweg.

DATA: it_vtweg TYPE STANDARD TABLE OF st_vtweg INITIAL SIZE 0.
DATA:wa_vtweg TYPE st_vtweg.

TYPES:BEGIN OF st_spart,
      spart   TYPE tspat-spart,
      vtext TYPE tspat-vtext,
      END OF st_spart.

DATA: it_spart TYPE STANDARD TABLE OF st_spart INITIAL SIZE 0.
DATA:wa_spart TYPE st_spart.

TYPES:BEGIN OF st_prctr,
      prctr   TYPE cepct-prctr,
      ktext TYPE cepct-ktext,
      END OF st_prctr.

DATA: it_prctr TYPE STANDARD TABLE OF st_prctr INITIAL SIZE 0.
DATA:wa_prctr TYPE st_prctr.

TYPES:BEGIN OF st_kdgrp,
      kdgrp   TYPE t151t-kdgrp,
      ktext TYPE t151t-ktext,
      END OF st_kdgrp.

DATA: it_kdgrp TYPE STANDARD TABLE OF st_kdgrp INITIAL SIZE 0.
DATA:wa_kdgrp TYPE st_kdgrp.

DATA:it_tvse TYPE STANDARD TABLE OF st_ce1tvse INITIAL SIZE 0.

FIELD-SYMBOLS:<fs_tvse> TYPE st_ce1tvse.

TYPE-POOLS:slis.

DATA:alvfld TYPE slis_fieldcat_alv.
DATA:fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0.
DATA:layout TYPE slis_layout_alv,
it_comments TYPE slis_t_listheader,
comments LIKE LINE OF it_comments.


DEFINE macro_alv.
  alvfld-col_pos = &3.
  alvfld-fieldname = &1.
  alvfld-seltext_m = &2.
  case &1.
    when 'SEL'.
      alvfld-checkbox = 'X'.
      alvfld-edit = 'X'.
    when 'ABSMGVAL' or 'ERLOSVAL'.
      alvfld-edit = 'X'.
    when 'ERLOS' or 'ABSMG'.
      alvfld-emphasize = 'C310'.
    when 'SEL' or 'PERIOD' or 'BUDAT' or 'KNDNR' or 'KDGRPD' or
          'VKORG' or 'VTWEGD' or 'SPARTD' or 'WERKS' or
          'PRCTRD'.
      alvfld-fix_column = 'X'.
  endcase.
  append alvfld to fieldcat.
  clear alvfld.
END-OF-DEFINITION.



PARAMETERS:pa_kokrs TYPE ce1tvse-kokrs DEFAULT '9000' MODIF ID abc.
SELECT-OPTIONS:so_budat FOR zbbndmast-budat OBLIGATORY NO-EXTENSION.


AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-group1 = 'ABC'.
      screen-input = '0'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

INITIALIZATION.
  PERFORM init_alv_catalouge.

AT SELECTION-SCREEN ON so_budat.

  diff = ABS( so_budat-low - so_budat-high ).
  IF diff > 2.
    MESSAGE 'Date range must be for 3 days !!' TYPE 'E'.
  ENDIF.

  IF so_budat-low+4(2) <> so_budat-high+4(2).
    MESSAGE 'Month must not be different !!' TYPE 'E'.
  ENDIF.


START-OF-SELECTION.

  TYPE-POOLS:ftis.
  DATA:fiscal_year TYPE ftis_gjahr.
  DATA:fiscal_month TYPE ftis_monat.
  DATA:period TYPE ce1tvse-perio.

  PERFORM convert_date_to_fiscal_period USING  pa_kokrs so_budat-low
                                        CHANGING fiscal_year
                                                 fiscal_month.
  CONCATENATE  fiscal_year  '0' fiscal_month INTO    period.
  CONDENSE  period NO-GAPS.

*  PERFORM check_data_existense.

  SELECT kokrs perio AS period budat kndnr kdgrp land1
         vkorg vtweg spart werks prctr gsber artnr matkl
         mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 frwae SUM( absmg ) AS absmg
         SUM( erlos ) AS erlos
         FROM ce1tvse INTO CORRESPONDING FIELDS OF TABLE it_tvse
    WHERE paledger = '01'
    AND vrgar BETWEEN 'A' AND 'I'
    AND perio = period
    AND gjahr = fiscal_year
    AND perde = fiscal_month
    AND budat IN so_budat
    AND kokrs = pa_kokrs
    GROUP BY kokrs perio budat kndnr kdgrp land1 vkorg  vtweg spart
             werks prctr gsber artnr matkl mvgr1 mvgr2 mvgr3 mvgr4 mvgr5
             frwae.
  IF sy-subrc = 0.
    PERFORM get_descriptions.
    PERFORM process_itab.
    PERFORM build_alv_header.
    PERFORM display_alv.
  ELSE.
    MESSAGE 'No data Found !!' TYPE 'I'.
    STOP.
  ENDIF.

END-OF-SELECTION.

*&---------------------------------------------------------------------*
*&      Form  CONVERT_DATE_TO_FISCAL_PERIOD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_PA_KOKRS  text
*      -->P_SO_BUDAT_LOW  text
*      <--P_FISCAL_YEAR  text
*      <--P_FISCAL_MONTH  text
*----------------------------------------------------------------------*
FORM convert_date_to_fiscal_period  USING    p_pa_kokrs
                                             p_so_budat_low
                                    CHANGING p_fiscal_year
                                             p_fiscal_month.

  CALL FUNCTION 'FTI_FISCAL_YEAR_MONTH_GET'
    EXPORTING
      i_bukrs = p_pa_kokrs
      i_budat = p_so_budat_low
    IMPORTING
      e_gjahr = p_fiscal_year
      e_monat = p_fiscal_month.


ENDFORM.                    " CONVERT_DATE_TO_FISCAL_PERIOD
*&---------------------------------------------------------------------*
*&      Form  CHECK_DATA_EXISTENSE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM check_data_existense .

  SELECT SINGLE * FROM zbbndmast  WHERE
    kokrs = pa_kokrs
    AND period = period
    AND budat IN so_budat .
  IF sy-subrc = 0.
    MESSAGE 'Data already exists for this period' TYPE 'I'.
    STOP.
  ENDIF.

ENDFORM.                    " CHECK_DATA_EXISTENSE
*&---------------------------------------------------------------------*
*&      Form  GET_DESCRIPTIONS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_descriptions .

  SORT it_tvse BY mvgr3 ASCENDING.

  SELECT mvgr3 bezei INTO TABLE it_tvm3t FROM tvm3t
         FOR ALL ENTRIES IN it_tvse
         WHERE mvgr3 = it_tvse-mvgr3
         AND spras = sy-langu.

  SORT it_tvse BY mvgr1 ASCENDING.

  SELECT mvgr1 bezei INTO TABLE it_tvm1t FROM tvm1t
         FOR ALL ENTRIES IN it_tvse
         WHERE mvgr1 = it_tvse-mvgr1
         AND spras = sy-langu.

  SORT it_tvse BY mvgr2 ASCENDING.

  SELECT mvgr2 bezei INTO TABLE it_tvm2t FROM tvm2t
         FOR ALL ENTRIES IN it_tvse
         WHERE mvgr2 = it_tvse-mvgr2
         AND spras = sy-langu.

  SORT it_tvse BY mvgr4 ASCENDING.

  SELECT mvgr4 bezei INTO TABLE it_tvm4t FROM tvm4t
         FOR ALL ENTRIES IN it_tvse
         WHERE mvgr4 = it_tvse-mvgr4
         AND spras = sy-langu.

  SORT it_tvse BY mvgr5 ASCENDING.

  SELECT mvgr5 bezei INTO TABLE it_tvm5t FROM tvm5t
         FOR ALL ENTRIES IN it_tvse
         WHERE mvgr5 = it_tvse-mvgr5
         AND spras = sy-langu.

  SORT it_tvse BY artnr ASCENDING.

  SELECT matnr maktx INTO TABLE it_maktx FROM makt
       FOR ALL ENTRIES IN it_tvse
       WHERE matnr = it_tvse-artnr
       AND spras = sy-langu.

  SORT it_tvse BY matkl ASCENDING.

  SELECT matkl wgbez INTO TABLE it_matkl FROM t023t
       FOR ALL ENTRIES IN it_tvse
       WHERE matkl = it_tvse-matkl
       AND spras = sy-langu.

  SORT it_tvse BY vtweg ASCENDING.

  SELECT vtweg vtext INTO TABLE it_vtweg FROM tvtwt
       FOR ALL ENTRIES IN it_tvse
       WHERE vtweg = it_tvse-vtweg
       AND spras = sy-langu.

  SORT it_tvse BY spart ASCENDING.

  SELECT spart vtext INTO TABLE it_spart FROM tspat
       FOR ALL ENTRIES IN it_tvse
       WHERE spart = it_tvse-spart
       AND spras = sy-langu.

  SORT it_tvse BY prctr ASCENDING.

  SELECT prctr ktext INTO TABLE it_prctr FROM cepct
       FOR ALL ENTRIES IN it_tvse
       WHERE prctr = it_tvse-prctr
       AND spras = sy-langu.

  SORT it_tvse BY kdgrp ASCENDING.

  SELECT kdgrp ktext INTO TABLE it_kdgrp FROM t151t
       FOR ALL ENTRIES IN it_tvse
       WHERE kdgrp = it_tvse-kdgrp
       AND spras = sy-langu.


ENDFORM.                    " GET_DESCRIPTIONS
*&---------------------------------------------------------------------*
*&      Form  PROCESS_ITAB
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM process_itab .

  SORT it_tvse ASCENDING.

  LOOP AT it_tvse ASSIGNING <fs_tvse>.

    READ TABLE it_kdgrp INTO wa_kdgrp WITH KEY kdgrp = <fs_tvse>-kdgrp.
    IF sy-subrc = 0.
      <fs_tvse>-kdgrpd = wa_kdgrp-ktext.
    ENDIF.

    READ TABLE it_tvm3t INTO wa_tvm3t WITH KEY mvgr3 = <fs_tvse>-mvgr3.
    IF sy-subrc = 0.
      <fs_tvse>-mvg3d = wa_tvm3t-bezei.
    ENDIF.

    READ TABLE it_tvm1t INTO wa_tvm1t WITH KEY mvgr1 = <fs_tvse>-mvgr1.
    IF sy-subrc = 0.
      <fs_tvse>-mvg1d = wa_tvm1t-bezei.
    ENDIF.

    READ TABLE it_tvm2t INTO wa_tvm2t WITH KEY mvgr2 = <fs_tvse>-mvgr2.
    IF sy-subrc = 0.
      <fs_tvse>-mvg2d = wa_tvm2t-bezei.
    ENDIF.

    READ TABLE it_tvm4t INTO wa_tvm4t WITH KEY mvgr4 = <fs_tvse>-mvgr4.
    IF sy-subrc = 0.
      <fs_tvse>-mvg4d = wa_tvm4t-bezei.
    ENDIF.

    READ TABLE it_tvm5t INTO wa_tvm5t WITH KEY mvgr5 = <fs_tvse>-mvgr5.
    IF sy-subrc = 0.
      <fs_tvse>-mvg5d = wa_tvm5t-bezei.
    ENDIF.

    READ TABLE it_prctr INTO wa_prctr WITH KEY prctr = <fs_tvse>-prctr.
    IF sy-subrc = 0.
      <fs_tvse>-prctrd = wa_prctr-ktext.
    ENDIF.

    READ TABLE it_matkl INTO wa_matkl WITH KEY matkl = <fs_tvse>-matkl.
    IF sy-subrc = 0.
      <fs_tvse>-wgbez = wa_matkl-wgbez.
    ENDIF.

    READ TABLE it_vtweg INTO wa_vtweg WITH KEY vtweg = <fs_tvse>-vtweg.
    IF sy-subrc = 0.
      <fs_tvse>-vtwegd = wa_vtweg-vtext.
    ENDIF.

    READ TABLE it_spart INTO wa_spart WITH KEY spart = <fs_tvse>-spart.
    IF sy-subrc = 0.
      <fs_tvse>-spartd = wa_spart-vtext.
    ENDIF.


  ENDLOOP.

ENDFORM.                    " PROCESS_ITAB
*&---------------------------------------------------------------------*
*&      Form  INIT_ALV_CATALOUGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM init_alv_catalouge .


  macro_alv 'SEL' 'Sel' '1'.
  macro_alv 'PERIOD' 'Period' '2'.
  macro_alv 'BUDAT' 'Date' '3'.
  macro_alv 'KNDNR' 'Customer' '4'.
  macro_alv 'KDGRPD' 'Cust.Grp' '5'.
  macro_alv 'VKORG' 'Sales.Org' '6'.
  macro_alv 'VTWEGD' 'Dist.Chnl' '7'.
  macro_alv 'SPARTD' 'Div' '8'.
  macro_alv 'WERKS' 'Plant' '9'.
  macro_alv 'PRCTRD' 'Prft.Cntr' '10'.
  macro_alv 'GSBER' 'Buss.Area' '11'.
  macro_alv 'ARTNR' 'Part No' '12'.
  macro_alv 'WGBEZ' 'Matl.Grp' '13'.
  macro_alv 'MVG1D' 'Matl.Grp1' '14'.
  macro_alv 'MVG2D' 'Matl.Grp2' '15'.
  macro_alv 'MVG3D' 'Matl.Grp3' '16'.
  macro_alv 'MVG4D' 'Matl.Grp4' '17'.
  macro_alv 'MVG5D' 'Matl.Grp5' '18'.
  macro_alv 'ABSMG' 'Sale.Qty' '19'.
  macro_alv 'ABSMGVAL' 'In.Sale.Qty' '20'.
  macro_alv 'ERLOS' 'Act.Sales' '21'.
  macro_alv 'ERLOSVAL' 'In.Act.Sales' '22'.


ENDFORM.                    " INIT_ALV_CATALOUGE
*&---------------------------------------------------------------------*
*&      Form  BUILD_ALV_HEADER
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM build_alv_header .

  DATA:dat1(10) TYPE c.
  DATA:dat2(10) TYPE c.

  WRITE so_budat-low TO dat1.
  WRITE so_budat-high TO dat2.

  comments-typ = 'H'.
  comments-info = 'BBND Updation'.
  APPEND comments TO it_comments.
  CLEAR comments.

  comments-typ = 'S'.
  comments-key = 'Controlling Area:'.
  comments-info = pa_kokrs.
  APPEND comments TO it_comments.
  CLEAR comments.

  comments-typ = 'S'.
  comments-key = 'Date:'.
  CONCATENATE dat1 '-' dat2 INTO comments-info.
  APPEND comments TO it_comments.
  CLEAR comments.

ENDFORM.                    " BUILD_ALV_HEADER
*&---------------------------------------------------------------------*
*&      Form  DISPLAY_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM display_alv .

  layout-colwidth_optimize = 'X'.
  layout-box_fieldname = 'SEL'.
  layout-box_tabname = 'IT_TVSE'.
*  layout-edit = 'X'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = 'ZBBND_UPDATION_KSD'
      I_CALLBACK_PF_STATUS_SET = 'SET_GUI'
      i_callback_user_command  = 'USER_COMMAND'
*      i_callback_top_of_page   = 'ALV_TOP'
      is_layout                = layout
      I_STRUCTURE_NAME        = 'ST_TVSE'
      it_fieldcat              = fieldcat[]
    TABLES
      t_outtab                 = it_tvse[].
  .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


ENDFORM.                    " DISPLAY_ALV

*&---------------------------------------------------------------------*
*&      Form  ALV_TOP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM alv_top.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      i_logo             = 'ENJOYSAP_LOGO'
      it_list_commentary = it_comments.

ENDFORM.                    "ALV_TOP

*&---------------------------------------------------------------------*
*&      Form  set_gui
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM set_gui USING  extab TYPE slis_t_extab.
  SET PF-STATUS 'UPD'.
ENDFORM.                    "set_gui

*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->SY-UCOMM   text
*      -->SELFIELD   text
*----------------------------------------------------------------------*
FORM user_command USING ucomm LIKE sy-ucomm
                                 cursor TYPE slis_selfield.
  DATA:ok_code TYPE sy-ucomm.
  ok_code = ucomm.

  CASE ok_code.
    WHEN 'EXI'.
      LEAVE.
    WHEN 'SAV'.
      PERFORM save_entries_into_ztable.
    WHEN 'DES'.
      LOOP AT it_tvse ASSIGNING <fs_tvse> WHERE sel = 'X'  .
        <fs_tvse>-sel = ' '.
      ENDLOOP.
      PERFORM display_alv.
  ENDCASE.

ENDFORM. "user_command
*&---------------------------------------------------------------------*
*&      Form  SAVE_ENTRIES_INTO_ZTABLE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM save_entries_into_ztable .

  DATA:wa_insert TYPE zbbndmast.

  LOOP AT it_tvse ASSIGNING <fs_tvse>.
    wa_insert-mandt = sy-mandt.
    MOVE-CORRESPONDING <fs_tvse> TO wa_insert.
    zbbndmast = wa_insert.
    INSERT zbbndmast.
    IF sy-subrc = 0.
      COMMIT WORK.
    ENDIF.
  ENDLOOP.

  MESSAGE 'Data Successfully Updated' TYPE 'S'.

ENDFORM.                    " SAVE_ENTRIES_INTO_ZTABLE

Former Member
0 Kudos
84

Hiiii...

This can also be done with out using OOPS Alv also ....

just use &REFRESH as sy-ucomm...that will make the internal table column to be 'X'

regards

chandu reddy

Former Member
0 Kudos
84

Hi,

Please refer the link below:

http://www.saptechnical.com/Tutorials/ALV/Edit/demo.htm

Thanks,

Sriram Ponna.

Former Member
0 Kudos
85

hi,

even i faced the same problem when i have a similar requirement. in order to populate' X' value in internal table.

set the fcode to '&REFRESH'

THEN USE EVENT_EXIT STRUCTURE IN SLIS.

populate the fields event_exit-after = 'X'.

pass it to grid display.

u will definitiely get it.

Rewards if useful.

Rgds.,

subash.

0 Kudos
84

whatz this &refresh...

pl give a code piece

Former Member
0 Kudos
84

hi,

once u check the checkboxes u will be clicking on some buttton right. so make that button's fcode to &refresh. and also use slis_event_exit structure and pass the values in a workarea . Then pass this workarea to grid_display for i_event_exit = workarea.

In Usercommand Form.

case sy-ucomm.

when '&REFRESH&'.//at this step debug and see u can find the checkbox values to 'X'.

read table......

ur logic.

Rgds.,

subash