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

How to pop up an ALV dialog

Hi, in my program, before user deletes records, I need to pop up a ALV dialog in which thoes records are diaplyed, and then user can choose 'continue' to process or 'cancel' to not process. Which function module can do that?

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Oct 20, 2006 at 05:01 PM

    Tom, you can strip all of the seletion functionality out of it. Here is my example, with all of the selection stripped out. It just shows the internal table to the user and the user can click green check to continue, and red X to cancel.

    
    report zrich_0001.
    
    
    type-pools: slis.
    
    data: begin of ima occurs 0,
          matnr type makt-matnr,
          maktx type makt-maktx,
          end of ima.
    
    data: begin of ima2 occurs 0,
          matnr type makt-matnr,
          maktx type makt-maktx,
          end of ima2.
    
    <b>data: exit type c.</b>
    
    data: ifldc type slis_t_fieldcat_alv .
    data: xfldc type slis_fieldcat_alv .
    
    select matnr maktx into corresponding fields of table ima
             from makt up to 100 rows.
    
    clear xfldc.
    xfldc-reptext_ddic    = 'Material Number'.
    xfldc-fieldname  = 'MATNR'.
    xfldc-tabname   = 'IMA'.
    xfldc-outputlen  = '18'.
    append xfldc to ifldc.
    
    clear xfldc.
    xfldc-reptext_ddic    = 'Material Description'.
    xfldc-fieldname  = 'MAKTX'.
    xfldc-tabname   = 'IMA'.
    xfldc-outputlen  = '40'.
    append xfldc to ifldc.
    
    call function 'REUSE_ALV_POPUP_TO_SELECT'
         exporting
    <b>          I_SELECTION          = space</b>
              i_tabname            = 'IMA'
              it_fieldcat          = ifldc
    <b>     importing
              E_EXIT               = exit</b>
         tables
              t_outtab             = ima
         exceptions
              program_error        = 1
              others               = 2.
    
    <b>if exit = space.
    * Do what ever
    else.
    * User pressed on the cancel button, don't do anything
    Endif.</b>
    
    

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Tom, my sample program works really good and it is a popup dialog box which does overlap the screen. Here is my test program for the same, I can still see my screen 100 underneath the dialog. IT has a text field with two bottons one for ALV and another for BACK.

      
      report zrich_0001.
      
      
      type-pools: slis.
      
      data: begin of ima occurs 0,
            matnr type makt-matnr,
            maktx type makt-maktx,
            end of ima.
      
      data: begin of ima2 occurs 0,
            matnr type makt-matnr,
            maktx type makt-maktx,
            end of ima2.
      
      data: ok_code type sy-ucomm.
      data: exit type c.
      
      data: ifldc type slis_t_fieldcat_alv .
      data: xfldc type slis_fieldcat_alv .
      
      select matnr maktx into corresponding fields of table ima
               from makt up to 100 rows.
      
      clear xfldc.
      xfldc-reptext_ddic    = 'Material Number'.
      xfldc-fieldname  = 'MATNR'.
      xfldc-tabname   = 'IMA'.
      xfldc-outputlen  = '18'.
      append xfldc to ifldc.
      
      clear xfldc.
      xfldc-reptext_ddic    = 'Material Description'.
      xfldc-fieldname  = 'MAKTX'.
      xfldc-tabname   = 'IMA'.
      xfldc-outputlen  = '40'.
      append xfldc to ifldc.
      
      
      
      call screen 100.
      
      
      *&---------------------------------------------------------------------*
      *&      Module  STATUS_0100  OUTPUT
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      module status_0100 output.
      *  SET PF-STATUS 'xxxxxxxx'.
      *  SET TITLEBAR 'xxx'.
      
      endmodule.                 " STATUS_0100  OUTPUT
      *&---------------------------------------------------------------------*
      *&      Module  USER_COMMAND_0100  INPUT
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      module user_command_0100 input.
      
        case ok_code.
          when 'BACK'.
            clear ok_code.
            leave program.
          when 'ALV'.
            clear ok_code.
      
      
      
            call function 'REUSE_ALV_POPUP_TO_SELECT'
                 exporting
                      i_selection   = space
                      i_tabname     = 'IMA'
                      it_fieldcat   = ifldc
                 importing
                      e_exit        = exit
                 tables
                      t_outtab      = ima
                 exceptions
                      program_error = 1
                      others        = 2.
      
            if exit = space.
      * Do what ever
            else.
      * User pressed on the cancel button, don't do anything
            endif.
      
        endcase.
      
      endmodule.                 " USER_COMMAND_0100  INPUT
      
      

      Again, the dialog does overlap the screen from which it was called from. At least in my example. Are you saying that you can not see your original screen underneath the dialog box ?

      Regards,

      Rich Heilman

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2006 at 04:43 PM

    Hi,

    use the FM REUSE_ALV_POPUP_TO_SELECT..

    Thanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 20, 2006 at 04:44 PM

    Tom, check this sample program. This program actually allows the user to select the records in the popup, for your requirement you can just comment out the references to the CHECK field, and just accept the entire internal table as records that you want to process.

    
    
    report zrich_0001.
    
    type-pools: slis.
    
    data: begin of ima occurs 0,
          check type c,
          matnr type makt-matnr,
          maktx type makt-maktx,
          end of ima.
    
    data: begin of ima2 occurs 0,
          check type c,
          matnr type makt-matnr,
          maktx type makt-maktx,
          end of ima2.
    
    data: ifldc type slis_t_fieldcat_alv .
    data: xfldc type slis_fieldcat_alv .
    
    select matnr maktx into corresponding fields of table ima
             from makt up to 100 rows.
    
    
    clear xfldc.
    xfldc-reptext_ddic    = ' '.
    xfldc-fieldname  = 'CHECK'.
    xfldc-tabname   = 'IMA'.
    xfldc-outputlen  = '1'.
    append xfldc to ifldc.
    
    clear xfldc.
    xfldc-reptext_ddic    = 'Material Number'.
    xfldc-fieldname  = 'MATNR'.
    xfldc-tabname   = 'IMA'.
    xfldc-outputlen  = '18'.
    append xfldc to ifldc.
    
    clear xfldc.
    xfldc-reptext_ddic    = 'Material Description'.
    xfldc-fieldname  = 'MAKTX'.
    xfldc-tabname   = 'IMA'.
    xfldc-outputlen  = '40'.
    append xfldc to ifldc.
    
    <b>call function 'REUSE_ALV_POPUP_TO_SELECT'
         exporting
              i_checkbox_fieldname = 'CHECK'
              i_tabname            = 'IMA'
              it_fieldcat          = ifldc
         tables
              t_outtab             = ima
         exceptions
              program_error        = 1
              others               = 2.</b>
    
    check sy-subrc  = 0.
    
    
    * Write selected lines to anther itab.
    loop at ima where check = 'X'.
      clear ima2.
      move ima to ima2.
      append ima2.
    endloop.
    
    
    * Write out other itab.
    
    loop at ima2.
      write:/ ima2-matnr, ima2-maktx.
    endloop.
    
    

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Rich and Naren. But my issue is only to display those records which is in an internal table ITAB already, and then let user click 'continue' or 'cancel'. I don't need to do any selection. Can you give me any function to do that?

      Tom

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2006 at 04:59 PM

    Hi,

    If you don't want to build the field catalog..

    Use the FM POPUP_WITH_TABLE_DISPLAY..

    Thanks,

    Naren

    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.