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

Former Member
0 Kudos

hello,

i have diplaying the values in the list through ALV using function module REUSE_ALV_LIST_DISPLAY anfd i have created my own PF-STATUS and EVEYTHING is WORKING fine.

In THE pf-status i have a "Select all" option when i click it all the checkbox should be Checked how to do it, actually the code i have written is Modifiying the field in the internal table but it is not displaying the same in the Output, any link would be helpfull

cheers

8 REPLIES 8

former_member188685
Active Contributor
0 Kudos

hi,

in your application tool bar add this Function code <b>&ALL</b> for select all, <b>&SAL</b> for deslect all.

this will take care of selct all and deslect all ,no need to code also for this...

Regards

vijay

0 Kudos

HAI,

I HAVE ALREDAY DONE IT BUT WHEN I ECUTE THAT "SELECT ALL " COMMAND IT IS NOT CHEKCING THE CHECKBOX RATHER IT IS SELECTING THE ENTIRE LINE.

CHEERS

0 Kudos

Hi,

do one thing..,

Go to SE41 give the Program name <b>SAPLKKBL</b>

and status as <b>STANDARD</b>

now click Copy status (CTRL+F6), now give your Program name , and PF-status and copy it. now save it and activate the pf-satus which you have copied. and use it in your PF-status form.

and try now....

and if possible show your code..

Regards

vijay

0 Kudos

hai vijay,

i have done it it is selecting the rows but not selecting the checkbox, also when i try check the checkbox it is give me short dump and also instead of making slecting the rows how to make to slelect the checkbox in the respective rows.

cheers

0 Kudos

Hi Kumar,

I have done similar requirement.

Following is the internal table with checkbox.


DATA : BEGIN OF itab OCCURS 0,
         chbx1 LIKE ypvb-chbx1,
         matnr LIKE mard-matnr,
         maktx LIKE makt-maktx,
         werks LIKE mard-werks,
         lgort LIKE mard-lgort,
         charg LIKE mchb-charg,
         mblnr LIKE mseg-mblnr,
         aufnr LIKE mseg-aufnr,
         afmtx LIKE makt-maktx,
         bwart LIKE mseg-bwart,
         labst LIKE mard-labst,
         clabs LIKE mchb-clabs,
         meins LIKE mara-meins,
         salk3 LIKE mbew-salk3,
         END OF itab.

Following cod is for making nput for checkbox in alv


CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            i_program_name         = repid
            i_internal_tabname     = 'ITAB'
            i_inclname             = repid
       CHANGING
            ct_fieldcat            = t_fieldcat
       EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  LOOP AT t_fieldcat INTO s_fieldcat.
    IF s_fieldcat-fieldname = 'CHBX1'.
      MOVE:         'X'      TO s_fieldcat-checkbox,
                    'X'      TO s_fieldcat-input,
                    'X'      TO s_fieldcat-fix_column,
                    'Buchen' TO s_fieldcat-seltext_l,
                    'Buchen' TO s_fieldcat-seltext_m,
                    'X'      TO s_fieldcat-key,
                    'Buchen' TO s_fieldcat-seltext_s.
      MODIFY t_fieldcat FROM s_fieldcat.
    ENDIF.

for calling function module for display.



 CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
*     I_INTERFACE_CHECK              = ' '
*     I_BYPASSING_BUFFER             =
*     I_BUFFER_ACTIVE                = ' '
      i_callback_program             = repid
     i_callback_pf_status_set       = 'STANDARD'
      i_callback_user_command        = 'USER_COMMAND'
*     I_STRUCTURE_NAME               =
      is_layout                      = ls_layout
      it_fieldcat                    = t_fieldcat
*     IT_EXCLUDING                   =
*     IT_SPECIAL_GROUPS              =
*     IT_SORT                        =
*     IT_FILTER                      =
*     IS_SEL_HIDE                    =
*     I_DEFAULT                      = 'X'
*      i_save                         = 'A'
*      is_variant                     = alv_variante
*     IT_EVENTS                      =
*     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
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER        =
*     ES_EXIT_CAUSED_BY_USER         =
    TABLES
      t_outtab                       = itab
    EXCEPTIONS
      program_error                  = 1
      OTHERS                         = 2.
  IF sy-subrc <> 0.
    MESSAGE e000(oo) WITH 'Schwerer Fehler im ALV'.
  ENDIF.

For select all and deselect all logic


FORM standard USING rt_extab TYPE slis_t_extab.
  DELETE rt_extab WHERE fcode EQ '&OL0' OR
                          fcode EQ '&ALL' OR
                          fcode EQ '&SAL'.

  SET PF-STATUS 'LIST' EXCLUDING rt_extab.
ENDFORM.
and change the icon names for select all and deselect all to 'ALL' and 'SAL' in the pf-status list.

code for selectong all checkboxes


FORM user_command USING p_ucomm LIKE sy-ucomm               "#EC CALLED
                        p_selfield TYPE slis_selfield.

  CASE p_ucomm.
    WHEN 'BUCH'.

      PERFORM batchinput.

*------
*      IF NOT gt_buchlog IS INITIAL.
*        CALL SCREEN '1001' STARTING AT 50  10
*                           ENDING AT   120 20.
*      ENDIF.
    WHEN 'REFRESH'.
      IF l_subrc EQ 0.
        p_selfield-refresh = 'X'.
        DELETE itab WHERE chbx1 = 'X' .
      ENDIF.
      CLEAR l_subrc.
    WHEN 'ALL'.  ---->imp
      LOOP AT itab.
        MOVE 'X' TO itab-chbx1.
        MODIFY itab.
      ENDLOOP.
    WHEN 'SAL'.
      LOOP AT itab.
        MOVE space TO itab-chbx1.
        MODIFY itab.
      ENDLOOP.
  ENDCASE.
ENDFORM.
Hope this helps.

Thanks and regards
Chandu.

Former Member
0 Kudos

Hi kumar,

1. Simple.

*----


U must be having some call back form,

where u detect the okcdoe

and using loop,

make the field for checkbox as 'X'.

after doing all this,

just do this.

*----


2. In the call back form,

give

<b>slis_selfield-refresh = 'X'.</b>

regards,

amit m.

Message was edited by: Amit Mittal

Former Member
0 Kudos

Hi again,

1. To get a taste of it,

just copy paste this program.

2. It will display alv (t001)

and DOUBLE-CLICK ON any row.

It will TICK ALL THE CHECKBOXES.

3.

REPORT abc.

TYPE-POOLS : slis.

*----


Data

DATA : BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE t001.

DATA : flag tyPE c,

END OF itab.

DATA : alvfc TYPE slis_t_fieldcat_alv.

DATA : alvly TYPE slis_layout_alv.

*----


Select Data

SELECT * FROM t001 INTO TABLE itab.

*------- Field Catalogue

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_inclname = sy-repid

CHANGING

ct_fieldcat = alvfc

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

*----


Display

alvly-box_fieldname = 'FLAG'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

it_fieldcat = alvfc

i_callback_program = sy-repid "<-------Important

i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important

is_layout = alvly

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

*----


  • CALL BACK FORM

*----


FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE

slis_selfield.

LOOP AT itab.

itab-flag = 'X'.

MODIFY itab.

ENDLOOP.

*----


IMPORTANT.

WHATROW-REFRESH = 'X'.

ENDFORM. "ITAB_user_command

regards,

amit m.

Former Member
0 Kudos

Hi,

In the FM 'REUSE_ALV_LIST_DISPLAY' parameter i_layout check that

i_layout-box_fieldname = 'name_checkbox'.

i_layout-box_tabname = 'tabname_checbox'.

I have an ALV with checkboxes and the 2 de/select all option and works OK.

Hope it helps.

Mireia