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

ALV



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Wed Sep 19, 2007 11:34 am    Post subject: ALV Reply with quote

REUSE_ALV_GRID_DISPLAY - Output of a simple list

Code:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
    I_CALLBACK_PROGRAM                = W_REPID
    I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS'
    I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
 
 
FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
                        P_SELFLD TYPE SLIS_SELFIELD.
  DATA ref1 TYPE REF TO cl_gui_alv_grid.
  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
       E_GRID = ref1.
   CALLl METHOD ref1->check_changed_data
 
  CASE P_UCOMM.
 
     WHEN 'SELECTALL'.
           loop at itab.
               itab-check = 'X'.
               modify itab index sy-tabix.
            endif.
     ENDCASE.
 
    P_SELFLD-REFRESH = 'X'.
 
ENDFORM.


GET_GLOBALS_FROM_SLVC_FULLSCR - Get referrer to object grid.

REUSE_ALV_FIELDCATALOG_MERGE - Create field catalog from dictionary structure or internal table

REUSE_ALV_LIST_DISPLAY -Output a simple list (single line or several lines)

Functionality
This module outputs an internal table with any structure as a formatted one-line or multiple-line list.

Principle:
Pass an internal table with the set of output information
Pass a structure with general list layout details
Pass a field catalog as an internal table
The field catalog describes the fields to be output in the list.

Code:
TYPE-POOLS : slis.
*-------------- Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : flag tyPE c,
END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
 
*--------- Select Data
SELECT * FROM t001 INTO TABLE itab.
 
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'ITAB'
    i_inclname = sy-repid
  CHANGING
    ct_fieldcat = alvfc
  EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
 
*---------------Display
alvly-box_fieldname = 'FLAG'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    it_fieldcat = alvfc
    i_callback_program = sy-repid "<-------Important
    i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
    is_layout = alvly
  TABLES
    t_outtab = itab
  EXCEPTIONS
    program_error = 1
    OTHERS = 2.
 
*-------------------------------------------------
* CALL BACK FORM
*-------------------------------------------------
 
FORM itab_user_command
  USING whatcomm TYPE sy-ucomm
             whatrow TYPE slis_selfield.
 
  data : msg(100) type c.
 
  LOOP AT itab.
    if itab-flag = 'X'.
      msg = sy-tabix.
      condense msg.
      concatenate itab-bukrs ' ' into msg
      separated by space.
      message msg type 'I'.
    endif.
  ENDLOOP.
 
ENDFORM. "ITAB_user_command


LVC_FIELDCATALOG_MERGE - Create field catalog from dictionary structure or internal table
Code:
DATA:
     gt_lvc_fcat      TYPE lvc_t_fcat,
     gl_lvc_fcat      TYPE lvc_s_fcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name = 'ZEXXXR_ALV_TEMPLATE'
       CHANGING
            ct_fieldcat      = gt_lvc_fcat.

  LOOP AT gt_lvc_fcat INTO gl_lvc_fcat.
    CASE gl_lvc_fcat-fieldname.
      WHEN 'BWKEY'.
        gl_lvc_fcat-no_out = 'X'.
      WHEN 'KONTO'.
        gl_lvc_fcat-hotspot = 'X'.
        gl_lvc_fcat-fix_column = 'X'.
      WHEN 'FLAG'.
        gl_lvc_fcat-tech = 'X'.
    ENDCASE.
    MODIFY gt_lvc_fcat FROM gl_lvc_fcat.
  ENDLOOP.
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 -> Function Modules | Функциональные модули 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.