Application Development and Automation 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: 
Read only

Checkbox on selection screen based on table Entries

Muniyappan
Active Contributor
0 Likes
2,032

Hi,

Need Help in below Scenario.

User asked me to create Dynamic selection screen such that

it should display checkbox based on entries in Table.

If there are 2 entries in Table then REPORT should display 2 checkbox.

and if 3 , REPORT should display 3 checkbox.

more over if user add another entry in table then it should display that many checkbox on selecton screen.

Just need to ask you whether is it possible or not?

Regards,

Muniyappan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,339

hello,

For this...

   Create an Internal table as :

   data: Begin itab occurs 0,
           cb_field type char1,

          vbeln like likp-vbeln,
          .....
          end of
itab.

Now you fetch the data into the internal table of itab using 
   some
query...

   select * ......

  Now you are going to display it as....

    Loop at itab.
    write:/ cb_field as checkbox...
             
......
    at this time only write the Hide statement.... as...

    HIDE: values.... u want...

   Endloop..

Now capturing of selected data process...

This can be done by clicking on some USER Command button...

  for suppose you're clicking F8 means...

  AT pf8.
  IF SY-LSIND = 1.
  describe table itab lines VARIABLE
NAME.
    cnt = 3. " Initiate value for Count 3 if you're including page
header.
    do VARIABLE NAME times.
      read line cnt. " Above
counter....
      if sy-lisel(1) =   'X'.
        WRITE:/ 'SELECTED
RECORDS:', itab-cb_field,.....
      endif.
      COUNTER = COUNTER - 1.

      cnt = cnt + 1.
    enddo.
ENDIF.

best regards,

swanand

Hi,

Need Help in below Scenario.

User asked me to create Dynamic selection screen such that

it should display checkbox based on entries in Table.

If there are 2 entries in Table then REPORT should display 2 checkbox.

and if 3 , REPORT should display 3 checkbox.

more over if user add another entry in table then it should display that many checkbox on selecton screen.

Just need to ask you whether is it possible or not?

Regards,

Muniyappan.

3 REPLIES 3
Read only

Former Member
0 Likes
1,340

hello,

For this...

   Create an Internal table as :

   data: Begin itab occurs 0,
           cb_field type char1,

          vbeln like likp-vbeln,
          .....
          end of
itab.

Now you fetch the data into the internal table of itab using 
   some
query...

   select * ......

  Now you are going to display it as....

    Loop at itab.
    write:/ cb_field as checkbox...
             
......
    at this time only write the Hide statement.... as...

    HIDE: values.... u want...

   Endloop..

Now capturing of selected data process...

This can be done by clicking on some USER Command button...

  for suppose you're clicking F8 means...

  AT pf8.
  IF SY-LSIND = 1.
  describe table itab lines VARIABLE
NAME.
    cnt = 3. " Initiate value for Count 3 if you're including page
header.
    do VARIABLE NAME times.
      read line cnt. " Above
counter....
      if sy-lisel(1) =   'X'.
        WRITE:/ 'SELECTED
RECORDS:', itab-cb_field,.....
      endif.
      COUNTER = COUNTER - 1.

      cnt = cnt + 1.
    enddo.
ENDIF.

best regards,

swanand

Read only

Former Member
0 Likes
1,339

Hello,

Please go through this link ,it ll help u

http://www.erpgreat.com/abap/regarding-runtime-creation-of-check-boxes.htm

Regards,

Sam

Read only

alex_campbell
Contributor
0 Likes
1,339

I had a similar case recently where the numbr of checkboxes ranged from 0-40. Instead of using Selection Screen Checkbox Controls, I created a custom screen with an editable ALV, and I displayed each checkbox as a single row in the ALV with the checkbox in one column, and descriptive texts in other columns (see screenshot). It worked pretty well. If you're skilled in Object Oriented programming, you can even wrap it all in a more generic class so that it can be reused in other programs without any modification. The drawbacks of this approach though is that it won't work with variants or background execution.