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: 

check box in list

Former Member
0 Kudos
87

hi,

how to include check box in the report list.

for each line there shld be a check box.

i must take the line and take it to the secondary list.

pls help.

thanks in adv.

will be rewarded.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
59

Hi,

Declare the first field of internal tables as checkbox and display the records

see the sample report.

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.

Regards,

Padmam.

4 REPLIES 4

Former Member
0 Kudos
60

Hi,

Declare the first field of internal tables as checkbox and display the records

see the sample report.

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.

Regards,

Padmam.

Former Member
0 Kudos
59

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.

CHECK THIS LINK,

https://forums.sdn.sap.com/click.jspa?searchID=3028689&messageID=1171856

<b>Reward points for useful Answers</b>

Regards

Ashu

Former Member
0 Kudos
59

Hi,

If u want to include chebox in the list along with some other fields. u can use like below.

Data : mark type c.

data : begin of itab occurs 0,

matnr type mara-matnr,

end of itab.

itab-matnr = '000001234'.

append itab.

write : Mark as checkbox , itab-matnr .

Regards,

Former Member
0 Kudos
59