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: 

Push button "Select Block" on the list screen?Interactive report

Former Member
0 Kudos

Hi, i am developing a plain report(Use read data & write output, not ALV).

And there was a checkbox(itab-chx) before each line of the output list.

The customer wants me to add 4 buttons on the menu bar, they are 'Delete', 'Select ALL', 'Deselect all', <b>'Select block'</b>.

As far as i know that 'Delete' button is for the user to delete the entries which they have checked using the checkbox.

As for 'Select ALL' is that when they push this button, all the checkbox on the output list are checked.

As for 'Deselect all' is that ...all are unchecked.

<b>BUT</b> i dont have any idea on 'Select Block' function?? What it is and how to program and handling with this button???

Below is my code for those button, just dont know what 'Select block' means


at user-command.
  case sy-ucomm.
    when 'DLT'. 'Delete
         'Do delete things...

    when 'SLL'. 'Select all      
      loop at itab.
        itab-chx = 'X'.
        modify itab index sy-tabix.
      endloop.

      sy-lsind = 0.
      perform output.


    when 'DSL'. 'Deselect all
      loop at itab.
        itab-chx = ' '.
        modify itab index sy-tabix.
      endloop.

      sy-lsind = 0.
      perform output.


    when 'SBL'.  'Select block
        
      '???? No idea at all!!!


  endcase.

Great thanks!!! Any helps?

Hoo lala

Message was edited by:

Hoo lala

Message was edited by:

Hoo lala

4 REPLIES 4

Former Member
0 Kudos

Refer this demo report, it is having 2 buttons one Call (defined in PF status) and other one PA30 one.

u have to create a PF status, and there in Application Toolbar option i have cretaed a button Named Call. like tht u can create more buttons as per ur requirement.



REPORT  ZGILL_CALLREPORT                        .
DATA: L_PERNR(20).

parameters : p_rname(20) obligatory DEFAULT 'NONE'.
INCLUDE <icon> .
selection-screen pushbutton 60(20) gocfg user-command amit.

AT SELECTION-SCREEN OUTPUT.
write icon_configuration as icon to gocfg.
concatenate gocfg 'Go to PA30' into gocfg.



AT SELECTION-SCREEN.

if sy-ucomm = 'AMIT'.
SET PARAMETER ID 'PER' FIELD '10000000'.
call transaction 'PA30'.
ENDIF.

Start-of-selection.

write: 'This Report is called by report',' ',p_rname left-justified.
set pf-status 'TEST'.

AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'CALL'.

submit zgill_it using selection-set 'TESTING_IT'
       exporting list to memory and return.

perform get_output.

WHEN '&F03'.
  LEAVE SCREEN.
WHEN '&F15'.
  LEAVE PROGRAM.
ENDCASE.
*&---------------------------------------------------------------------*
*&      Form  get_output
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form get_output .
data : listobject like abaplist occurs 0.
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject       = listobject
* EXCEPTIONS
*   NOT_FOUND        = 1
*   OTHERS           = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'DISPLAY_LIST'
* EXPORTING
*   FULLSCREEN                  =
*   CALLER_HANDLES_EVENTS       =
*   STARTING_X                  = 10
*   STARTING_Y                  = 10
*   ENDING_X                    = 60
*   ENDING_Y                    = 20
* IMPORTING
*   USER_COMMAND                =
  TABLES
    listobject                  = listobject
* EXCEPTIONS
*   EMPTY_LIST                  = 1
*   OTHERS                      = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
refresh listobject.

endform.                    " get_output

Former Member
0 Kudos

Hey,

You will have to find the number of lines displayed on each page. This will be the top-of-page lines subtracted from the page line size. Lets say the number is 20. After this Loop at the internal table from index 1 to 16 and set the CHK field to X.

The tricky part is if the user uses PageDown and then selects the SelectBlock button. You need to find the first line displayed on the current list and then loop at the table from that line.

Hope this helps...

~Kiran

Former Member
0 Kudos

Yes~~Thank you very much for the analysis.

And for my understanding up to now, maybe more accuracy that the requirement is that when the user checked 1 record and then checked another record by using checkbox.

Then they push the 'select block' button which had been defined on the application toolbar.

When ever the user presses that button the block between those 2 selected records should be selected(means checkbox of those entries should be checked).

Message was edited by:

Hoo lala

Former Member
0 Kudos

... finally...

my version:

'Select Block' function for normal report.

When you checked first record and then checked another record by using checkbox. Then click the 'Select Block' button. Whenever you presses that button the block between those 2 selected records would be selected and checked.

Code:

when 'SBL'. 
      Clear sy-ucomm. 

      describe table itab lines counter. 
      cnt = 0. 

      do. 
        read line sy-index field value itab-g_chx. 

        if itab-g_chx = 'X'. 

          index6_itab = sy-index. 
          exit. 

        endif. 
        cnt = cnt + 1. 
        if cnt > counter. 
          exit. 
        endif. 
      enddo. 

      index2_itab = index6_itab + 1. 

      do. 
        read line index2_itab field value itab-g_chx. 
        if itab-g_chx = 'X'. 

          index7_itab = index2_itab. 
          exit. 

        endif. 
        index2_itab = index2_itab + 1. 
        if index2_itab > counter. 
          exit. 
        endif. 
      enddo. 

      index6_itab = index6_itab - 1. 
      index7_itab = index2_itab - 1. 



      LOOP AT itab FROM INDEX6_ITAB TO INDEX7_ITAB. 
        itab-g_chx = 'X'. 
        MODIFY itab. 
      ENDLOOP. 

      sy-lsind = 0. 
      perform output.

And it works.

But i am still wondering why i need to '- 1' then i can get the right record.