Skip to Content
author's profile photo Former Member
Former Member

Button on screen

How can I put a button on a screen after a list that have been displayed?. The idea is have a button that the user could click to confirm the deleting of the data shown in the list.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2005 at 05:53 PM

    Use:

    PF-STATUS 'NAMEOFYOURSTATUS'. then you can add more buttons.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 12, 2005 at 07:11 PM

    If you want to make the icon or symbol displayed on the list screen so that when you click on that icon/symbol, it will trigger an action, try looking at sample program DEMO_LIST_FORMAT_HOTSPOT.

    This program display a text as hotspot. When you click at that hotspot, it will trigger event at line-selection. You can instead display an icon/symbol as hotspot, then during at line-selection event, check fields sy-lisel, sy-cucol and sy-curow to find out whether that icon/symbol has been clicked. Then you can proceed with whatever action you want based on user clicked.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 12, 2005 at 08:42 PM

    Hi Ruben,

    Following is a small piece of code to demo the use of interactive lists. This is very rudimentary example. But there are other newest ways to achieve this, ALV lists in particular, are easier to use and control.

    DATA: BEGIN OF itab OCCURS 0,
            select TYPE c,
            vbeln  LIKE vbak-vbeln.
    DATA: END OF itab.
    
    DATA: v_pages        TYPE i,
          v_current_page TYPE i,
          v_vbeln        LIKE vbak-vbeln.
    
    *------------------
    START-OF-SELECTION.
    *------------------
    
      SELECT vbeln FROM vbak
                   INTO CORRESPONDING FIELDS OF TABLE itab
                  WHERE vkorg = '2500' .
    
    *----------------
    END-OF-SELECTION.
    *----------------
    
      SET PF-STATUS 'MAIN'.
      APPEND LINES OF itab TO itab.
      APPEND LINES OF itab TO itab.
      LOOP AT itab.
        WRITE:/ itab-select AS CHECKBOX,
                itab-vbeln.
      ENDLOOP.
      v_pages = sy-pagno.
    
    *---------------
    AT USER-COMMAND.
    *---------------
    
      CASE sy-ucomm.
    
        WHEN 'SEL'.
    *-- Select all
    *-- Include logic for selection of all the lines of the list, may be by
    *   having  a checkbox in front of each line
          DO v_pages TIMES.
            v_current_page = sy-index.
            DO.
              READ LINE sy-index OF PAGE v_current_page.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
              sy-lisel+0(1) ='X'.
              MODIFY CURRENT LINE.
            ENDDO.
          ENDDO.
        WHEN 'DSEL'.
    *-- Deselect all
    *-- Include logic for de-selection of all the lines of the list
          DO v_pages TIMES.
            v_current_page = sy-index.
            DO.
              READ LINE sy-index OF PAGE v_current_page.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
              sy-lisel+0(1) = space.
              MODIFY CURRENT LINE.
            ENDDO.
          ENDDO.
    
        WHEN 'DEL'.
    *-- Delete selected lines
          DO v_pages TIMES.
            v_current_page = sy-index.
            DO.
              READ LINE sy-index OF PAGE v_current_page.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
              IF sy-lisel+0(1) = 'X'.
    *-- this line is selected,
    *-- your logic for deletion.
                v_vbeln = sy-lisel+1(10).
    *-- delete the selected sales order
              ENDIF.
            ENDDO.
          ENDDO.
    
        WHEN OTHERS.
    *-- Issue message to choose the correct function
      ENDCASE.
    

    If you need any further clarifications, please let me know.

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2005 at 09:14 PM

    Adding some detail to Carlos' suggestion. Define a status with a button, icon and function code. Use the SET PF-STATUS.. command somewhere before the list is displayed. Use the AT USER-COMMAND event to respond and determine if your button was hit as shown in an earlier posting.

    I am assuming that hitting the button means delete all. If you want the user to select what should be deleted, then consider the checkbox option mentioned earlier or switch to an ALV Grid and allow multiple selection.

    Let us know how it goes!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.