2007 Jun 07 7:21 AM
Hi frieds,
I wants to display a list of record in basic list and also one chek box for every record.
Then based on selected check box i want to cancel that record in database means i want to set it's flag. also in application toolbar of basic list display cancel button.
can any one gives me code for this.
Thank you.
Regards,
Virat
2007 Jun 07 7:25 AM
Hi,
My idea is...
Have one field as FLAG type C in the internal table and keep this as first column of the report.
Write FLAG s Checkbox..Then it will display the checkbox...and have one button in the tool bar.
If the user selects the checkbox and clicking the button...
1. it should update the FLAG as X for the corresponding record..
it should capture the reords and process further.
2007 Jun 07 7:22 AM
Hi
See the sample example code
and do accordingly
TABLES:MARA.
DATA:BEGIN OF GT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF GT_MARA,
GV_CB,
GV_CBV,
GV_LINES TYPE I,
INDEX TYPE I,
SY_INDEX TYPE I,
GV_LINES1 TYPE I,
MATNR LIKE MARA-MATNR.
SELECT-OPTIONS:S_MATNR FOR MARA-MATNR.
SELECT
MATNR FROM MARA
INTO TABLE GT_MARA
WHERE MATNR IN S_MATNR.
IF SY-SUBRC = 0.
DESCRIBE TABLE GT_MARA LINES GV_LINES.
ENDIF.
LOOP AT GT_MARA.
WRITE:/ GV_CB AS CHECKBOX,
GT_MARA-MATNR.
ENDLOOP.
CLEAR GT_MARA.
WRITE:'Total num of records is ',GV_LINES.
SET PF-STATUS 'DEL'.
AT USER-COMMAND.
IF SY-UCOMM = 'DEL' OR SY-UCOMM = 'PICK'.
DO 50 TIMES.
SY_INDEX = SY-INDEX.
READ LINE SY_INDEX FIELD VALUE GV_CB
GT_MARA-MATNR INTO MATNR.
IF GV_CB = 'X'." AND MATNR IS NOT INITIAL.
LOOP AT GT_MARA." WHERE MATNR = MATNR.
DELETE GT_MARA.
CLEAR GT_MARA.
ENDLOOP.
delete gt_mara index sy_index.
ENDIF.
ENDDO.
DESCRIBE TABLE GT_MARA LINES GV_LINES1.
WRITE:'Total num of records is ',GV_LINES1.
CLEAR:GV_LINES .
LOOP AT GT_MARA.
WRITE:/ GT_MARA-MATNR.
ENDLOOP.
ENDIF.
Reward points for useful Answers
Regards
Anji
2007 Jun 07 7:23 AM
Hi Virat,
CHECK THIS LINK,
https://forums.sdn.sap.com/click.jspa?searchID=3028689&messageID=1171856
THANKS.
2007 Jun 07 7:25 AM
Hi,
My idea is...
Have one field as FLAG type C in the internal table and keep this as first column of the report.
Write FLAG s Checkbox..Then it will display the checkbox...and have one button in the tool bar.
If the user selects the checkbox and clicking the button...
1. it should update the FLAG as X for the corresponding record..
it should capture the reords and process further.