Posted: Sat Jan 26, 2008 5:28 pm Post subject: ALV Grid List with page break
Code:
REPORT z_demo_alv_sort_2.
*---------------------------------------------------------------------*
* This program lists orders (VBAK) with sort for 'Sales organization' *
* (VKORG), 'sold-to-party' (KUNNR) and 'Document number' (VBELN) *
*---------------------------------------------------------------------*
* Author : Michel PIOUD *
* Email : [email protected] HomePage : http://www.geocities.com/mpioud *
*---------------------------------------------------------------------*
TYPES :
BEGIN OF ty_vbak,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
audat TYPE vbak-audat, " Document date
END OF ty_vbak.
DATA :
vbak TYPE vbak,
gt_vbak TYPE TABLE OF ty_vbak.
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN SKIP.
SELECTION-SCREEN : BEGIN OF LINE, COMMENT 1(35) v_1 FOR FIELD p_page.
PARAMETERS p_page RADIOBUTTON GROUP optn.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE, COMMENT 1(35) v_2 FOR FIELD p_ligne.
PARAMETERS p_ligne RADIOBUTTON GROUP optn.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE, COMMENT 1(35) v_3 FOR FIELD p_nthng.
PARAMETERS p_nthng RADIOBUTTON GROUP optn.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_4 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
*---------------------------------------------------------------------*
* Form f_read_data
*---------------------------------------------------------------------*
FORM f_read_data.
SELECT vkorg kunnr vbeln audat
UP TO p_max ROWS
INTO TABLE gt_vbak
FROM vbak
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
*---------------------------------------------------------------------*
* Form f_display_data
*---------------------------------------------------------------------*
FORM f_display_data.
TYPE-POOLS: slis. " ALV Global types
* Macro definition
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-group = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv,
ls_grid_settings TYPE lvc_s_glay.
*
ls_grid_settings-top_p_only = 'X'.
ENDFORM. " F_DISPLAY_DATA
*---------------------------------------------------------------------*
* FORM top_of_page *
*---------------------------------------------------------------------*
FORM top_of_page. "#EC CALLED
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.