ALV Grid dispaly
I am using ECC 5 version.
In the ALV grid display, if we assign a box as a first field, we get selection boxes for each row and also in the Fields' header, we will have one more button to select All fields and columns in the list.
I do not require 'Select All' button in the list but I need individual selection buttons. Please help me.
Thanks
this should help u
u want to select 2 or more boxes at a time , if i am right
tables Mara.
DATA: begin of lmara OCCURS 0,
abc.
include structure mara.
data end of lmara.
SELECT * FROM mara.
move-corresponding mara to lmara.
append lmara.
endselect.
call screen 100.
*& Module STATUS_0100 OUTPUT
* text
module STATUS_0100 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
data: gc_custom_container TYPE REF TO cl_gui_custom_container,
ggrid_codes TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo,
gt_fieldcat type lvc_t_fcat.
IF gc_custom_container IS INITIAL.
CREATE OBJECT gc_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT ggrid_codes
EXPORTING
i_parent = gc_custom_container.
data st_fieldcat type lvc_s_fcat.
st_fieldcat-fieldname = 'ABC'.
st_fieldcat-inttype = 'C'.
st_fieldcat-outputlen = 3.
st_fieldcat-CHECKBOX = 'X'.
st_fieldcat-EDIT = 'X'.
st_fieldcat-coltext = 'ABC'.
st_fieldcat-seltext = 'ABC'.
append st_fieldcat to gt_fieldcat.
clear st_fieldcat.
st_fieldcat-fieldname = 'MATNR'.
st_fieldcat-inttype = 'C'.
st_fieldcat-outputlen = 10.
st_fieldcat-coltext = 'Material'.
st_fieldcat-seltext = 'MATNR'.
append st_fieldcat to gt_fieldcat.
gs_layout-grid_title = 'WELCOME 2 NEW WORLD'.
gs_layout-no_toolbar = 'X'.
CALL METHOD ggrid_codes->set_table_for_first_display
EXPORTING
* i_structure_name = 'MARA'
is_layout = gs_layout
CHANGING
it_outtab = lmara[]
it_fieldcatalog = gt_fieldcat.
ENDIF.
Similar Messages
-
Regarding PF Status In ALV Grid Dispaly
Hi..
Can you please tell me how to set PF status in ALV Grid Display.
Regards
Sandeep.hi,
if u use REUSE_ALV_LIST_DISPLAY copy the standard GUI-Status named STANDARD from function group SALV in your program
if u use REUSE_ALV_GRID_DISPLAY_LVC or REUSE_ALV_GRID_DISPLAY copy the standard GUI-Status named STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN in your program
after that you cas set the pf-status in this way:
>CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
> EXPORTING
> i_callback_program = sy-cprog
> i_callback_pf_status_set = 'STATUS'
> i_callback_user_command = 'USERCOMMAND'
> is_layout = st_layout
> it_fieldcat = st_fieldcat
> TABLES
> t_outtab = outtab
or
>CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
> EXPORTING
> i_callback_program = sy-cprog
> i_callback_pf_status_set = 'STATUS'
> i_callback_user_command = 'USERCOMMAND'
> is_layout_lvc = wa_slis_layout
> it_fieldcat_lvc = tb_slis_fieldcat
> TABLES
> t_outtab = tb_app
where USERCOMMAND and STATUS are 2 forms in your program.
>FORM status USING pfstat TYPE slis_t_extab.
> SET PF-STATUS 'STANDARD' EXCLUDING pfstat.
>ENDFORM.
>
> ...
>
>FORM usercommand USING okcode LIKE sy-ucomm
> wa_selfield TYPE slis_selfield.
> CASE okcode.
> ....
> ENDCASE
>ENDFORM.
Bye.
Marco -
Alv grid dispaly in custom container....?
Hay friends i have shown ALV grid display in custom container .....in that some fields are input fields...
how can i modify my internal table (which is shown in ALV )...by knowing that this field is changed...i need to update in my internal table...
need help...
reply soon...Hello
All you need to know can be found in thread About events of class cl_gui_alv_grid and the links mentioned therein.
Regards
Uwe -
Hi,
I have a requirement to select a row in ALV output and perform some action after a button is pressed.
(i.e) i have a release button and after i select a line item in alv output and press on the button ,that item should be released.
so both the events (Selection of line item and pressing of button) should happen together
how can this be achieved.
moreover i should be able to select multiple line items in the alv grid display.how can this be achieved.is it in fieldcatalog level or layout level.
Any pointers to this would be of great help.
Regards,
S.Subasree.Hi,
Check the sample code which captures multipe selcted rows
on clicking a button.
FORM sub_user_command USING ucomm TYPE sy-ucomm
sel TYPE slis_selfield.
DATA: ref_grid TYPE REF TO cl_gui_alv_grid.
DATA: count TYPE i ,
i_rows TYPE lvc_t_row .
DATA: lf_row_index TYPE lvc_index ,
i_selected_line_s TYPE lvc_s_row ,
l_vbeln TYPE vbeln .
*then insert the following code in your USER_COMMAND routine...
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
CASE ucomm.
WHEN 'PDF'.
CALL METHOD ref_grid->get_selected_rows
IMPORTING
et_index_rows = i_rows.
LOOP AT i_rows
INTO i_selected_line_s.
lf_row_index = i_selected_line_s-index.
CLEAR i_selected_line_s.
READ TABLE it_itab
INTO wa_itab
INDEX lf_row_index.
IF sy-subrc EQ 0.
refresh:bdcmsgcoll,
bdcdata.
clear:l_vbeln.
MOVE wa_itab-vbeln TO l_vbeln.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'Z_PF_TEST'
i_callback_user_command = 'SUB_USER_COMMAND'
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = it_itab.
Regards,
Raj. -
Differences between the alv's and alv grid dispaly
hi guys
.........please send the differences between the alv's and alv grid display.
thanks....Hi Midathala,
Plz go through the links might be useful to you.
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
Check the program in the following link:
http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
13. Top-of-page in ALV
selection-screen and top-of-page in ALV
14. ALV Group Heading
http://www.sap-img.com/fu037.htm
How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
15. ALV output to PDF conversion
It has an example code for PDF Conversion.
http://www.erpgenie.com/abap/code/abap51.htm
converting the output of alv in pdf
Thanks
Mohinder Singh Chauhan -
Regarding Alv Grid Totals_text is not Printing
Hi All,
I am presently working in Alv Grid dispaly.
I need to dispaly Totals_Text = 'Totals'. But this text is not displaying in my output dispaly.i am copying my code here.
Code:
REPORT ZFTRSERV NO STANDARD PAGE HEADING
MESSAGE-ID YV
LINE-SIZE 255.
TABLES: BSIS, "Accounting: Secondary Index for G/L Accounts
BSAS, "Accounting: Secondary Index for G/L Accounts (Cleared Items)
BSID, "Accounting: Secondary Index for Customers
BKPF, "Accounting Document Header
ITCPP. "SAPscript output parameters
TYPE-POOLS: SLIS. "ALV Declarations
$$********************************************************************
$$ GLOBAL TYPES
$$ NAMING CONVENTION: "Y_NAME"
$$********************************************************************
*eject
$$********************************************************************
$$ GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
$$ NAMING CONVENTION: "I_NAME"
$$********************************************************************
$$********************************************************************
$$ GLOBAL INTERNAL TABLES (CUSTOM STRUCTURE)
$$ NAMING CONVENTION: "T_NAME"
$$********************************************************************
*eject
$$********************************************************************
$$ GLOBAL FIELD-SYMBOLS
$$ NAMING CONVENTION: "<FS_NAME>"
$$********************************************************************
FIELD-SYMBOLS: <FS_BSIS> TYPE Y_BSIS.
$$********************************************************************
$$ MACROS DECLARATION
$$ NAMING CONVENTION: M_NAME
$$********************************************************************
$$********************************************************************
$$ PARAMETERS & SELECT-OPTIONS
$$ NAMING CONVENTION: "P_NAME" & "S_NAME"
$$********************************************************************
SELECTION-SCREEN BEGIN OF BLOCK SS01 WITH FRAME TITLE TEXT-B01.
GENERAL SELECTIONS
SELECT-OPTIONS: S_BUKRS FOR BSIS-BUKRS OBLIGATORY,
S_HKONT FOR BSIS-HKONT OBLIGATORY,
S_BLART FOR BSIS-BLART,
S_BELNR FOR BSIS-BELNR.
SELECTION-SCREEN END OF BLOCK SS01.
SELECTION-SCREEN BEGIN OF BLOCK SS02 WITH FRAME TITLE TEXT-B02.
OPEN ITEMS:
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS P_OPIT LIKE ITEMSET-XOPSEL RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
SELECTION-SCREEN COMMENT 3(20) TEXT-003 FOR FIELD P_OPIT.
SELECTION-SCREEN END OF LINE.
PARAMETERS P_STIDA LIKE RFPDO-ALLGSTID DEFAULT SY-DATLO.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN: COMMENT (12) BLANK1,
COMMENT (20) TEXT-006 FOR FIELD P_OSST.
PARAMETERS: P_OSST AS CHECKBOX DEFAULT SPACE.
SELECTION-SCREEN: COMMENT (12) BLANK2,
COMMENT (20) TEXT-007 FOR FIELD P_OUTD.
PARAMETERS:P_OUTD LIKE ITCPP-TDDEST.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK SS03.
*eject
$$********************************************************************
$$ INITIALIZATION
$$********************************************************************
INITIALIZATION.
CLEAR: E_BSID,
E_BSIS,
E_BSAS,
E_BKPF,
E_TOTAL,
E_SUMSHET_OPEN,
E_SUMSHET_CLEAR,
E_SUMSHET_TOTAL,
E_CATLOG,
E_ALV_LAYOUT.
FREE: T_BSID,
T_BSIS,
T_BSAS,
T_BKPF,
T_TOTAL,
T_SUMSHET_OPEN,
T_SUMSHET_CLEAR,
T_SUMSHET_TOTAL.
*eject
$$********************************************************************
$$ AT SELECTION-SCREEN
$$********************************************************************
AT SELECTION-SCREEN .
*eject
$$********************************************************************
$$ START-OF-SELECTION
$$********************************************************************
START-OF-SELECTION.
To Get data from tables
PERFORM F_OUT_DATA_RETRIEVEL.
*eject
$$********************************************************************
$$ END-OF-SELECTION
$$********************************************************************
END-OF-SELECTION.
To Display ALV Grid Layout
PERFORM F_ALV_DATA_RETRIVAL.
*eject
*& Form f_out_data_retrievel
data retrival for Open,Clear and All items
FORM F_OUT_DATA_RETRIEVEL.
IF P_OPIT EQ C_X.
*open items is selected data will be retrieved from BSIS table.
PERFORM F_OPEN_ITEMS.
TO GET DATA FOR SUMMARY SHEET OPEN ITEMS.
PERFORM F_GET_OPEN_SUMSHET.
ENDIF.
ENDFORM. " f_out_data_retrievel
*& Form F_OPEN_ITEMS
getting data for Open items from BSIS Table
FORM F_OPEN_ITEMS .
SELECT BUKRS
HKONT
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
BUDAT
BLDAT
BLART
BSCHL
MWSKZ
DMBTR
SGTXT
FROM BSIS
INTO CORRESPONDING FIELDS OF TABLE T_BSIS
WHERE BUKRS IN S_BUKRS
AND HKONT IN S_HKONT
AND BLART IN S_BLART
AND BELNR IN S_BELNR
AND AUGDT NE P_STIDA .
IF SY-SUBRC NE C_0.
MESSAGE S999 WITH text-030.
ENDIF.
PERFORM F_GET_DATA_BSIS.
ENDFORM. " F_OPEN_ITEMS
To get the Entry date and Reference Key2
PERFORM F_GET_DATA_BSIS.
*& Form F_GET_DATA_BSAS
GETTING DATA FROM BSAS TABLE
FORM F_GET_DATA_BSAS .
DATA: W_TABIX TYPE SY-TABIX.
UNASSIGN <FS_BSAS>.
GETTING DATA FROM BKPF AND BSID TABLES
LOOP AT T_BSAS ASSIGNING <FS_BSAS>.
CLEAR: E_BKPF,
E_BSID,
W_TABIX.
MOVE SY-TABIX TO W_TABIX.
SELECT SINGLE BUKRS
BELNR
GJAHR
CPUDT
BUDAT
FROM BKPF
INTO CORRESPONDING FIELDS OF E_BKPF
WHERE BUKRS EQ E_BSAS-BUKRS
AND BLART EQ E_BSAS-BLART
AND BELNR EQ E_BSAS-BELNR
AND BUDAT EQ E_BSAS-BUDAT.
IF SY-SUBRC EQ C_0.
MOVE E_BKPF-CPUDT TO <FS_BSAS>-CPUDT.
MODIFY T_BSAS INDEX W_TABIX FROM <FS_BSAS>
TRANSPORTING CPUDT.
ENDIF.
SELECT SINGLE BUKRS
KUNNR
UMSKS
UMSKZ
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
XREF2
FROM BSID
INTO CORRESPONDING FIELDS OF E_BSID
WHERE BUKRS EQ E_BSAS-BUKRS
AND BELNR EQ E_BSAS-BELNR
AND BLART EQ E_BSAS-BLART
AND BUDAT EQ E_BSAS-BUDAT.
IF SY-SUBRC EQ C_0.
MOVE E_BSID-XREF2 TO <FS_BSAS>-XREF2.
FREE T_BSID.
MODIFY T_BSAS INDEX W_TABIX FROM <FS_BSAS>
TRANSPORTING XREF2.
ENDIF.
<FS_BSAS>-IDATE = SY-DATUM.
<FS_BSAS>-IEDAT = <FS_BSAS>-CPUDT - <FS_BSAS>-ZUONR.
<FS_BSAS>-PTIME = SY-DATUM - <FS_BSAS>-CPUDT.
MODIFY T_BSAS INDEX W_TABIX FROM <FS_BSAS>
TRANSPORTING IEDAT
PTIME
IDATE.
ENDLOOP.
SORT T_BSAS BY HKONT XREF2 CPUDT.
ENDFORM. " F_GET_DATA_BSAS
*& Form F_GET_DATA_BSIS
GETTING DATA FROM BSIS TABLE
FORM F_GET_DATA_BSIS .
DATA: W_TABIX TYPE SY-TABIX,
W_SGTXT LIKE BSIS-SGTXT,
W_SGTXT1 LIKE BSIS-SGTXT,
W_SORTL LIKE KNA1-SORTL.
CLEAR: E_BKPF,
E_BSID,
W_TABIX,
W_SGTXT,
W_SGTXT1,
W_SORTL.
GETTING DATA FROM BKPF AND BSID TABLES
LOOP AT T_BSIS INTO E_BSIS.
MOVE SY-TABIX TO W_TABIX.
SELECT SINGLE BUKRS
BELNR
GJAHR
CPUDT
BUDAT
FROM BKPF
INTO CORRESPONDING FIELDS OF E_BKPF
WHERE BUKRS EQ E_BSIS-BUKRS
AND BLART EQ E_BSIS-BLART
AND BELNR EQ E_BSIS-BELNR
AND BUDAT EQ E_BSIS-BUDAT.
IF SY-SUBRC EQ C_0.
MOVE E_BKPF-CPUDT TO E_BSIS-CPUDT.
FREE T_BKPF.
MODIFY T_BSIS INDEX W_TABIX FROM E_BSIS
TRANSPORTING CPUDT.
ENDIF.
SELECT SINGLE BUKRS
KUNNR
UMSKS
UMSKZ
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
XREF2
FROM BSID
INTO CORRESPONDING FIELDS OF E_BSID
WHERE BUKRS EQ E_BSIS-BUKRS
AND BLART EQ E_BSIS-BLART
AND BELNR EQ E_BSIS-BELNR
AND BUDAT EQ E_BSIS-BUDAT.
IF sy-subrc EQ C_0.
DUMMY CHECK
ENDIF.
SELECT SINGLE KUNNR
FROM BSID
INTO CORRESPONDING FIELDS OF E_BSID
WHERE BUKRS EQ E_BSIS-BUKRS
AND BLART EQ E_BSIS-BLART
AND BELNR EQ E_BSIS-BELNR
AND BUDAT EQ E_BSIS-BUDAT.
IF sy-subrc EQ C_0.
DUMMY CHECK
ENDIF.
SELECT SINGLE SORTL
FROM KNA1
INTO W_SORTL
WHERE KUNNR EQ E_BSID-KUNNR.
IF SY-SUBRC EQ C_0.
MOVE W_SORTL TO E_BSIS-XREF2.
MODIFY T_BSIS INDEX W_TABIX FROM E_BSIS
TRANSPORTING XREF2.
ENDIF.
W_SGTXT = E_BSIS-SGTXT.
SPLIT W_SGTXT AT C_SLASH INTO W_SGTXT W_SGTXT1.
MOVE: W_SGTXT TO E_BSIS-SGTXT,
SY-DATUM TO E_BSIS-IDATE.
DATA : W_ZOUNR LIKE BSAS-ZUONR,
W_DATE TYPE D,
W_Z(10) TYPE C.
CLEAR: W_ZOUNR,
W_DATE,
W_Z.
MOVE E_BSIS-ZUONR TO W_ZOUNR.
MOVE : W_ZOUNR4(4) TO W_Z0(4),
W_ZOUNR2(2) TO W_Z4(2),
W_ZOUNR0(2) TO W_Z6(2).
MOVE W_Z TO W_DATE.
E_BSIS-IEDAT = E_BSIS-CPUDT - W_DATE.
CONCATENATE W_ZOUNR+0(2) C_DOT
W_ZOUNR+2(2) C_DOT
W_ZOUNR+4(4) INTO E_BSIS-ZUONR.
E_BSIS-PTIME = SY-DATUM - E_BSIS-CPUDT.
MODIFY T_BSIS INDEX W_TABIX FROM E_BSIS
TRANSPORTING IEDAT
PTIME
IDATE
SGTXT
ZUONR. "30TH
ENDLOOP.
SORT T_BSIS BY HKONT XREF2 CPUDT.
ENDFORM. " F_GET_DATA_BSIS
*& Form f_build_fld_catlog1
BUILDING FIELD CATALOG FOR OPEN ITEMS DATA
FORM F_FLD_CATLOG_OPEN_ITEMS.
ORM f_fld_catlog_open_items.
REFRESH i_catlog1.
CLEAR w_col_pos.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_HKONT
C_BSIS
w_col_pos
text-010
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_XREF2
C_BSIS
w_col_pos
text-011
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_BELNR
C_BSIS
w_col_pos
text-012
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_BLART
C_BSIS
w_col_pos
text-013
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_BLDAT
C_BSIS
W_col_pos
text-014
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_BUDAT
C_BSIS
w_col_pos
text-015
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_CPUDT
C_BSIS
w_col_pos
text-016
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_ZUONR
C_BSIS
w_col_pos
text-017
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_BSCHL
C_BSIS
w_col_pos
text-018
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_DMBTR
C_BSIS
w_col_pos
text-019
C_X "dispaly Sum Total
'40'.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_MWSKZ
C_BSIS
w_col_pos
text-020
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_SGTXT
C_BSIS
w_col_pos
text-021
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_IEDAT
C_BSIS
w_col_pos
text-022
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_PTIME
C_BSIS
w_col_pos
text-023
SPACE
SPACE.
CLEAR: W_COL_POS,
I_ALV_EVENTS.
ENDFORM. " f_fld_catlog_open_items
*& Form f_first_report_dispaly
ROUTINE FOR OPEN ITEMS GRID LAYOUT DISPLAY
FORM F_DISPALY_OPEN_ITEMS.
CLEAR W_REPNAME.
W_REPNAME = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = W_REPNAME
I_CALLBACK_PF_STATUS_SET = C_FSTAT
I_CALLBACK_USER_COMMAND = C_FUCOM
I_CALLBACK_TOP_OF_PAGE = C_FTOPI
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = ' '
I_GRID_SETTINGS =
IS_LAYOUT = E_ALV_LAYOUT
IT_FIELDCAT = I_CATLOG1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = C_A
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = I_ALV_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = T_BSIS
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2 .
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " f_dispaly_open_items
*& Form f_first_field_catalog
BUILDING FIELD CATALOG FOR SECONDERY LIST
-->us_fieldname field name
-->us_ref field ref field
-->us_ref tab ref table
-->us_text text
-->us_sum sum
FORM F_FIRST_FIELD_CATALOG USING US_FIELDNAME TYPE ANY
US_REF_TAB TYPE ANY
US_COL_POS TYPE ANY
US_COLTEXT TYPE ANY
US_DO_SUM TYPE ANY
us_out type any.
CLEAR E_CATLOG.
MOVE : US_FIELDNAME TO E_CATLOG-FIELDNAME,
US_REF_TAB TO E_CATLOG-TABNAME,
US_COL_POS TO E_CATLOG-COL_POS,
US_COLTEXT TO E_CATLOG-SELTEXT_L,
US_DO_SUM TO E_CATLOG-DO_SUM,
US_out to E_CATLOG-outputlen.
APPEND E_CATLOG TO I_CATLOG1.
CLEAR E_CATLOG.
APPEND E_CATLOG TO I_CATLOG1.
CLEAR E_CATLOG.
ENDFORM. " f_first_field_catalog
*& Form F_ALV_DATA_RETRIVAL
ALV DATA VALIDATION
FORM F_ALV_DATA_RETRIVAL .
IF P_OPIT EQ C_X
AND P_OSST EQ C_SPACE .
building field catlog for open items list
PERFORM f_fld_catlog_open_items.
first list display open items list
PERFORM f_dispaly_open_items.
Building Alv Layout
PERFORM f_alv_layout_open_items.
ENDIF.
Code to display only summary sheet P_OSST check box
IF P_OPIT EQ C_X
AND P_OSST EQ C_X.
building field catlog for open items Summary sheet
PERFORM F_FLD_CATLOG_SUMSHET_OPEN.
first list display open items Summary sheet
PERFORM F_DISPALY_SUMSHEET_OPEN.
ENDIF.
ENDFORM. " F_ALV_DATA_RETRIVAL
*& Form F_GET_OPEN_SUMSHET
GET SUMMARY SHEET OPEN ITEM DATA
FORM F_GET_OPEN_SUMSHET .
SORT T_BSIS BY SGTXT.
UNASSIGN <FS_BSIS>.
LOOP AT T_BSIS ASSIGNING <FS_BSIS>.
MOVE SY-TABIX TO W_TABIX.
IF W_TABIX EQ C_1.
MOVE : <FS_BSIS>-SGTXT TO W_SGTXT,
<FS_BSIS>-PTIME TO W_PTIME,
<FS_BSIS>-DMBTR TO W_DMBTR,
<FS_BSIS>-IEDAT TO W_IEDAT.
W_COUNT = W_COUNT + C_1.
CONTINUE.
ELSE.
IF <FS_BSIS>-SGTXT EQ W_SGTXT.
W_PTIME = W_PTIME + <FS_BSIS>-PTIME.
W_DMBTR = W_DMBTR + <FS_BSIS>-DMBTR.
W_COUNT = W_COUNT + C_1.
W_IEDAT = W_IEDAT + <FS_BSIS>-IEDAT.
CONTINUE .
ELSE.
W_ATIME = W_PTIME / W_COUNT.
W_IEDAT = W_IEDAT / W_COUNT.
MOVE : W_SGTXT TO E_SUMSHET_OPEN-SGTXT,
W_COUNT TO E_SUMSHET_OPEN-COUNT,
W_ATIME TO E_SUMSHET_OPEN-ATIME,
W_DMBTR TO E_SUMSHET_OPEN-DMBTR,
W_IEDAT TO E_SUMSHET_OPEN-IEDAT.
APPEND E_SUMSHET_OPEN TO T_SUMSHET_OPEN.
CLEAR: W_SGTXT,
W_PTIME,
W_DMBTR,
W_COUNT,
W_IEDAT.
MOVE : <FS_BSIS>-SGTXT TO W_SGTXT,
<FS_BSIS>-PTIME TO W_PTIME,
<FS_BSIS>-DMBTR TO W_DMBTR,
<FS_BSIS>-IEDAT TO W_IEDAT.
W_COUNT = W_COUNT + C_1.
CONTINUE.
ENDIF.
ENDIF.
ENDLOOP.
W_ATIME = W_PTIME / W_COUNT.
W_IEDAT = W_IEDAT / W_COUNT.
MOVE : W_SGTXT TO E_SUMSHET_OPEN-SGTXT,
W_COUNT TO E_SUMSHET_OPEN-COUNT,
W_ATIME TO E_SUMSHET_OPEN-ATIME,
W_DMBTR TO E_SUMSHET_OPEN-DMBTR,
W_IEDAT TO E_SUMSHET_OPEN-IEDAT.
APPEND E_SUMSHET_OPEN TO T_SUMSHET_OPEN.
CLEAR E_SUMSHET_OPEN.
ENDFORM. " F_GET_OPEN_SUMSHET
*& Form F_TOP_OF_PAGE
ITEMS TOP OF PAGE DATA
FORM F_TOP_OF_PAGE .
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
W_HEADER TYPE SLIS_LISTHEADER,
T_LINE LIKE W_HEADER-INFO.
CLEAR W_HEADER.
*TITLE
MOVE C_H TO W_HEADER-TYP.
MOVE C_TEXT TO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CLEAR W_HEADER.
MOVE C_S TO W_HEADER-TYP.
MOVE C_TEXT2 TO W_HEADER-KEY.
CONCATENATE SY-DATUM+6(2) C_SLASH
SY-DATUM+4(2) C_SLASH
SY-DATUM(4) INTO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CLEAR: W_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. " F_TOP_OF_PAGE
FORM F_DISPALY_SUMSHEET_OPEN .
CLEAR w_repname.
w_repname = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = w_repname
I_CALLBACK_PF_STATUS_SET = C_FSTAT
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = C_FTOPS
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = ' '
I_GRID_SETTINGS =
IS_LAYOUT = e_alv_layout
IT_FIELDCAT = i_catlog1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = C_A
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = i_alv_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = T_SUMSHET_OPEN
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FREE T_SUMSHET_OPEN.
ENDFORM. " F_DISPALY_SUMSHEET_OPEN
*& Form F_TOP_OF_PAGE_SUMSHET
TOP OF PAGE FOR SUMMARY SHEET
FORM F_TOP_OF_PAGE_SUMSHET .
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
W_HEADER TYPE SLIS_LISTHEADER,
T_LINE LIKE W_HEADER-INFO.
CLEAR: W_HEADER,
T_HEADER,
T_LINE.
*TITLE
MOVE C_H TO W_HEADER-TYP.
MOVE C_TEXT1 TO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CLEAR W_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. " F_TOP_OF_PAGE_SUMSHET
*& Form F_PF_STATUS
GET PF STATUS
FORM F_PF_STATUS USING US_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS C_STAT EXCLUDING US_EXTAB.
ENDFORM. "F_PF_STATUS
*& Form F_USER_COMMAND
GET USER COMMAND
*FORM F_USER_COMMAND USING W_UCOMM LIKE SY-UCOMM
US_SELFIELD TYPE SLIS_SELFIELD.
FORM F_USER_COMMAND USING US_UCOMM LIKE SY-UCOMM
US_SELFIELD TYPE SLIS_SELFIELD.
CONSTANTS:C_NEXT(6) TYPE C VALUE '&NEXT'.
if sy-subrc eq c_0.
MOVE C_TEXT3 TO US_SELFIELD-TABNAME.
endif.
IF P_OPIT EQ C_X
AND US_UCOMM EQ C_NEXT .
PERFORM F_FLD_CATLOG_SUMSHET_OPEN.
PERFORM F_DISPALY_SUMSHEET_OPEN.
ELSEIF P_CLIT EQ C_X
AND US_UCOMM EQ C_NEXT.
PERFORM F_FLD_CATLOG_SUMSHET_CLEAR.
PERFORM F_DISPALY_SUMSHET_CLEAR.
ELSEIF P_ALIT EQ C_X
AND US_UCOMM EQ C_NEXT.
PERFORM F_FLD_CATLOG_SUMSHET_TOTAL.
PERFORM F_DISPALY_SUMSHET_TOTAL.
ENDIF.
ENDFORM. "F_USER_COMMAND
*& Form f_alv_layout_open_items
text
----Hi,
Please refer to the sample code :
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
Thanks,
Sriram Ponna. -
Maximum number of character we can print in a column uing ALV grid display
Hi frnds,
My requirment is to print 500 charcter data in a column using ALV grid display.
Could any body tell me is it possible and the maximum character it can i print in a column using ALV grid dispaly.
Regards,
SandipanHi Sandipan,
refer notes 857823, 910300 and 959775. All these say there is a limitation of 128 characters.
857823 - ALV grid: Strings with a maximum of 128 characters
Symptom
Entries in cells of the type CHAR or string are truncated after 128
characters in the SAP GUI.
also refer,
ALV Grid Control (cl_gui_alv_grid), function module (Full-screen) Grid
(Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
Cause and Prerequisites
The data table that is sent to the front end only allows character values
with the length 128.
Solution
This is the standard system behavior and cannot be changed. -
ALV GRID Display function module giving Run time error
Hello Experts,
I have ALV report, In which I am using ALV grid dispaly FM to display the report.
But when my out table which I am passing to FM is empty that time ALV grid display shows blank ALV report. but when out table is not empty that time I am getting the Run time error, which shows message "Field symbol has not yet been assigned".
Can any one please help me out in this.
ThanksTYPES: BEGIN OF type_out,
col00 TYPE ytlet-rzzyyproduct,
col01 TYPE ytlet-kslvt,
col02 TYPE ytlet-kslvt,
col03 TYPE ytlet-kslvt,
col04 TYPE ytlet-kslvt,
col05 TYPE ytlet-kslvt,
col06 TYPE ytlet-kslvt,
col07 TYPE ytlet-kslvt,
col08 TYPE ytlet-kslvt,
col09 TYPE ytlet-kslvt,
col10 TYPE ytlet-kslvt,
col11 TYPE ytlet-kslvt,
col12 TYPE ytlet-kslvt,
col13 TYPE ytlet-kslvt,
col14 TYPE ytlet-kslvt,
col15 TYPE ytlet-kslvt,
col16 TYPE ytlet-kslvt,
col17 TYPE ytlet-kslvt,
col18 TYPE ytlet-kslvt,
col19 TYPE ytlet-kslvt,
col20 TYPE ytlet-kslvt,
col21 TYPE ytlet-kslvt,
col22 TYPE ytlet-kslvt,
col23 TYPE ytlet-kslvt,
col24 TYPE ytlet-kslvt,
col25 TYPE ytlet-kslvt,
col26 TYPE ytlet-kslvt,
col27 TYPE ytlet-kslvt,
col28 TYPE ytlet-kslvt,
col29 TYPE ytlet-kslvt,
col30 TYPE ytlet-kslvt,
col31 TYPE ytlet-kslvt,
col32 TYPE ytlet-kslvt,
col33 TYPE ytlet-kslvt,
col34 TYPE ytlet-kslvt,
col35 TYPE ytlet-kslvt,
col36 TYPE ytlet-kslvt,
col37 TYPE ytlet-kslvt,
col38 TYPE ytlet-kslvt,
col39 TYPE ytlet-kslvt,
col40 TYPE ytlet-kslvt,
col41 TYPE ytlet-kslvt,
col42 TYPE ytlet-kslvt,
col43 TYPE ytlet-kslvt,
col44 TYPE ytlet-kslvt,
END OF type_out.
DATA: t_fieldcat TYPE slis_t_fieldcat_alv, "Field catelog table
w_fieldcat TYPE slis_fieldcat_alv, "Field catelog Work area
w_layout TYPE slis_layout_alv, "Layout structure
w_event TYPE slis_alv_event, "Event structure
t_event TYPE slis_t_event, "Event structure
t_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
t_callback_main_user_command TYPE slis_formname,
v_selfield TYPE slis_selfield.
FIELD-SYMBOLS: <ksl>.
FORM DISPLAY_REPORT .
*Prepare Field Catlog
PERFORM creat_field_catlog.
*Set layout
PERFORM set_layout.
*Get Event
PERFORM get_event.
*Display Report
PERFORM display_alv_report.
ENDFORM. " DISPLAY_REPORT
FORM creat_field_catlog .
PERFORM add_fields_catlog USING:
'01' 'RZZYYPRODUCT' 'IT_OUT' 'MPMs' ' ',
'02' 'KSLVT' 'IT_OUT' 'License Fee' ' ',
'03' 'KSLVT' 'IT_OUT' 'Ad Sales' ' ',
'04' 'KSLVT' 'IT_OUT' 'Promo Fees' ' ',
'05' 'KSLVT' 'IT_OUT' 'Total Ad Sales/Promo' ' ',
'06' 'KSLVT' 'IT_OUT' 'Other' ' ',
'07' 'KSLVT' 'IT_OUT' 'Total' ' ',
'08' 'KSLVT' 'IT_OUT' 'Dom Station' ' ',
'09' 'KSLVT' 'IT_OUT' 'Basic Cable/Free VOD' ' ',
'10' 'KSLVT' 'IT_OUT' 'License Fee' ' ',
'11' 'KSLVT' 'IT_OUT' 'Ad Sales (incl Internet)' ' ',
'12' 'KSLVT' 'IT_OUT' 'Promo Fees' ' ',
'13' 'KSLVT' 'IT_OUT' 'Ad Sales & Promo Fees' ' ',
'14' 'KSLVT' 'IT_OUT' 'Foreign' ' ',
'15' 'KSLVT' 'IT_OUT' 'Pay TV' ' ',
'16' 'KSLVT' 'IT_OUT' 'Other' ' ',
'17' 'KSLVT' 'IT_OUT' 'Total' ' ',
'18' 'KSLVT' 'IT_OUT' 'Home Entertainment' ' ',
'19' 'KSLVT' 'IT_OUT' 'SPTI' ' ',
'20' 'KSLVT' 'IT_OUT' 'All Other Divisions' ' ',
'21' 'KSLVT' 'IT_OUT' 'Total' ' ',
'22' 'KSLVT' 'IT_OUT' 'Total Revenue' ' ',
'23' 'KSLVT' 'IT_OUT' 'PV Net Down & Producers Share' '',
'24' 'KSLVT' 'IT_OUT' 'Total Net Revenue' ' ',
'25' 'KSLVT' 'IT_OUT' 'Development Expense' ' ',
'26' 'KSLVT' 'IT_OUT' 'SOP Deficits' ' ',
'27' 'KSLVT' 'IT_OUT' 'Amortization' ' ',
'28' 'KSLVT' 'IT_OUT' 'Other COS ' ' ',
'29' 'KSLVT' 'IT_OUT' 'Total COS' ' ',
'30' 'KSLVT' 'IT_OUT' 'Profit Before Releasing' ' ',
'31' 'KSLVT' 'IT_OUT' 'Gross Profit %' ' ',
'32' 'KSLVT' 'IT_OUT' 'SPT' ' ',
'33' 'KSLVT' 'IT_OUT' 'Home Entertainment' ' ',
'34' 'KSLVT' 'IT_OUT' 'SPTI' ' ',
'35' 'KSLVT' 'IT_OUT' 'All Other Divisions' ' ',
'36' 'KSLVT' 'IT_OUT' 'Other' ' ',
'37' 'KSLVT' 'IT_OUT' 'Total' ' ',
'38' 'KSLVT' 'IT_OUT' 'Gross Profit' ' ',
'39' 'KSLVT' 'IT_OUT' 'SPT' ' ',
'40' 'KSLVT' 'IT_OUT' 'Home Entertainment' ' ',
'41' 'KSLVT' 'IT_OUT' 'SPTI' ' ',
'42' 'KSLVT' 'IT_OUT' 'All Other Divisions' ' ',
'43' 'KSLVT' 'IT_OUT' 'Other' ' ',
'44' 'KSLVT' 'IT_OUT' 'Total' ' ',
'45' 'KSLVT' 'IT_OUT' 'Net Margin' ' '.
ENDFORM. " CREAT_FIELD_CATLOG
*& Form ADD_FIELDS_CATLOG
Filling of field Catlog
FORM add_fields_catlog USING p_colpos
p_fildname
p_tabname
p_fildtext
p_ndisplay.
w_fieldcat-row_pos = '1'.
w_fieldcat-col_pos = p_colpos.
w_fieldcat-fieldname = p_fildname.
w_fieldcat-tabname = p_tabname.
w_fieldcat-reptext_ddic = p_fildtext.
w_fieldcat-no_out = p_ndisplay.
APPEND w_fieldcat TO t_fieldcat.
CLEAR: w_fieldcat.
ENDFORM. " ADD_FIELDS_CATLOG
*& Form SET_LAYOUT
Set Layout
FORM set_layout .
w_layout-colwidth_optimize = 'X'.
ENDFORM. " SET_LAYOUT
*& Form GET_EVENT
text
FORM get_event .
w_event-name = 'TOP-OF-PAGE'.
w_event-form = 'F_TOP-OF_PAGE'.
APPEND w_event TO t_event.
ENDFORM. " GET_EVENT
*& Form TOP-OF-PAGE
Top of Page
FORM top-of-page.
DATA : t_list_commentry TYPE slis_t_listheader,
w_header TYPE slis_listheader,
lv_text(90) TYPE c,
l_text(90) TYPE c,
lv_rundate(10) TYPE c,
lv_runtime(10) TYPE c.
CONSTANTS: c_space(2) TYPE c VALUE ' ',
c_space2(6) TYPE c VALUE ' '.
w_header-typ = 'S'.
w_header-key = 'Program:'.
w_header-info = sy-repid.
APPEND w_header TO t_list_commentry.
WRITE: sy-datum TO lv_rundate MM/DD/YYYY.
WRITE: sy-uzeit TO lv_runtime USING EDIT MASK '__:__:__'.
CLEAR w_header.
w_header-typ = 'S'.
w_header-key = text-021.
w_header-info = lv_rundate.
APPEND w_header TO t_list_commentry.
CLEAR: w_header.
w_header-typ = 'S'.
w_header-key = 'User Id'.
w_header-info = sy-uname.
APPEND w_header TO t_list_commentry.
CLEAR: w_header.
w_header-typ = 'S'.
w_header-key = 'Run Date'.
w_header-info = lv_rundate.
APPEND w_header TO t_list_commentry.
CLEAR: w_header.
w_header-typ = 'S'.
w_header-key = 'Run Time'.
w_header-info = lv_runtime.
APPEND w_header TO t_list_commentry.
CLEAR: w_header.
w_header-typ = 'H'.
w_header-key = 'order'.
w_header-info = 'MCR Report'.
APPEND w_header TO t_list_commentry.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_list_commentry.
ENDFORM. "TOP-OF-PAGE
FORM display_alv_report .
CONSTANTS : gc_save TYPE c VALUE 'A'. "Save Layout
t_callback_main_user_command = c_user_command.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = t_callback_main_user_command
i_callback_top_of_page = 'TOP-OF-PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = w_layout
it_fieldcat = t_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = gc_save
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_out
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDIF. -
Max no of records that can be dispalyed using ALV GRID CONTROLS
Hi ,
Can any one please tell me the maximum no of records that are allowed to be displayed using the ALV grid controls.
As I am getting dump for more records and I need to control the report based on the max no of records that can be actually diplayed using contols.
Thanks,
Kavya.Dear Kavya.
If you are getting Dump because you have too many records it means that there is something wrong with the program design.
ALV is not meant to display more than few thousands of records.
There is no point is displaying more than few thousands because it will over-flow the users and it will do no good for them.
If the problem is with the Internal-tables that you're using to manipulate the data, you can think of using an intermidiate DB table that will hold summarized data of the DB data and can be filled via a periodic job. This have the benfit of speeding up the ALV program too.
thanx
ayal. -
Regarding column editing in alv grid
hi experts,
i m using alv grid display for my report layout what i want that after the output dispaly when the user will select my customized button "change the amount column" then after pressing this my amount column will become editable and user can put there new aount for this i have used this codes but it is not working plz help me to sort out this,
for u here is my code.
FORM DISPLAY_LIST .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
is_layout = i_layout
it_fieldcat = i_fieldtab
i_grid_title = 'Production Incentive Details'
I_CALLBACK_PF_STATUS_SET = 'SET_PFSTATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
it_events = global_events
TABLES
t_outtab = itab_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DISPLAY_LIST
*& Form SET_PFSTATUS
text
-->RT_EXTAB text
FORM SET_PFSTATUS USING rt_extab TYPE slis_t_extab..
SET PF-STATUS 'ZPINCENTIVE' .
EXCLUDING rt_extab..
ENDFORM. " CREATE_PFSTATUS
*& Form user_command
text
-->R_UCOMM text
-->RS_SELFIELD text
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
*BREAK-POINT.
when '&CHANGED'. "for change the amount button.
read table i_fieldtab into s_fieldtab with key FIELDNAME = 'AMOUNT'.
if sy-subrc = 0.
move:sy-tabix to index,
'X' to s_fieldtab-edit.
modify:i_fieldtab index index from s_fieldtab.
clear:s_fieldtab.
endif.solved by own
-
Hi ,
I want to display a ALV Grid layout output and on that I want to insert a button on the application bar .When I click on it I should call a screen and dispaly that out on that screen .
Prg :
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZL_NAV'
I_CALLBACK_PF_STATUS_SET = 'ZL_PF_STATUS'
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
i_structure_name = 'ZLT_MARKET_VALUE'
is_layout = gs_layout
i_save = g_save
IT_FIELDCAT =
IT_EVENTS =
TABLES
t_outtab = i_market_value
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF.
Iam settingthe pf status as 'ZL_PF_STATUS' and writing the sub routine for the same.
form 'ZL_PF_STATUS'
set pf-status = 'NAVDISP' .
endform .
But iam getting a dump that there are one actual parameter and zero formal parameters .
Help in this regard
Bye
Santosh ..Hello!
Take this code:
Regards
Ilhan
TYPE-POOLS: col, icon.
DATA:
BEGIN OF wa_sflight.
INCLUDE TYPE sflight.
DATA: color(4),
light, "graphical indicator for booking status
it_field_colors TYPE lvc_t_scol, "for cell highlighting
changes_possible TYPE icon-id,
END OF wa_sflight,
it_sflight LIKE TABLE OF wa_sflight.
DATA:
ok_code LIKE sy-ucomm.
DATA:
alv TYPE REF TO cl_gui_alv_grid,
cont TYPE REF TO cl_gui_custom_container.
DATA: my_variant TYPE disvariant,
my_print TYPE lvc_s_prnt.
DATA:
wa_layout TYPE lvc_s_layo,
wa_field_color LIKE LINE OF wa_sflight-it_field_colors.
DATA:
it_field_cat TYPE lvc_t_fcat,
wa_field_cat LIKE LINE OF it_field_cat.
DATA:
bookings_total TYPE i,
bookings_total_c(10),
message_text(60).
DATA: row TYPE i.
DATA: it_row_no TYPE lvc_t_roid,
wa_row_no LIKE LINE OF it_row_no,
it_lines type i.
DATA: BEGIN OF wa_sel_flights,
mandt TYPE sy-mandt,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
END OF wa_sel_flights,
it_sel_flights LIKE TABLE OF wa_sel_flights.
SELECT-OPTIONS: so_car FOR wa_sflight-carrid,
so_con FOR wa_sflight-connid.
SELECTION-SCREEN SKIP.
PARAMETERS: pa_lv TYPE disvariant-variant.
********************** CLASS **************************
CLASS: lcl_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_doubleclick
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING es_row_no,
print_top
FOR EVENT print_top_of_page OF cl_gui_alv_grid,
print_tol
FOR EVENT print_top_of_list OF cl_gui_alv_grid,
on_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object,
on_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
on_context_menu_request
FOR EVENT context_menu_request OF cl_gui_alv_grid
IMPORTING e_object.
ENDCLASS. "lcl_handler DEFINITION
CLASS: lcl_handler IMPLEMENTATION.
METHOD on_doubleclick.
READ TABLE it_sflight INTO wa_sflight INDEX es_row_no-row_id.
IF sy-subrc NE 0.
MESSAGE i075(bc408).
EXIT.
ENDIF.
bookings_total = wa_sflight-seatsocc + wa_sflight-seatsocc_b +
wa_sflight-seatsocc_f.
bookings_total_c = bookings_total.
CONCATENATE 'Total number of bookings:'(m01)
bookings_total_c
INTO message_text.
MESSAGE message_text TYPE 'I'.
ENDMETHOD. "on_doubleclick
METHOD print_top.
DATA: pos TYPE i.
FORMAT COLOR COL_HEADING.
WRITE: / sy-datum.
pos = sy-linsz / 2 - 3. " length of pagno: 6 chars
WRITE AT pos sy-pagno.
pos = sy-linsz - 11. " length of username: 12 chars
WRITE: AT pos sy-uname.
ULINE.
ENDMETHOD. "print_top
METHOD print_tol.
DATA: wa_so_car LIKE LINE OF so_car,
wa_so_con LIKE LINE OF so_con.
CONSTANTS: end TYPE i VALUE 20.
FORMAT COLOR COL_HEADING.
WRITE: / 'Select options'(000), AT end space. "#EC *
SKIP.
WRITE: / 'Airlines'(001), AT end space. "#EC *
ULINE AT /(end).
FORMAT COLOR COL_NORMAL.
LOOP AT so_car INTO wa_so_car.
WRITE: / wa_so_car-sign,
wa_so_car-option,
wa_so_car-low,
wa_so_car-high.
ENDLOOP.
SKIP.
FORMAT COLOR COL_HEADING.
WRITE: / 'Connections'(002), AT end space . "#EC *
ULINE AT /(end).
FORMAT COLOR COL_NORMAL.
LOOP AT so_con INTO wa_so_con.
WRITE: / wa_so_con-sign,
wa_so_con-option,
wa_so_con-low NO-ZERO,
wa_so_con-high NO-ZERO.
ENDLOOP.
SKIP.
ENDMETHOD. "print_tol
METHOD on_toolbar.
DATA l_wa_button TYPE stb_button.
l_wa_button-butn_type = 3.
INSERT l_wa_button INTO TABLE e_object->mt_toolbar.
CLEAR l_wa_button.
l_wa_button-function = 'AENDERN'.
l_wa_button-icon = ICON_MC_CONTENTINDICATOR.
l_wa_button-quickinfo = 'FLÜGE ANZEIGEN'. "#EC *
l_wa_button-butn_type = 0.
l_wa_button-text = 'ÄNDERN FLÜGE'.
INSERT l_wa_button INTO TABLE e_object->mt_toolbar.
* Create button "Display bookings"
CLEAR l_wa_button.
l_wa_button-function = 'ANZEGEN'.
l_wa_button-icon = ICON_FLIGHT.
l_wa_button-quickinfo =
'FLÜGE ANZEIGEN'. "#EC *
l_wa_button-butn_type = 0.
l_wa_button-text = 'ANZEIGEN FLÜGE'.
INSERT l_wa_button INTO TABLE e_object->mt_toolbar.
ENDMETHOD. "on_toolbar
* Ereignisbehandlung *
METHOD on_user_command.
CASE e_ucomm.
WHEN 'AENDERN'.
message 'Was möchten Sie ändern ?' type 'I'.
WHEN 'ANZEGEN '.
message 'Was möchten Sie denn anzeigen ?' type 'I'.
ENDCASE.
ENDMETHOD. "on_user_command
METHOD on_context_menu_request.
DATA:
column_info TYPE lvc_s_col.
CALL METHOD alv->get_current_cell
IMPORTING
e_row = row
es_col_id = column_info.
CASE column_info-fieldname.
WHEN 'CARRID'.
CALL METHOD e_object->add_function
EXPORTING
fcode = 'CARRIER_INFO'
text = 'Carrier info'(me1). "#EC *
WHEN OTHERS.
ENDCASE.
ENDMETHOD.
ENDCLASS. "lcl_handler IMPLEMENTATION
********************** ENDCLASS ***********************
*ABAP events
START-OF-SELECTION.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_sflight
WHERE carrid IN so_car
AND connid IN so_con.
LOOP AT it_sflight INTO wa_sflight.
CLEAR: wa_sflight-it_field_colors.
* set indicator for flights of current month
* Fluege des laufenden Monats hervorheben
IF wa_sflight-fldate(6) = sy-datum(6).
CONCATENATE 'C' col_negative '01' INTO wa_sflight-color.
ENDIF.
* set icon for bookings status
* Ikone für Buchungsstatus belegen
IF wa_sflight-seatsocc = 0.
wa_sflight-light = 1.
ELSEIF wa_sflight-seatsocc < 50.
wa_sflight-light = 2.
ELSE.
wa_sflight-light = 3.
ENDIF.
* highlight specific aircraft
* besonderen Flugzeugtyp hervorheben
IF wa_sflight-planetype = '747-400'.
wa_field_color-fname = 'PLANETYPE'.
wa_field_color-color-col = col_positive.
wa_field_color-color-int = 1.
wa_field_color-color-inv = 0.
APPEND wa_field_color TO wa_sflight-it_field_colors.
ENDIF.
* set indicator for flights in the past
* Ikone setzen für Flüge in der Vergangenheit
IF wa_sflight-fldate < sy-datum.
wa_sflight-changes_possible = icon_space.
ELSE.
wa_sflight-changes_possible = icon_okay.
ENDIF.
MODIFY it_sflight
FROM wa_sflight
TRANSPORTING color light it_field_colors changes_possible.
ENDLOOP.
CALL SCREEN 100.
*PBO modules
MODULE status_0100 OUTPUT.
SET PF-STATUS 'DYN'.
SET TITLEBAR 'T1'.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE clear_ok_code OUTPUT.
CLEAR ok_code.
ENDMODULE. " clear_ok_code OUTPUT
MODULE create_and_transfer OUTPUT.
CHECK cont IS INITIAL.
CREATE OBJECT cont
EXPORTING
container_name = 'MY_CONTROL_AREA'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 AND sy-batch IS INITIAL.
MESSAGE a010(bc408).
ENDIF.
CREATE OBJECT alv
EXPORTING
i_parent = cont
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 AND sy-batch IS INITIAL.
MESSAGE a010(bc408).
ENDIF.
* register event handlers
SET HANDLER:
lcl_handler=>on_toolbar FOR alv,
lcl_handler=>on_user_command FOR alv,
lcl_handler=>on_doubleclick FOR alv,
lcl_handler=>print_top FOR alv,
lcl_handler=>print_tol FOR alv,
lcl_handler=>on_context_menu_request FOR alv.
my_variant-report = sy-cprog.
IF NOT pa_lv IS INITIAL.
my_variant-variant = pa_lv.
ENDIF.
my_print-prntlstinf = 'X'.
my_print-grpchgedit = 'X'.
*define layout
wa_layout-grid_title = 'Flights'(h01). "#EC *
wa_layout-no_hgridln = 'X'.
wa_layout-no_vgridln = 'X'.
*field that contains information on row color
wa_layout-info_fname = 'COLOR'.
*internal table that contains information on cell color
wa_layout-ctab_fname = 'IT_FIELD_COLORS'.
*field that contains information on exception (indicator)
wa_layout-excp_fname = 'LIGHT'.
*multiple row and column selection
wa_layout-sel_mode = 'A'.
*fill field catalog
wa_field_cat-fieldname = 'SEATSOCC'.
wa_field_cat-do_sum = 'X'.
APPEND wa_field_cat TO it_field_cat.
CLEAR wa_field_cat.
wa_field_cat-fieldname = 'PAYMENTSUM'.
wa_field_cat-no_out = 'X'.
APPEND wa_field_cat TO it_field_cat.
CLEAR wa_field_cat.
wa_field_cat-fieldname = 'LIGHT'.
wa_field_cat-coltext = 'Utilization'(h02). "#EC *
APPEND wa_field_cat TO it_field_cat.
CLEAR wa_field_cat.
wa_field_cat-fieldname = 'CHANGES_POSSIBLE'.
wa_field_cat-col_pos = 5.
wa_field_cat-coltext = 'Changes possible'(h03). "#EC *
wa_field_cat-tooltip = 'Are changes possible?'(t01). "#EC *
APPEND wa_field_cat TO it_field_cat.
CALL METHOD alv->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_variant = my_variant
i_save = 'A'
is_layout = wa_layout
is_print = my_print
CHANGING
it_outtab = it_sflight
it_fieldcatalog = it_field_cat
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE a012(bc408).
ENDIF.
ENDMODULE. " create_and_transfer OUTPUT
*PAI modules
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
PERFORM free.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*Form routines
FORM free.
CALL METHOD: alv->free,
cont->free.
FREE: alv,
cont.
ENDFORM. " free -
Reg: CheckBox in ALV Grid Display
Hi all,
My requirement is to display checkbox field in ALV Grid which is editable.
And i also need to get all the records that i have selected in ALV grid.
How can i do it. Kindly Help me with sample codes.
Its Urgent.
<REMOVED BY MODERATOR>
Regards
Naveen
Edited by: Alvaro Tejada Galindo on Feb 18, 2008 5:41 PMHi,
First declare ur itab with the first field of length 1 char,
Dont mention dat in the field cat.
Give that field name and itab name in the layout.
as
is_layout-box_fieldname = 'CHECK'.
is_layout-box_tabname = 'IT_FINAL'.
u can dispaly ur checkbox in the output dispaly.
now to read the selected checkboxes u need to read the display with the syntax..
first describe the table + headre length = w_count.
FORM sub_read_checkbox.
DATA: w_cbox TYPE char1.
REFRESH : it_mail,it_text,it_selected.
REFRESH : it_selected.
DO w_count TIMES.
READ LINE sy-index FIELD VALUE : is_final-cbox INTO w_cbox.
IF w_cbox = c_x.
READ TABLE it_header INTO is_header WITH KEY lifnr = is_header-lifnr
u_r = is_header-u_r.
IF sy-subrc = 0.
APPEND is_header TO it_selected .
CLEAR: is_header,w_cbox.
ENDIF.
ENDIF.
ENDDO.
endform.
This serves ur purpose.
Regards............ -
Alv grid layout display in 2 pages
Hi All,
I am presently working in ALV programming.
The client requierment is "GL line items and summary sheet will be listed in separate pages."
i am dispalying the output using ALV grid layout display.
Can you please conform that how to write logic for summary sheet.that will display after the line items and also saparate page.
Thanks,
SridharHi ,
Use event END OF PAGE .
Write a Form for end of page
then do calcualtions.
Reward if useful. -
Duplicate coloumns appear in alv grid..
i added a new field in my internal table and also added the same in filed catalog.
but the problem is my alv grid,doesnt show the added field correctly,it infact shows the values in the left neighbour.
how to get rid of the problem?
also in debuging the internal table has correct values for the field added(not that of its left neighbour)Kumar gaurav,
i changed the new field to a dictionary field ,and then the changed the dispaly name in the field catlog...
"this solved the problem
pls close this thread to make it easy for others.
Amit. -
ALV Grid - Columns Displays?
Any way to display an ALV grid in different sections?
Meaning, The top half of the report lines up columns differently then the bottom half of the report.
For instance, The first two columns are always the same for all fields, but becuse the rest of the fields are not related to one another in any way the report breaks and displays te columns differently at a certain point in the output of the display?
Thank -YouIn the field catalog give the <b>emphasize</b>.
For first 2 columns:
ls_fcat-emphasize = 'C310'.
For all other columns:
ls_fcat-emphasize = 'C400'.
These make the ALV columns in different colors.
In case if u want to color a particular row or particular cell, do the below things:
Assign a variable celltab TYPE lvc_t_styl, in the internal table which u dispaly the data.
In the layout give, wa_layout-stylefname = 'CELLTAB'.
Modify the final internal table like this sample code:
DATA : lt_celltab TYPE lvc_t_styl,
ls_celltab TYPE lvc_s_styl.
READ TABLE i_final_data INTO wa_final_data INDEX 1.
ls_celltab-fieldname = 'LNG_TYPES'.
ls_celltab-style = '00000060'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'LNG_QUANTITY'.
ls_celltab-style = '00003060'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'NG_TYPES'.
ls_celltab-style = '00000666'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'NG_QUANTITY'.
ls_celltab-style = '00000066'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
wa_final_data-celltab[] = lt_celltab[].
MODIFY i_final_data FROM wa_final_data INDEX 1.
CLEAR: ls_celltab, lt_celltab, wa_final_data.
Here ls_celltab-style = '00003060' will make that particular cell in different color.
Regards,
Prakash.
Message was edited by: Prakash Ramu
Maybe you are looking for
-
My optical drive will not read any music cds or recognize a blank cd. it might read some data cds. what is wrong with it and how can i fix it?
-
Photo Stream keeps turning off in Aperture
I have Aperture 3.2 and have enabled Photo Stream, several times. It syncs all of my photos with my iPhone 4 and imports the new ones in a project. I close Aperture and reopen it several days later, go to the Photo Stream library and Photo Stream i
-
Select from (too many) tables
Hi all, I'm a proud Oracle Apex developer. We have developed an Interactive Report that is generated from many joined tables in a remote system. I've read that to improve performances we can do the following: 1) Create a temporary table on our system
-
Can i retrieve items from time machine into mavericks
Dear people I am looking to install mavericks but don't want to do a clean install, ( i will if it messes my machine up though ). If i install mavericks i take it that; A: all the apple apps will still work. B: if it is messed up then i wil be able t
-
When I send an email with an attachment I just all of a sudden started receiving a Delivery Failure Notice. Have sent emails just like these numerous times with no problem. I can send them an email that only has text but every time I try to send 1 wi