2013 Nov 28 6:42 AM
hi.
i am creating an interactive list report using checkbox.
the basic list output for SY-LSIND = 1 in the following image
i want to have a SELECT ALL button to select all the checkbox at a time.
plz help me with the code on how to select all the checkbox at a time..
thank you..
2013 Nov 28 6:46 AM
In your PF status add a button for select all in application in toolbar. It will be display. Once it is click in your user command Loop at OUTPUT table and pass value X to this chekcbox field
Nabheet
2013 Nov 28 6:53 AM
Hi Santanu,
Refer the below given link. Seems like similar scenario as that of yours.
https://scn.sap.com/thread/733049
Regards,
Philip.
2013 Nov 28 6:57 AM
1. First set the GUI Status in PBO.
2. In the menu painter, for that GUI, create select all button with fcode say '&SEL'.
3. In the ALV FM, have a user command module,
3. In the user command module, if r_ucomm = '&SEL'.
loop through the data table, and set checkbox = 'X' for all row.
4. Dont forget to refresh ALV using rs_selfield-refresh = 'X'.
You will get your desired output.
2013 Nov 28 6:59 AM
2013 Nov 28 7:28 AM
2013 Nov 28 7:29 AM
Hi santanu,
Check the following code, create a button select all in application toolbar of pf status.
TABLES: mara,makt.
TYPES: BEGIN OF ty_mara,
matnr TYPE matnr, "Material Number
ersda TYPE ersda, "Created On
ernam TYPE ernam, "Name of Person who Created the Object
END OF ty_mara,
BEGIN OF ty_makt,
matnr TYPE matnr, "Material Number
spras TYPE spras, "Language Key
maktx TYPE maktx, "Material Description (Short Text)
END OF ty_makt.
DATA: it_mara TYPE STANDARD TABLE OF ty_mara INITIAL SIZE 0,
wa_mara TYPE ty_mara,
it_makt TYPE STANDARD TABLE OF ty_makt INITIAL SIZE 0,
wa_makt TYPE ty_makt,
lv_matnr TYPE matnr,
c1 .
DATA: SD_BOOL TYPE wdy_boolean,
PS_BOOL type wdy_boolean.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECTION-SCREEN: END OF BLOCK b1.
AT SELECTION-SCREEN.
IF s_matnr IS NOT INITIAL.
SELECT SINGLE matnr
FROM mara
INTO lv_matnr
WHERE matnr IN s_matnr.
IF sy-subrc NE 0.
MESSAGE: 'Material Number does not exist' TYPE'E'.
ENDIF.
ENDIF.
START-OF-SELECTION.
SELECT matnr
ersda
ernam
FROM mara
INTO TABLE it_mara
WHERE matnr IN s_matnr.
IF sy-subrc EQ 0.
SORT it_mara BY matnr.
ENDIF.
SET PF-STATUS 'CHK'.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'DISPLAY'.
DATA ln TYPE i.
DESCRIBE LIST NUMBER OF LINES ln.
DO ln TIMES.
READ LINE sy-index FIELD VALUE c1 .
IF c1 = 'X'.
SELECT matnr
spras
maktx
FROM makt
INTO TABLE it_makt
WHERE matnr = wa_mara-matnr.
IF sy-subrc EQ 0.
SORT it_makt BY matnr.
ENDIF.
IF it_makt IS NOT INITIAL.
LOOP AT it_makt INTO wa_makt.
WRITE: / wa_makt-matnr,
wa_makt-spras,
wa_makt-maktx.
ENDLOOP.
ENDIF.
ENDIF.
ENDDO.
WHEN 'EXIT'.
message:'Are you sure' type'I'.
LEAVE LIST-PROCESSING.
WHEN 'SELECTALL' .
IF c1 IS INITIAL.
LOOP AT it_mara INTO wa_mara.
c1 = 'X'.
WRITE: / c1 as CHECKBOX ,wa_mara-matnr,
wa_mara-matnr,
wa_mara-ersda,
wa_mara-ernam.
HIDE wa_mara-matnr.
ENDLOOP.
.
ENDIF.
WHEN OTHERS.
endcase.
END-OF-SELECTION.
IF it_mara IS NOT INITIAL.
LOOP AT it_mara INTO wa_mara.
WRITE: / c1 as CHECKBOX ,wa_mara-matnr,
wa_mara-matnr,
wa_mara-ersda,
wa_mara-ernam.
HIDE wa_mara-matnr.
ENDLOOP.
ENDIF.
AT LINE-SELECTION.
SELECT matnr
spras
maktx
FROM makt
INTO TABLE it_makt
WHERE matnr = wa_mara-matnr.
IF sy-subrc EQ 0.
SORT it_makt BY matnr.
ENDIF.
IF it_makt IS NOT INITIAL.
LOOP AT it_makt INTO wa_makt.
WRITE: / wa_makt-matnr,
wa_makt-spras,
wa_makt-maktx.
ENDLOOP.
ENDIF.
2013 Nov 28 7:05 PM
thanks for all your support..
but the fact is ..i am creating these checkbox at the output list only..it's not a internal table or db field. my program is as follows:
LOOP AT IT_01 INTO WA_01. " IT_01 is the internal table
WRITE:/1'|', CHK AS CHECKBOX , 7'|',
8(18) WA_01-MATNR COLOR 2,26'|',
27(10) WA_01-ERSDA COLOR 3 INTENSIFIED OFF,40'|'.
HIDE WA_01-MATNR.
ENDLOOP.
plz help me if u can..thanks
2013 Nov 29 3:56 AM
check my above program buddy.. this will solve the issue.. try executing it ..
Regards,
Sivaganesh