Total/Subtotal Icon in ALV GRID
Hi;
i have an ALV GRID that is already sorted and data is shown ordered in the grid:
Sort Documento
wa_sort-spos = '1' .
wa_sort-fieldname = 'MBLNR'.
wa_sort-tabname = 'ITAB'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
But, i need to subtotal by a column and i do this:
gt_fieldcat-seltext_l = 'Cant_entregada'.
gt_fieldcat-fieldname = 'MENGE'.
gt_fieldcat-ref_tabname = 'itab'.
gt_fieldcat-outputlen = 14.
gt_fieldcat-do_sum = 'X'.
APPEND gt_fieldcat. CLEAR gt_fieldcat.
Menge is data type Integer because the Key User doesn´t want decimal places.
And ,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_sort = i_sort
i_default = 'X'
i_save = 'A'
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
So data in the grid is ordered by Document number, but the total/subtotal button is not displayed.
i've been lookin other posts about the same, but i don´t see any difference with my code.
Any help.
David Fúnez
Tegucigalpa, Honduras
i found the answer..jus added this line : gt_fieldcat-datatype = 'INT4'.
gt_fieldcat-seltext_l = 'Cant_entregada'.
gt_fieldcat-fieldname = 'MENGE'.
gt_fieldcat-ref_tabname = 'itab'.
gt_fieldcat-outputlen = 14.
gt_fieldcat-do_sum = 'X'.
gt_fieldcat-datatype = 'INT4'.
APPEND gt_fieldcat. CLEAR gt_fieldcat.
Now buttons are displayed...
Similar Messages
-
Hide/Remove Subtotal Icon in ALV Grid report output.
Hi,
Is ther a way to remove or hide the Subtotal icon in the ALV Grid report output?
Thanks & Regards,
Praveen.Hi,
You can add names of the buttons(which you want to hide) to internal table and pass this internal table for tool bar excluding parameter while calling ALV.
Here as shown in below code, 'Sorting, Ascending,Descending' buttons are removed from the tool bar list.
data : lt_exclude TYPE ui_functions.
ls_exclude = cl_gui_alv_grid=>MC_FC_SORT.
APPEND ls_exclude TO lt_exclude .
ls_exclude = cl_gui_alv_grid=>MC_FC_SORT_ASC.
APPEND ls_exclude TO lt_exclude .
ls_exclude = cl_gui_alv_grid=>MC_FC_SORT_DSC.
APPEND ls_exclude TO lt_exclude .
CALL METHOD alvgd->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = lt_exclude
Regards,
Maharshi Vyas -
How to display a row after a subtotal field in ALV Grid
Hi All,
My requirement is to print a extra row with values and constant text after printing subtotal values in ALV Grid.
e.g. TOTAL 12.23 ---> Subtotal field
Tax 5.2 ---> extra row after subtotal field.
Please help me....
Thanks in advance.
Regards
AjayHi
You can try using INSERT <WA> OR INSERT INITIAL LINE .
fill the wa with tax value.
INSERT <wa> into table < internal table >
A row will be inserted into internal table with the values.
Try this and let me know.
Thanks
Hariharan -
HI ALL,
could any one send me how to display the subtotal Text in ALV grid output with code sample.
with thanks.
kannanhi,
means u want to print some text instead of star ( coming in subtotal) ?
If so than try like,
*& Report ZALV_LIST
REPORT zalv_list.
TABLES : mseg.
TYPE-POOLS : slis.
DATA : BEGIN OF itab OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab1.
DATA : t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event,
t_subtot TYPE slis_t_sortinfo_alv,
subtot LIKE LINE OF t_subtot,
wa_fcat LIKE LINE OF t_fcat,
gd_layout TYPE slis_layout_alv.
DATA : gt_menge LIKE mseg-menge,
st_menge LIKE mseg-menge.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : doc FOR mseg-mblnr.
SELECTION-SCREEN : END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cat USING t_fcat.
PERFORM build_eve.
PERFORM build_layout.
START-OF-SELECTION.
PERFORM get_data.
PERFORM display.
*& Form build_cat
text
-->TEMP_FCAT text
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MBLNR'.
wa_fcat-seltext_m = 'Material Doc.'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MENGE'.
wa_fcat-seltext_m = 'Quantity'.
wa_fcat-do_sum = 'Y'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
subtot-spos = 1.
subtot-fieldname = 'MBLNR'.
subtot-tabname = 'ITAB'.
subtot-up = 'X'.
subtot-group = 'X'.
subtot-subtot = 'X'.
subtot-expa = 'X'.
APPEND subtot TO t_subtot.
ENDFORM. "build_cat
*& Form build_eve
text
FORM build_eve.
DATA : wa_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
EXCEPTIONS
list_type_wrong = 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.
READ TABLE t_eve WITH KEY name = slis_ev_top_of_page
INTO wa_eve.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO wa_eve-form.
APPEND wa_eve TO t_eve.
ENDIF.
ENDFORM. "build_eve
*& Form build_layout
text
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-subtotals_text = 'Sub Total'.
ENDFORM. " BUILD_LAYOUT
*& Form get_data
text
FORM get_data.
SELECT mblnr matnr werks menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab
WHERE mblnr IN doc.
SORT itab BY mblnr.
LOOP AT itab.
AT NEW mblnr.
LOOP AT itab WHERE mblnr = itab-mblnr.
st_menge = st_menge + itab-menge.
itab1-mblnr = itab-mblnr.
itab1-matnr = itab-matnr.
itab1-werks = itab-werks.
itab1-menge = itab-menge.
APPEND itab1.
ENDLOOP.
itab1-mblnr = 'Sub_Total'.
itab1-matnr = ''.
itab1-werks = ''.
itab1-menge = st_menge.
itab1-line_color = 'C710'.
APPEND itab1.
itab1-line_color = ''.
CLEAR st_menge.
ENDAT.
ENDLOOP.
LOOP AT itab.
gt_menge = gt_menge + itab-menge.
ENDLOOP.
itab1-mblnr = 'Total'.
itab1-matnr = ''.
itab1-werks = ''.
itab1-menge = gt_menge.
itab1-line_color = 'C310'.
APPEND itab1.
ENDFORM. "get_data
*& Form display
text
FORM display.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_LIST'
is_layout = gd_layout
it_fieldcat = t_fcat
it_sort = t_subtot
it_events = t_eve
TABLES
t_outtab = itab1
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
*& Form top_of_page
text
FORM top_of_page.
WRITE:/ 'Data'.
ENDFORM. "top_of_page
reward if useful....
Edited by: Dhwani shah on Dec 20, 2007 1:20 PM -
Microsoft Excel Icon in ALV Grid Report
Hi all,
We have a customized report. When we execute that reports, it open in ALV Grid format. When we choose "Microsoft Excel" Icon to change layout to Excel, it then shows the report in excel without any data.
Can any one please tell me that why there is no data? should i need to do any settings in excel for this?
Please respond.
Best Regards,
AIHi,
Refer these:
Microsoft Excel Icon in ALV Grid Report
Re: Not able display the Excel Icon in ALV List Display
Hope it helps
Regards
Mansi -
To activate total & subtotal button in ALV by class
Hi,
Kindly suggest how to activate total & subtotal button in ALV by class. I have used layout configuration by lvc_s_layo.
gs_layout type lvc_s_layo.
Ashutosh KumarDears,
Do_SUM is not available in gs_layout type lvc_s_layo.
Its working only in function module REUSE_ALV_LIST_DISPLAY.
How to use in class ALV.
FORM SUB_CREATE_FIELDCATALOG .
THIS BELOW FIELD IS EDITABLE
PERFORM APPEND_FIELDCAT USING:'MATNR'
'Material No.'
'CHAR'
'30'
PERFORM APPEND_FIELDCAT USING:'MATKL'
'DOCUMENT TYPE'
'CHAR'
'10'
PERFORM APPEND_FIELDCAT USING:''
'CHAR'
'4'
'C610'
PERFORM APPEND_FIELDCAT USING:'NTGEW'
'NET WT'
'P'
'10'
'C610'
'X'.
PERFORM APPEND_FIELDCAT USING:'VOLTO'
'VOLUME'
'P'
'10'
'C610'
'X'.
PERFORM APPEND_FIELDCAT USING:'VPREH'
'COST'
'P'
'10'
'C610'
ENDFORM. " SUB_CREATE_FIELDCATALOG
*& FORM APPEND_FIELDCAT
TEXT
-->P_0116 TEXT
-->P_0117 TEXT
-->P_0118 TEXT
-->P_0119 TEXT
-->P_0120 TEXT
-->P_10 TEXT
FORM APPEND_FIELDCAT USING P_114
P_115
P_116
P_117
P_118
P_119.
CLEAR GT_FIELDCAT_LVC.
GT_FIELDCAT_LVC-FIELDNAME = P_114.
GT_FIELDCAT_LVC-COLTEXT = P_115.
GT_FIELDCAT_LVC-DATATYPE = P_116.
GT_FIELDCAT_LVC-OUTPUTLEN = P_117.
GT_FIELDCAT_LVC-EMPHASIZE = P_118.
GT_FIELDCAT_LVC-do_sum = P_119.
append gt_fieldcat_lvc. -
Displaying Total Text in an ALV Grid
Hi Experts,
Please suggest me how to display the Total text in the alv grid using CL_SALV_FACTORY method.
Example Output:
Field1 Field2 Field3
a b 100
b c 100
Total 200
Regards,
Sunil KumarHi Avinash,
It will not work since am using cl_salv_factory method. whatever links you have sent are using reuse_alv_grid_display or set_first_table_display.
Regards,
Sunil Kumar -
Change the total and subtotal dynamically in ALV GRID
Hi guys,
I need to change the total and subtotal of field "AMOUNT" dynamically.I am using ALV GRID CONTROL(oops concept).I need to override the standard functionality.I need to show my own subtotal and total line instead of standard one .Hi
I've understood it, I wanted to use OO Grid too, but I had to use the ALV list in order to write my total.
If you need to use OO grid u can try to exclude all funcitonalities for the total, subtotal and sorting and insert in the output table the lines with your totals.
Max -
Regarding user interface in subtotal line of ALV grid, ensure points
Hi,
I have 3 fields,
A= vendor , B = freight , C = Cost PMT
When the vendor get changed, My Grid is showing subtotal of B i.e freight.
Now my requirement is, in the same subtotal line, I want average of C (Cost PMT) field.
So how we can interact with the subtotal line of the ALV grid.
Pleas reply!!!! & have ur points.
cheersRead the documentation of FM ICON_CREATE, the purpose of the Function module is entirely different from what you are using it for.
To print Icons in ALV (Using FMs ) all you need to do is to send the Icon name in the field.
Also parameters TEXT and INFO of FM ICON_CREATE seem to be flags, that are appended to the icon name so that when you set it on the screen the appropriate info or Text is shown. -
Subtotal Text in ALV Grid and hiding empty row
Hello,
ive got a ALV-Grid with a few fields .. Total on one field subtotal on VKORG, category or some other fields .
after subtotal of one of the 2 named fields i'm reading the literal to the given fields and writing them in the table which is displayed and do a refresh.
i can show the field literal in the alv by adding it into the field cat but than its displayed even if its not filled.
i just want to display that column after filling it - the subtotal of the 2 columns.
and i want to add the text of the literal to the subtotal line. so if the alv grid is closed to display the totals. i want to see what the subtotal is for.
for displaying i use
CALL METHOD lcl_alv_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
is_variant = gs_variant
it_toolbar_excluding = gt_exclude
i_save = x_save
i_default = 'X'
CHANGING
it_outtab = it_alvlist[]
it_fieldcatalog = gt_field_cat.
for refresh
lv_lvc_s_stbl-row = 'X'.
lv_lvc_s_stbl-col = 'X'.
lv_soft_refresh = 'X'.
CALL METHOD lcl_alv_grid->refresh_table_display
EXPORTING
is_stable = lv_lvc_s_stbl
i_soft_refresh = lv_soft_refresh
EXCEPTIONS
finished = 1
OTHERS = 2.
get the selected column to read literal
CALL METHOD lcl_alv_grid->get_selected_columns
IMPORTING
et_index_columns = it_col_tab
EXCEPTIONS
OTHERS = 1.
Hope you can help me and understand my problemHi,
Use the No_out from Reusable types of fieldcat..For example.
IF it_final-field is initial.
READ TABLE IT_FIELDCAT5 WITH KEY FIELDNAME = 'BCD'.
IF SY-SUBRC EQ 0.
IT_FIELDCAT5-NO_OUT = 'X'.
MODIFY IT_FIELDCAT5 INDEX SY-TABIX TRANSPORTING NO_OUT.
ENDIF.
else.
READ TABLE IT_FIELDCAT5 WITH KEY FIELDNAME = 'BCD'.
IF SY-SUBRC EQ 0.
IT_FIELDCAT5-NO_OUT = ' '.
MODIFY IT_FIELDCAT5 INDEX SY-TABIX TRANSPORTING NO_OUT.
ENDIF.
ENDIf.
Cheers,
Syed Maheboob. -
Total problem in Exporting ALV GRID to Excel
Hi all,
I have manipulated the Total of ALV Grid by using GET_SUBTOTALS and REFRESH method of CL_GUI_ALV_GRID. The ALV Output is also correct. When i export to Excel,only the Original total is displaying not the calculated one. How to download the exact output which is displaying in the ALV Grid to Excel.
Please help me out to solve this.
Thanks,
RameshDEAR,
AS U WANT UPLOAD WITH THE SUB TOTAL YOU TRY THIS.
FIRST to get subtotal in ALV output you select at least one column of total and then press ctrl + F6 . u will see the sub total .
and now how to download it so press ctrl + shift + F9 .
now screen appears and select second option ie spreadsheet and press enter
now a screen appear in wich u have to give file name.
so double click on search button of file name . click on desktop give ur file name as u want suppose zreport u have given.
and save type = excel file.
now save it and then generate it your output bytes will be transmitted .
now u can see in your desktop in your file name . ur output with subtotal.
regards
navin -
'TOTAL' text display in ALV GRID output
Hi,
My requirement is to display 'TOTAL' text at the end of the ALV report alongwith Totals for the respective columns.
I've used Classical method(i.e. used ALV GRID FM) to display the report.
For Totals I've used 'DO_SUM', option and for text populated 'TOTALS_TEXT' field, but still its not showing the desired text.
I've tried most of the solutions provided on SDN, and they are not working.
So, plssss help me to find out correct solution.
Thanks in Advance!!!!!!
Thanks & regards,
Amithi,
i hope this code will exactli fulfil ur requirement.
type-poolS: slis.
TYPES: BEGIN OF S_TAB,
F1 TYPE CHAR5,
F2 TYPE I,
F3 TYPE I,
END OF S_TAB.
TYPES: BEGIN OF sf_TAB,
f0 type char10,
F1 TYPE CHAR5,
F2 TYPE I,
F3 TYPE I,
END OF Sf_TAB.
DATA: IT_TAB TYPE TABLE OF S_TAB,
WA_TAB TYPE S_TAB,
IT_FIN TYPE TABLE OF Sf_TAB,
WA_FIN TYPE Sf_TAB.
data: fcat type slis_t_fieldcat_alv,
wa_fcat type slis_fieldcat_alv,
layout type slis_layout_alv,
it_sort type SLIS_T_SORTINFO_ALV,
wa_sort type SLIS_SORTINFO_ALV.
FREE IT_TAB. CLEAR WA_TAB.
WA_TAB-F1 = 'A1'.
WA_TAB-F2 = '10'.
WA_TAB-F3 = '20'.
APPEND WA_TAB TO IT_TAB.
CLEAR WA_TAB.
WA_TAB-F1 = 'A1'.
WA_TAB-F2 = '10'.
WA_TAB-F3 = '20'.
APPEND WA_TAB TO IT_TAB.
CLEAR WA_TAB.
WA_TAB-F1 = 'A2'.
WA_TAB-F2 = '15'.
WA_TAB-F3 = '30'.
APPEND WA_TAB TO IT_TAB.
CLEAR WA_TAB.
WA_TAB-F1 = 'A3'.
WA_TAB-F2 = '15'.
WA_TAB-F3 = '40'.
APPEND WA_TAB TO IT_TAB.
CLEAR WA_TAB.
WA_TAB-F1 = 'A3'.
WA_TAB-F2 = '20'.
WA_TAB-F3 = '60'.
APPEND WA_TAB TO IT_TAB.
CLEAR WA_TAB.
LOOP AT IT_TAB INTO WA_TAB.
wa_fin-f0 = 'Total'.
wa_fin-f1 = wa_tab-f1.
wa_fin-f2 = wa_tab-f2.
wa_fin-f3 = wa_tab-f3.
append wa_fin to it_fin.
clear wa_fin.
ENDLOOP.
Define Imacro.
wa_fcat-fieldname = &1.
wa_fcat-tabname = &2.
wa_fcat-reptext_ddic = &3.
wa_fcat-col_pos = &4.
WA_FCAT-DO_SUM = &5.
WA_FCAT-NO_OUT = &6.
append wa_fcat to fcat .
clear wa_fcat.
end-of-definition.
imacro 'F0' 'it_fin' '' '1' '' 'X'.
imacro 'F1' 'it_fin' 'PO Document' '2' '' ''.
imacro 'F2' 'it_fin' 'TOTAL' '3' 'X' ''.
imacro 'F3' 'it_fin' 'Space' '4' '' ''.
****************DEFINE LAYOUT
layout-zebra = 'X'.
layout-colwidth_optimize = 'X'.
layout-no_totAlLine = 'X'.
WA_SORT-SPOS = 1.
WA_SORT-fieldname = 'F0'.
wa_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_GRID_TITLE = 'SALES ORDER DETAILS'
IS_LAYOUT = layout
IT_FIELDCAT = fcat
IT_SORT = IT_SORT
TABLES
T_OUTTAB = IT_FIN
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Cheers,
Rudhir -
Hello.
Could You tell me how to display icon in cell of ALV Grid? MAybe You have a link to some tutorial?
I'm trying make such thing:
to my itab I'm adding
icon1 LIKE icon-id
then I fill itab, to fieldcatalog give
PERFORM append_wsfield USING
ws_field_st ws_fieldcat_st 'ICON1' '' 0 1 0 '' 2 'X' ''.
When I debug code, there is an icon in the itab, but in grid it doesnt appears.
I'd be thankful for help. Greetings. P.
Message was edited by:
Piotr WojciechowskiGo to the type pool ICON and you can find the code for each icon there. Depending on the icon that you want assign the code for that icon to the column in the ALV Grid (Icon field in the internal table). The icon will be displayed automatically.
Please mark points if the solution was useful.
Regards,
Manoj -
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 -
Color the sub-total row in an alv-grid
Hi all.
I work on SAP 4.7 WAS6.20 and output a table with the cl_gui_alv_grid. I´m able to color special rows (or columns) in the alv grid. But I want to color individually the sub-total lines (like the lines before) and don´t want the yellow color for all of the sub-total lines.
Do you know how to color the sub-total-lines?
Thanks a lot.
MichaelHi,
U can color an individula row see the link below
Color a line
The steps for coloring a line i the grid is much the same as making a traffic light.
* To color a line the structure of the table must include a Char 4 field for color properties
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
* Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
* Loop trough the table to set the color properties of each line. The color properties field is
* Char 4 and the characters is set as follows:
* Char 1 = C = This is a color property
* Char 2 = 6 = Color code (1 - 7)
* Char 3 = Intensified on/of = 1 = on
* Char 4 = Inverse display = 0 = of
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-line_color = 'C610'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
* Name of the color field
gs_layout-info_fname = 'LINE_COLOR'.
* Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight
see the link
http://www.sapgenie.com/abap/controls/alvgrid.htm
Maybe you are looking for
-
Acrobat 9 Standard Trial Download
I have been able to download the trial version 9 Pro and have done my testing, but I've not been able to find and download a trial version of Acrobat 9 Standard. I'm guessing it is not available for trial, can anyone confirm please? Thanks, Jeffrey
-
Hi How do I put the full date in a PDF Generated. I have a date field but when I do the preview it doesn't show the date! I need the date in spanish thanks
-
Yesterday i downloaded CutePDF, which is now uninstalled. I also attempted to add the"opt-out browser plug-in for Google Analytics.
-
I've got something wedged in a host or listener config. I had 11.2.0 running, scratched it off and to start over. I removed the software and reinstalled. Now when I run netca and try to create a listener on the port I was using it fails saying the po
-
How do you change the setting to open the pdf instead of automatically saving it somewhere?