ALV Grid throwing dump in total function
Hi,
My ALV grid program, is working fine in development server, for the total and subtotal function. However, the same program is throwing a short dump in Quality server when we try to get the total.Please help!
Regards,
Anita Jeyan
Hi ,
Please go to ST22 and check what is the reason for error.
Let me know the error.
The reason might be due to some less data size or some data type mismatch.
Regards,
Uma
Edited by: UmaDave on Jun 9, 2010 12:10 PM
Edited by: UmaDave on Jun 9, 2010 12:10 PM
Similar Messages
-
could anybody advice, ALV GRID FM(field catalog issue)is getting short dump, but workig fine for ALV LIST.
PERFORM create_field_catalog USING:
'TRAFFIC_LIGHT' ' ' 15 'Status' 'Status' ' ',
'VKORG' ' ' 15 'Sales Org' 'Sales Org' ' ',
'VTWEG' ' ' 15 'Dist Channel' 'Dist Channel' ' ',
'KUNRG' ' ' 15 'Payer' 'Payer' ' ',
'PAYER' ' ' 15 'Payer Name' 'Payer Name' ' ',
'KUNAG' ' ' 15 'Ship-To' 'Ship-To' ' ',
'SHIPTO' ' ' 15 'Ship-To Name' 'Ship-To Name' ' ',
'SHIPTOPAR' ' ' 15 'Bill to Party' 'Bill To Party' ' ',
'KDGRP' ' ' 15 'Customer Grp' 'Customer Grp' ' ',
'ZCUSTPO' ' ' 15 'Customer PO' 'Customer PO' ' ',
'VBELN' ' ' 15 'Billing Doc' 'Billing Doc' ' ',
'FKDAT' ' ' 15 'Billing Date' 'Billing Date' ' ',
'FKART' ' ' 15 'Billing Type' 'Billing Type' ' ',
'ZOUTPUT' ' ' 15 'Output Type' 'Output Type' ' ',
'NETWR' ' ' 15 'Net Value' 'Net Value' 'X',
'KWERT' ' ' 15 'Total VAT' 'Total VAT' 'X',
'WAERK' ' ' 15 'Currency' 'Currency' ' ',
'XBLNR' ' ' 15 'Reference' 'Reference' ' ',
'DELNO' ' ' 15 'Delivery #' 'Delivery #' ' ',
'TLINE' ' ' 15 'Manifest #' 'Manifest #' ' ',
'ZBOL' ' ' 15 'Bill Of Ldng' 'Bill of Ldng' ' ',
'LIFEX' ' ' 15 'Ext Del #' 'Ext Del #' ' ',
'POSNR' ' ' 15 'Item' 'Item' ' ',
'MATNR' ' ' 18 'Material' 'Material' ' ',
'KDMAT' ' ' 15 'Cust Matl' 'Cust Matl' ' ',
'WERKS' ' ' 15 'Plant' 'Plant' ' ',
'ZZPLAT' ' ' 10 'Platform' 'Platform' ' ',
'ZZPRONUM' ' ' 10 'Program' 'Program' ' ',
'ZZPROCODE' ' ' 10 'Prod Code' 'Prod Code' ' ',
'FKIMG' ' ' 15 'Qty' 'Qty' ' ',
'VRKME' ' ' 15 'UoM' 'UoM' ' ',
'ARKTX' ' ' 15 'Description' 'Description' ' ',
'KBETR' ' ' 15 'Price' 'Price' ' ',
'VATRT' ' ' 15 'VAT Rate' 'VAT Rate' ' ',
'KWERT_D' ' ' 15 'Item VAT' 'Item VAT' 'X',
'NETWR_D' ' ' 15 'Item Net Value' 'Item Net Value' 'X',
'VGBEL' ' ' 15 'Ref Document' 'Ref Document' ' ',
'VGPOS' ' ' 13 'Ref Doc Line' 'Ref Doc Line' ' ' .
FORM create_field_catalog USING fieldname TYPE c
inttype TYPE c
outputlen TYPE i
coltext TYPE c
seltext TYPE c
do_sum TYPE c.
DATA: l_f_fieldcat TYPE slis_fieldcat_alv.
l_f_fieldcat-fieldname = fieldname.
l_f_fieldcat-inttype = inttype.
l_f_fieldcat-outputlen = outputlen.
l_f_fieldcat-seltext_m = coltext.
l_f_fieldcat-seltext_l = seltext.
l_f_fieldcat-reptext_ddic = coltext.
l_f_fieldcat-do_sum = do_sum.
APPEND l_f_fieldcat TO t_field_catalog.
CLEAR l_f_fieldcat.
ENDFORM. "CREATE_FIELD_CATALOG
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_user_command = 'F_USER_COMMAND'
i_grid_settings = f_grid_settings
is_layout = f_grid_layout
is_print = f_print_settings
i_background_id = 'BACK'
it_events = t_events[]
it_fieldcat = t_field_catalog
it_sort = t_sortcat[]
i_default = 'X'
i_save = 'A'
is_variant = f_variant
TABLES
t_outtab = t_output4
EXCEPTIONS
program_error = 1
OTHERS = 2.BEGIN OF t_output4 OCCURS 0,
traffic_light TYPE c,
vkorg LIKE vbrk-vkorg,
vtweg LIKE vbrk-vtweg,
kunrg LIKE vbrk-kunrg,
payer LIKE adrc-name1,
kunag LIKE vbrk-kunag,
shipto LIKE adrc-name1,
shiptopar LIKE likp-kunnr,
kdgrp LIKE vbrk-kdgrp,
zcustpo LIKE vbkd-bstkd,
vbeln LIKE vbrk-vbeln,
fkdat LIKE vbrk-fkdat,
fkart LIKE vbrk-fkart,
zoutput LIKE dnast-kschl,
netwr LIKE vbrk-netwr,
kwert LIKE konv-kwert,
waerk LIKE vbrk-waerk,
xblnr LIKE vbrk-xblnr,
delno LIKE likp-vbeln,
t_line LIKE tline-tdline,
zbol LIKE likp-bolnr,
lifex LIKE likp-lifex,
posnr LIKE vbrp-posnr,
matnr LIKE vbrp-matnr,
kdmat LIKE lips-kdmat,
werks LIKE vbrp-werks,
zzplat LIKE vbrp-zzplat,
zzpronum LIKE vbrp-zzpronum,
zzprocode LIKE a802-zzprocode,
fkimg LIKE vbrp-fkimg,
vrkme LIKE vbrp-vrkme,
arktx LIKE vbrp-arktx,
kbetr LIKE konv-kbetr,
vatrt TYPE p DECIMALS 1,
kwert_d LIKE konv-kwert,
netwr_d LIKE vbrp-netwr,
vgbel LIKE vbrp-vgbel,
vgpos LIKE vbrp-vgpos,
END OF t_output4, -
ALV GRID - Text for Grand Total
Hi guys,
In ALV Grid, i need to display the Text 'GRAND TOTAL' at the left side of the row(Yellow line).
I have tried searching in the forum but didn't get the answer.
Please advice.
Thanks
ChintuHi
<br><br>
IF you copy and past this might not work but this is the sample code<br><br>
<pre>
REPORT Y_DOWN_TIME_ENTRYSRA.
TABLES : YDOWNTIME1.
TYPE-POOLS : SLIS.
*INTERNAL TABLE DECLARTION
data : l_layout type slis_layout_alv,
x_events type slis_alv_event,
it_events type slis_t_event.
DATA :ITAB LIKE YDOWNTIME1 OCCURS 0 WITH HEADER LINE .
data : GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
wa_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
**********************SELECTION PARAMETERS ************************
PARAMETERS: CB1 RADIOBUTTON GROUP G1 ,
CB2 RADIOBUTTON GROUP G1 ,
cb3 RADIOBUTTON GROUP G1 ,
CB4 RADIOBUTTON GROUP G1 ,
CB5 RADIOBUTTON GROUP G1 ,
CB6 RADIOBUTTON GROUP G1 ,
CB7 RADIOBUTTON GROUP G1 ,
CB8 RADIOBUTTON GROUP G1 ,
CB9 RADIOBUTTON GROUP G1 .
CB10 RADIOBUTTON GROUP G1,
CB11 RADIOBUTTON GROUP G1.
DATA : A TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK BK1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS :S_EQUNR FOR YDOWNTIME1-EQUNR ,
S_ERDop FOR YDOWNTIME1-ERDAT,
S_MFSTT FOR YDOWNTIME1-MFSTART.
PARAMETERS : P_SHIFT TYPE YDOWNTIME1-SHIFT,
P_CHARG TYPE YDOWNTIME1-CHARG,
p_COGRU TYPE YDOWNTIME1-QMGRP,
P_CODE TYPE YDOWNTIME1-COde,
p_name type ydowntime1-OPNAME,
p_sup TYPE YDOWNTIME1-SUPERVISOR,
P_MANG TYPE YDOWNTIME1-MANG.
SELECTION-SCREEN END OF BLOCK BK1 .
AT SELECTION-SCREEN.
IF CB1 EQ 'X'.
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop .
ELSEIF CB2 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop and charg eq p_charg .
ELSEIF CB3 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop and charg eq p_charg and shift eq P_SHIFT .
ELSEIF CB4 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where code eq p_code and erdat in S_ERDop.
ELSEIF CB5 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop and EQUNR in S_EQUNR and QMGRP eq p_COGRU.
ELSEIF CB6 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where OPNAME eq p_name and erdat in S_ERDop.
ELSEIF CB7 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where SUPERVISOR eq p_sup and erdat in S_ERDop.
ELSEIF CB8 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where MANG eq p_MANG and erdat in S_ERDop.
ELSEIF CB9 EQ 'X'.
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop and EQUNR in S_EQUNR.
endif.
loop at itab.
if itab-schno > 1.
A = ' '.
move A to itab-DCOR .
move A to itab-DCCR .
move A to itab-DCNR .
modify itab.
endif.
endloop.
perform create_fieldcat.
data: sort type slis_sortinfo_alv,
it_sort type SLIS_T_SORTINFO_ALV.
sort-fieldname = 'EQUNR'.
sort-up = 'X'.
sort-subtot = 'X'.
APPEND sort to it_sort.
sort-fieldname = 'SHIFT'.
sort-up = 'X'.
*sort-subtot = 'X'.
APPEND sort to it_sort.
l_layout-TOTALS_TEXT = 'TOTAL'.
l_layout-SUBTOTALS_TEXT = 'SUBTOTAL'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = l_layout
it_fieldcat = gt_fieldcat
it_events = it_events
it_sort = it_sort
TABLES
T_OUTTAB = ITAB
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.
*& Form CREATE_FIELDCAT
text
--> p1 text
<-- p2 text
FORM CREATE_FIELDCAT .
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '1'.
LS_FIELDCAT-FIELDNAME = 'ERDAT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '12'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'Date'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '2'.
LS_FIELDCAT-FIELDNAME = 'UZEIT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '8'.
LS_FIELDCAT-SELTEXT_L = 'Time'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '2'.
LS_FIELDCAT-FIELDNAME = 'EQUNR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '8'.
LS_FIELDCAT-SELTEXT_L = 'Equipment'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '2'.
LS_FIELDCAT-FIELDNAME = 'CODE'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '12'.
LS_FIELDCAT-SELTEXT_L = 'CODE'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '3'.
LS_FIELDCAT-FIELDNAME = 'QMGRP'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Code Group'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '3'.
LS_FIELDCAT-FIELDNAME = 'KURZTEXT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '40'.
LS_FIELDCAT-SELTEXT_L = 'Code Text'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '7'.
LS_FIELDCAT-FIELDNAME = 'DCOR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '14'.
LS_FIELDCAT-SELTEXT_L = 'Opening Dips'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '8'.
LS_FIELDCAT-FIELDNAME = 'DCCR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '14'.
LS_FIELDCAT-SELTEXT_L = 'Closing Dips'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'DCNR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'Net Dips'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'PRO'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'PROD IN LAC'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '4'.
LS_FIELDCAT-FIELDNAME = 'CHARG'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '12'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'Batch Number'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '6'.
LS_FIELDCAT-FIELDNAME = 'OPNAME'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Operators Name'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '6'.
LS_FIELDCAT-FIELDNAME = 'SUPERVISOR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Supervisor Name'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '6'.
LS_FIELDCAT-FIELDNAME = 'MANG'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Manager'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '6'.
LS_FIELDCAT-FIELDNAME = 'SHIFT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Shift'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'MFSTART'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
LS_FIELDCAT-SELTEXT_L = 'Start Time'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'MFEND'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
LS_FIELDCAT-SELTEXT_L = 'End Time'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'DURATION'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'DURATION'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'ZUNIT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
LS_FIELDCAT-SELTEXT_L = 'UNIT'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
ENDFORM. " CREATE_FIELDCAT
</pre>
Edited by: Matt on Sep 3, 2009 12:06 PM -
ALV Grid Subtotal text and Total text display
Hello ABAPGuru's
I want to display the subtotal and Total texts. alv grid program runing on background.
Regards
Sweety(Sri)Hello Neil,
Here I have attached my routines.anyway my confusion. I have wrote the routine subtotal_text .but i am not passing ALV GRID FM.
*& Form eventtab_build
&---- This is used to get the list of events
---- <--RI_EVENTS Internal table
FORM eventtab_build CHANGING ri_events TYPE slis_t_event.
Structure for event handling.
DATA: rs_event TYPE slis_alv_event.
Returns table of possible events for a list type.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = ri_events. " Table of events to perform
Read the internal table with the TOP_OF_PAGE and move the
form name to the internal table
READ TABLE ri_events
WITH KEY name = slis_ev_top_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_end_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_form_eop_name TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_subtotal_text INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO rs_event-form. " Formname
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
*&-- Delete all unneeded events:
DELETE ri_events WHERE form IS INITIAL.
ENDFORM. " eventtab_build
*& Form SUBTOTAL_TEXT
text
--> p1 text
<-- p2 text
FORM SUBTOTAL_TEXT USING ep_subtot_line TYPE type_data
e_event_data TYPE slis_subtot_text.
IF NOT e_event_data-criteria IS INITIAL.
E_EVENT_DATA-DISPLAY_TEXT_FOR_SUBTOTAL = 'Account Total'.
ENDIF.
ENDFORM. "SUBTOTAL_TEXT
*& Form initialise_layout
Initialise Layout
FORM initialise_layout .
i_layout-colwidth_optimize = c_x.
i_layout-group_change_edit = c_x.
*i_layout-subtotals_text = ' a'.
i_layout-detail_popup = c_x.
i_layout-zebra = c_x.
i_layout-no_vline = 'X'.
i_layout-no_hline = 'X'.
i_layout-totals_text = 'Account Total'.
ENDFORM. " initialise_layout
Call the function module to display the report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_program
i_callback_top_of_page = 'TOP_OF_PAGE' "Top Of Page
is_layout = i_layout
it_fieldcat = i_fieldtab
it_sort = i_sort
it_events = i_events " Events
is_print = i_print
i_default = c_x
i_save = c_save
is_variant = v_variant
TABLES
t_outtab = i_data
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.
Regards
Sweety (Sri) -
Hi friends,
In ALV GRID I need to display text in total like grand Total not in subtotal.
Please let me know the solution .
Thanks in advance
RajendranHi,
R U using FM or Class.
If you are using FM, Grand total cannot be produced. Only using classes we can display Grand Totals.
Its my own experience.
thanks -
Alv grid control toolbar exclude generic functions
Hi,
I'm attempting to exclude certain functions from the toolbar of an (editable) alv grid (of class cl_gui_alv_grid).
The problem is that the buttons still show on the toolbar.
My program is based on the SAP example program 'BCALV_EDIT_03'. It would seem that even this example doesn't work as expected.
This is an extract of my code:
-[EXTRACT <b></b>BEGIN]--
*---Restrict generic functions to 'change only'.
* (i.e The user should not be able to add new lines).
DATA ls_exclude TYPE ui_func.
DATA: lt_exclude TYPE ui_functions.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND ls_exclude TO lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND ls_exclude TO lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND ls_exclude TO lt_exclude.
*...initialize alv grid
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = ps_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab.
-[EX<b></b>TRACT END]--
Thank You In Advance,
NhlanhlaHi,
i've done similar one, i am able to exclude.
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
"can you check the LT_EXCLUDE in debug mode.
regards
vijay -
ALV Grid Display - Dump when exporting (via right click)
Hi,
We have an ALV filled with a dynamic table because we needed dynamic columns. Our ALV has totals and subtotals. When exporting ALV via right click I get the following error:
OBJECTS_OBJREF_NOT_ASSIGNED
I observed two facts:
1.- If I disable subtotals and totals (commentig wa_cat-do_sum = 'X') export works properly, otherwise I get the dump.
2.- Having totals and subtotals enabled, if I use export icon (top toolbar) the export works properly, but using right-click export gets the same dump.
Our fieldcat is like this:
CLEAR wa_cat.
wa_cat-fieldname = g_cols.
wa_cat-seltext_s = gi_subdiv-btrtl.
wa_cat-seltext_l = gi_subdiv-btrtl.
wa_cat-datatype = 'INT4'.
wa_cat-do_sum = 'X'.
wa_cat-outputlen = '6'.
APPEND wa_cat TO fs_fldcat.
and we call ALV:
* Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fs_fldcat
i_callback_program = v_repid
is_layout = s_layout
i_callback_user_command = 'USER_COMMAND'
it_sort = t_sort
* i_callback_top_of_page = 'F_TOP_OF_PAGE'
i_save = 'X'
TABLES
t_outtab = <t_dyntable>.
Any help will be appreciated!
Thanks,
JosepHi kat_k,
I tried to do what you say, but I still get the same error!
More ideas?
Thanks!
Josep -
ALV GRID WEB DYNPRO ABAP CREATE FUNCTION BUTTON ON A NEW LINE?
Dear all,
I'd like to create 2 pushbuttons on a second line of the alvgrid toolbar
Is there any way to do that ?
RegardsHai Anubhav,
Read the node which is binded to the alv and use the following syntax:
CALL METHOD node_first_page_output->get_lead_selection_index
receiving
index = index
where index is type i. and will return u the lead selection.
Regards,
Madhu -
hiiiiiiiiiiii
i write one alv grid program
i wnat total at last of output for the field *DMBTR*
plz see the code and give me solution
type-pools: slis.
tables: BSID, KNA1.
data : begin of it_BSID occurs 0,
BUKRS TYPE BSID-BUKRS, "COMPANY CODE
KUNNR TYPE BSID-KUNNR, "Customer no
NAME1 TYPE KNA1-NAME1, "Customer name
XBLNR TYPE BSID-XBLNR, "REFERANCE
BLART TYPE BSID-BLART, "Document Type
BUDAT TYPE BSID-BUDAT, "Posting Date in the Document
SHKZG TYPE BSID-SHKZG, "Debit/Credit Indicator
BELNR TYPE BSID-BELNR, "Accounting Doc no
DMBTR TYPE BSID-DMBTR, "Amount in Local Currency
SGTXT TYPE BSID-SGTXT, "Item text
end of it_BSID.
data : begin of itab occurs 0,
BUKRS TYPE BSID-BUKRS, "COMPANY CODE
KUNNR TYPE BSID-KUNNR, "Customer no
NAME1 TYPE KNA1-NAME1, "Customer name
XBLNR TYPE BSID-XBLNR, "REFERANCE
BLART TYPE BSID-BLART, "Document Type
BUDAT TYPE BSID-BUDAT, "Posting Date in the Document
SHKZG TYPE BSID-SHKZG, "Debit/Credit Indicator
BELNR TYPE BSID-BELNR, "Accounting Doc no
DMBTR TYPE BSID-DMBTR, "Amount in Local Currency
SGTXT TYPE BSID-SGTXT, "Item text
end of itab.
*********ALV Declaration************************************************
data: it_fieldcatalog type slis_t_fieldcat_alv with header line,
wa_fieldcatalog like line of it_fieldcatalog,
wa_layout type slis_layout_alv,
it_rec type table of itab,
it_rec1 type table of itab,
wa_rec like line of itab,
wa_itab like line of itab.
data : it_sort type slis_t_sortinfo_alv,
wa_sort type slis_sortinfo_alv.
*********ALV Declaration************************************************
selection-screen : begin of block b with frame title text-100.
select-options:
COMPANY for BSID-BUKRS ,
CUSTOMER for BSID-KUNNR,
DATE FOR BSID-BUDAT.
selection-screen end of block b .
start-of-selection.
select BUKRS KUNNR XBLNR BLART BUDAT
SHKZG BELNR DMBTR SGTXT
from BSID into corresponding fields of table it_BSID
where
BUKRS IN COMPANY AND
KUNNR IN CUSTOMER AND
BUDAT IN DATE .
sort it_BSID by BUDAT KUNNR.
end-of-selection.
loop at it_BSID.
IF it_BSID-SHKZG EQ 'H'.
MULTIPLY it_BSID-DMBTR BY -1.
ENDIF.
move: IT_BSID-BUKRS TO ITAB-BUKRS, "COMPANY CODE
IT_BSID-KUNNR TO ITAB-KUNNR, "Customer no
IT_BSID-XBLNR TO ITAB-XBLNR, "REFERANCE
IT_BSID-BLART TO ITAB-BLART, "Document Type
IT_BSID-BUDAT TO ITAB-BUDAT, "Posting Date in the Document
IT_BSID-SHKZG TO ITAB-SHKZG, "Debit/Credit Indicator
IT_BSID-BELNR TO ITAB-BELNR, "Accounting Doc no
IT_BSID-DMBTR TO ITAB-DMBTR, "Amount in Local Currency
IT_BSID-SGTXT TO ITAB-SGTXT. "Item text
select single NAME1 from KNA1 into (itab-NAME1) where KUNNR = itab-KUNNR.
APPEND ITAB.
endloop.
loop at itab .
at end of itab-dmbtr.
sum.
endat.
endloop.
if not itab[] is initial.
perform populate_field_catalog.
perform fill_layout.
perform display_alv.
else.
write: ' NO DATA'.
endif.
*& Form populate_field_catalog
* text
form populate_field_catalog .
wa_fieldcatalog-fieldname = 'BUKRS'.
wa_fieldcatalog-seltext_m = 'COMPANY'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'KUNNR'.
wa_fieldcatalog-seltext_m = 'CUSTOMER CODE.'.
wa_fieldcatalog-no_zero = 'X'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'NAME1'.
wa_fieldcatalog-seltext_m = 'NAME'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'BLART'.
wa_fieldcatalog-seltext_m = 'DOC. TYPE '.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'BUDAT'.
wa_fieldcatalog-seltext_m = 'POSTING DATE'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'BELNR'.
wa_fieldcatalog-seltext_m = 'DOCUMENT NO.'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'DMBTR'.
wa_fieldcatalog-seltext_m = 'AMOUNT'.
wa_fieldcatalog-DO_SUM = 'X'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'SGTXT'.
wa_fieldcatalog-seltext_m = 'TEXT'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'XBLNR'.
wa_fieldcatalog-seltext_m = 'REFERANCE'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
endform. " populate_field_catalog
*& Form fill_layout
* text
* --> p1 text
* <-- p2 text
form fill_layout .
wa_layout-no_input = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-zebra = 'X'.
endform. " fill_layout
*& Form display_alv
* text
* --> p1 text
* <-- p2 text
form display_alv .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
is_layout = wa_layout
it_fieldcat = it_fieldcatalog[]
i_default = 'X'
i_save = 'A'
tables
t_outtab = itAB
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_alv
Edited by: pranay panchbhai on Mar 15, 2010 3:18 PMHi
Give this code for field DMBTR in fielcatalog.
wa_fieldcatalog-FIELDNAME = 'DMBTR'.
wa_fieldcatalog-INTTYPE = 'C'.
wa_fieldcatalogT-DO_SUM = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
It will work definitely.
If you still have doubts then revert back.
Thanks & Regards
Khushboo -
Percentage Total/Subtotal in ALV Grid
Dear All,
I have to display an ALV report with percentage feilds. Everything is fine but the problem arises when the standard ALV sum functionality is used. It simply adds up all the percentage columns. Making do_sum = 'C' wont help either as it would simple give an average of all the percentage. My requirement is to show them through calculation. I have searched the web and saw some solutions with SUBTOTAL_TEXT nad some with OOP programming but i am not able to get this. Can anybody please help.
<REMOVED BY MODERATOR>
Thanks
MV
Edited by: Alvaro Tejada Galindo on Apr 21, 2008 4:24 PMhi manish,
try this program.
ALV Grid List with sub-totals
REPORT z_demo_alv_sort.
* This program lists orders (VBAK) with sort and sub-total for *
* 'sold-to-party' (KUNNR) and 'Sales organization' (VKORG) *
TABLES : vbak.
TYPE-POOLS: slis. " ALV Global types
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, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " Document currency
END OF gt_vbak.
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.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
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.
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
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-subtot = &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.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA
***************** END OF PROGRAM Z_DEMO_ALV_SORT **********************
thanks
karthik
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 21, 2008 4:50 PM -
Hi all,
When displaying totals in a column of an ALV Grid (objects methodology) my totals are split. For example, if I have 5 rows with values in the column being summed of 100, 20, 300, 40 and 500; I end up with 3 total lines at the end of the list of 120, 300 and 540. The column being summed is a QUAN field (EKPO-MENGE). I have tried the NO_UTSPLIT parameter in the layout, and have tried referencing the UoM in the fieldcatalog for the field being summed with no success. Any ideas?
Regards,
RandyHi
As amit said, sum of the field is triggered at other fields, you can change in the output of this ALV list,
if have the GUI status as STANDARD or MAIN,
you will get the following in the menu bar, prerequest before,
1. u should have a sum field in the outlist.
2. u should have subtotal.
Now follow the steps in the menu,
1. Go to setting --> Choose Summary level --> Define drildown.
Now u can change the sub total level based on the sort conditions.
Regards,
prabhu rajesh. -
Excluding alv grid toolbaar functions
hey...i wanna kno ..is there any way to exclude functions in the toolbaal in alv grid..i wanna exclude functions like cut,add row,delete row etc...
Hi,
you have to fill table to exclude buttons, please follow code below
*--- Excluding buttons
DATA gt_toolbar_excluding TYPE ui_functions.
PERFORM exclude_tb_functions CHANGING gt_toolbar_excluding.
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = gt_toolbar_excluding
CHANGING
it_outtab = gt_list[]
it_sort = gt_sort
it_fieldcatalog = gt_fieldcat
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
* FORM exclude_tb_functions *
* To exclude some of standard buttons of ALV *
* --> PT_EXCLUDE *
FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions .
DATA ls_exclude TYPE ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_maximum .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_minimum .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_subtot .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_sum .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_average .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_mb_sum .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_mb_subtot .
ENDFORM .
Regards,
Karol -
Regarding subtotals and new page in ALV Grid
Hi All,
I have 5 employees in my internal table and each employee having five records.
Now iam displaying total employees in ALV grid and calculating their totals at the end of the hole records.
But i need to display the sub totals for each employee and i need new page for each employee.
means 1) New page for each employye
2) sub totals for each employee
3) grand total for all employees
How can i proceed for this requirement in ALV grid?For subtotals first you need to set the do_sum = 'X' in the fieldcatalog for the columns you want totals.
fieldcat-fieldname = 'ABC'.
fieldcat-do_sum = 'X'.
Append fieldcat to it_fieldcat,
for subtotals you need to populate the SORT table.
sort-fieldname = 'EMPLOYEE'.
sort-up = 'X'.
sort-group = '*'. "<----- this is for new page
"you can view new page in preview / print /
"if you are using the list function
sort-subtot = 'X'.
append sort to it_sort.
pass this it_sort to it_sort of the alv function. -
Dynamic ALV GRID screen in a class? Possible?
I have created a class(I have done it locally as to be able to use it for mutiple clients) that I include in programs that I want to implement the alv grid for using the FM approach. Doing this allows me to easily implement the ALV quickly. However, I am wanting to use the OO ALV grid approach since there is more flexibility and control doing it this way. But I do not want to have to create a screen for every program that I want to do this for, I would like to just have a method in my existing class that would call a screen and then be able to control it like normal. I know that screens can not be called from a method so I was thinking of doing something similiar to another post using a FM to call the screen. I realize that this could be complicated because certain methods for the ALV GRID are called in the PBO/PAI events. Any help or suggestions would be appreciated.
Note: I am on 6.20 and have searched all over the web before posting.
Thanks.Yes, i have written a function module which calls a generice ALV grid in a dialog box. Everything about the ALV grid is encapsulated in a function module. In this case, all I need to do is send this function module a fieldcatalog and the data, that's about it. Doing this may limit the functionality of event handling or you would just have to handle everything by doing more code for it.. This function module is very simple, not a whole lot to it. You could do something like this only instead of using a model dialog box, you would throw a regular dynpro.
function z_popup_with_alvgrid.
*"*"Global interface:
*" IMPORTING
*" REFERENCE(ENDPOS_COL) TYPE I DEFAULT 90
*" REFERENCE(ENDPOS_ROW) TYPE I DEFAULT 22
*" REFERENCE(STARTPOS_COL) TYPE I DEFAULT 10
*" REFERENCE(STARTPOS_ROW) TYPE I DEFAULT 2
*" REFERENCE(TEXTLINE1) TYPE C OPTIONAL
*" REFERENCE(TEXTLINE2) TYPE C OPTIONAL
*" REFERENCE(TEXTLINE3) TYPE C OPTIONAL
*" REFERENCE(TEXTLINE4) TYPE C OPTIONAL
*" REFERENCE(TITLE) TYPE C OPTIONAL
*" REFERENCE(FIELDCAT) TYPE LVC_T_FCAT
*" TABLES
*" I_ALV
call screen 0200 starting at startpos_col
startpos_row
ending at endpos_col
endpos_row.
endfunction.
* Module STATUS_0200 OUTPUT
module status_0200 output.
set pf-status '0200'.
set titlebar '0200' with title.
data: alv_container type ref to cl_gui_custom_container.
data: alv_grid type ref to cl_gui_alv_grid.
data: xfieldcat type lvc_t_fcat.
xfieldcat = fieldcat.
* Create Controls
create object:
alv_container
exporting
container_name = 'ALV_CONTAINER',
alv_grid
exporting
i_parent = alv_container.
* Set grid for first display
call method alv_grid->set_table_for_first_display(
exporting
i_structure_name = 'I_ALV'
changing
it_outtab = i_alv[]
it_fieldcatalog = xfieldcat[] ).
endmodule.
* Module USER_COMMAND_0100 INPUT
module user_command_0200 input.
case sy-ucomm.
when 'CONTINUE' or 'CANCEL'.
set screen 0.
leave screen.
endcase.
endmodule.
Regards,
Rich Heilman -
ALV Grid Header Problem.
Hi All,
I want to display the header of the ALV Grid as:
Material 111/11823
Plant/Usage/Alt 2845/3/5
Description ABI CAB
Base Qty. 23.000
The values are to be taken from variables
Please suggest how to do this.
Thanks*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report with grand total *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
perform top-of-page.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& 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
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
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_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'ideas'.
endform.
Maybe you are looking for
-
Continuous Beeping noise on Startup and at other times
My iMac is over a year old. I have no idea what is wrong or happening here but below is what happens. I hear a continuous beeping noise from my iMac at times. I had Firefox open and when it started beeping, a little search bar opened up at the bottom
-
WHAT now with OSX search function?
Okay, i just searched one of my hard drives for pdf files, and search returns 0 files. HOW can this be!? I would use profanity here because it's plainly warranted, but Apple doesn't like that. I think from now on, i'll use the term "OS X" as a substi
-
Illustrator and Office 2011 mac
Good evening, I search the Illustrator library to connect as Reference in VBA on Mac set myAi = createobject("Illustrator.application.cs4) give me an error and there is no library in VBA for Illustrator I'm new on Mac Thanks for your help Patrice Bre
-
Wrongly carried forward budget (KOCO) want to return.
Hi, I have by mistake carry forward the budget for a internal order to wrong year, like; a order created in 2008 and i wanted to carry forward the budget to 2009 but done to 2010. We need to have the budget corrected to the value. I have tried with e
-
How to activate trace from BO in my PC
Hello!! I trying to active a trace to see my mdx log in my PC. I am doing the steps indicate in SAP Kb Note: 1235111. This note say the following: "OverWrite"="No" "AppendPID"="No" "LogFile"="<your BOE120 install folder here>/bobje/logging/MDA.log" "