SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Example with FM REUSE_ALV_POPUP_TO_SELECT



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ALV Grid / ALV Tree / ALV List
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Jan 26, 2008 4:28 pm    Post subject: Example with FM REUSE_ALV_POPUP_TO_SELECT Reply with quote

Code:
REPORT z_reuse_alv_popup_to_select.
*---------------------------------------------------------------------*
* Example with FM REUSE_ALV_POPUP_TO_SELECT                           *
*---------------------------------------------------------------------*
* Author : Michel PIOUD                                               *
* Email : [email protected]  HomePage : http://www.geocities.com/mpioud *
*---------------------------------------------------------------------*
SELECTION-SCREEN :
  SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.    "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
*---------------------------------------------------------------------*
TYPES:
  BEGIN OF ty_user_addr,
    bname      TYPE user_addr-bname,        " User name
    name_first TYPE user_addr-name_first,   " First name
    name_last  TYPE user_addr-name_last,    " Last name
    checkbox,
  END OF ty_user_addr.
*---------------------------------------------------------------------*
DATA:
* Data displayed
  gt_user TYPE TABLE OF ty_user_addr.
*---------------------------------------------------------------------*
INITIALIZATION.

  v_1 = 'Maximum of records to read'.

*---------------------------------------------------------------------*
START-OF-SELECTION.

  PERFORM f_read_data.

  PERFORM f_display_data.

*---------------------------------------------------------------------*
*      Form  f_read_data
*---------------------------------------------------------------------*
FORM f_read_data.

* Read Users address data
  SELECT bname name_first name_last
      UP TO p_max ROWS
    INTO CORRESPONDING FIELDS OF TABLE gt_user
    FROM user_addr.

ENDFORM.                               " F_READ_DATA
*---------------------------------------------------------------------*
*      Form  f_display_data
*---------------------------------------------------------------------*
FORM f_display_data.

* Macro definition
  DEFINE m_fieldcat.
    add 1 to ls_fieldcat-col_pos.
    ls_fieldcat-fieldname   = &1.
    ls_fieldcat-ref_tabname = &2.
    append ls_fieldcat to lt_fieldcat.
  END-OF-DEFINITION.

  TYPE-POOLS: slis.                    " ALV Global types

  DATA:
    l_exit,
    ls_private  TYPE slis_data_caller_exit,
    ls_user     TYPE ty_user_addr,
    ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv.

* Build the field catalog
  m_fieldcat 'BNAME'      'USER_ADDR'.
  m_fieldcat 'NAME_FIRST' 'USER_ADDR'.
  m_fieldcat 'NAME_LAST'  'USER_ADDR'.

* Optimize column width
  ls_private-columnopt = 'X'.

* Display data in a POPUP
  CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
       EXPORTING
            i_selection          = 'X'
            i_zebra              = 'X'
            it_fieldcat          = lt_fieldcat
            i_tabname            = 'GT_USER'
            i_checkbox_fieldname = 'CHECKBOX'
            is_private           = ls_private
       IMPORTING
            e_exit               = l_exit
       TABLES
            t_outtab             = gt_user.

  CHECK l_exit = space.

* What has been selected ?
  LOOP AT gt_user INTO ls_user WHERE checkbox = 'X'.
    MESSAGE i368(00) WITH ls_user-bname 'selected'.
  ENDLOOP.

ENDFORM.                               " F_DISPLAY_DATA
*********** END OF PROGRAM Z_REUSE_ALV_POPUP_TO_SELECT ****************
 
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ALV Grid / ALV Tree / ALV List All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.