Subtotals in ALV Report
Hello,
I am developing a report using ALV FM, i have field catalog(vbeln posnr matnr netpr). i know how to set subtotals using layout settings once after program execution.but i want subtotals to set before execution( i mean that, in coding itself). does any one worked on this before..?if so. plz send some sample code..
thanks in advance..
leoiz.
Hai Komal Rani ,
As u said that i worked on subtotals in my report but that doesn't give any result to me.As we know that before going to work on subtots we must sum at least one column,then only we can do subtots, similarly i did using do_sum attribute in fieldcatalog table on netprice column.
then i passed
s_sort_info-fieldname = 'VBELN'.
s_sort_info-subtot = 'X'.
append s_sort_info to t_sort_info.
then i passed t_sort_info to
IT_SORT = t_sort_info in
REUSE_ALV_GRID_DISPLAY fm.
but that doesn't give any result...
if i did mistake, can u explain once again..?
leoiz.
Similar Messages
-
Subtotals in ALV report for ALPHA-NUMERIC field
Hi Experts,
I have problem while subtotalling values in ALV report.
I have 8 fields in my fieldcatalog. Now, I have to do the subtotal based on 3rd field having name 'ABC'. This field is having type CHAR & having lenght 3.
Now I wanted to do subtotalling for field 7 & 8 as 'NETWR' & 'MENGE' based on 3rd field.
How we can do the subtotal?Hi,
Refer this code
*& Form sub_display_data
text
FORM sub_display_data .
*--To sort the output through material number
DATA : lwa_sort TYPE slis_sortinfo_alv.
DATA : lit_sort TYPE slis_t_sortinfo_alv.
*--Pass the values to the table
lwa_sort-fieldname = 'PERNR'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '1'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = 'X'. "Subtotal
APPEND lwa_sort TO lit_sort.
*--Pass the values to the table
lwa_sort-fieldname = 'WORKDATE'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '2'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = ' '. "Subtotal
APPEND lwa_sort TO lit_sort.
*--Pass the values to the table
lwa_sort-fieldname = 'WEKLY'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '3'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = ' '. "Subtotal
APPEND lwa_sort TO lit_sort.
wa_layout-colwidth_optimize = 'X'.
IF NOT it_final2[] IS INITIAL.
*--Call the function module to display the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = wa_layout
i_callback_program = v_repid
it_fieldcat = it_fieldcat1[]
i_default = c_chk
i_save = c_save
it_sort = lit_sort
TABLES
t_outtab = it_final2
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.
ELSE.
*--Message No data found
MESSAGE i888 WITH text-017.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " sub_display_data
Regards,
Prashant -
Display Subtotals on ALV Report W/O changing Layout
Hi ,
I need to display subtotals of quantity fields in my output of report ,with corresponding production order by using ALV container,Layout default seetings won't work here because user has to do many operations such as sorting filtering etc ,after displaying the reportCheck these threads out
http://www.sap-basis-abap.com/sapalv.htm
http://help.sap.com/saphelp_nw04/helpdata/en/ee/b99d37e188a049e10000009b38f8cf/content.htm
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
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
Regards -
In ALV report is possible to display the subtotals in separate column
Hi,
I have made one ALV report, i need to show the subtotals of ekpo-brtwr (Gross Value) grouped by or sorted by
ekko-ebeln (Purshasing Doc) but in separate column not at the end of the line items of each purshasing doc
any idea how can i do this?
let us say i have the following cols in my report:
ekko-bukrs
ekko-ebeln,
ekko-aedat,
kko-lifnr,
ekpo-brtwr
i want to add one more col for example (T-Gross) and to fill it with the suptotals of (ekpo-brtwr) sorted by the
ekko-ebeln (Purshasing Doc).
thanks a lot.If you need one more column, then you need to expand the field catalog table and data table as you did for all other fields and you need to code the logic to calculate the subtotals and populate the new column, but if you want to have row, that will be easy. For more info you can [refer |http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4063c42a-2549-2c10-fab6-a8c99d98b9b5?quicklink=index&overridelayout=true]this:
-
Subtotals and Totals In ALV Report
Hi Experts,
I have a problem in my current scenario,
I have 3 fields,
KUNNR, WAERS, DMBTR.
000001 USD 100.00
000001 USD 200.00
000002 USD 100.00
000002 USD 400.00
000002 EUR 300.00
000002 EUR 100.00
The above mentioned is the data I have in my internal table & in my ALV report as well, Which is fine...!
Now I need Subtotals for each customer,
Means for customer 000001 The subtotal is 300 (USD)
Means for customer 000002 The subtotal is 500 (USD)
Means for customer 000002 The subtotal is 400 (EUR)
At the end I need grand totals.
USD 800
EUR 400.
Currently My field catalog is given below.
FIELDCATALOG-COL_POS = COL_POS.
FIELDCATALOG-FIELDNAME = 'DMBTR'.
FIELDCATALOG-SELTEXT_M = TEXT-106.
FIELDCATALOG-DO_SUM = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
what else I need to do for getting individual subtotals by currency and customers.
Thanks & regards,
Dileep .CHi Deelip,
FOR TOTAL:
there is a property of fieldcatalog, that is do_sum.
USE COED LIKE:
PERFORM fieldcat USING:
'1' 'KUNNR' 'I_MARD' 'CUSTOMER NO' ,
'2' 'DMBTR' 'I_MARD' 'CURRENCY' ,
FORM fieldcat USING value(p_0029)
value(p_0030)
value(p_0031)
value(p_0032)
wa_fieldcat-col_pos = p_0029.
wa_fieldcat-fieldname = p_0030.
wa_fieldcat-tabname = p_0031.
wa_fieldcat-reptext = p_0032.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " FIELDCAT
in final output you will get the total of currency field.
FOR SUB TOTAL:
decleare: i_sort type standard table of slis_sortinfo_alv,
wa_sort type slis_t_sortinfo_alv.
wa_sort-spos = '1'.
wa_sort-fieldname = 'KUNNR'.
wa_sort-tablename = 'i_final'
wa_sort-up = 'x'
wa_sort-subtot = 'X'.
wa_sort-spos = '2'.
wa_sort-fieldname = 'WAERS'.
wa_sort-tablename = 'i_final'
wa_sort-up = 'x'
wa_sort-subtot = 'X'.
append wa_tab to i_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
it_sort = i_sort
Hope this can solve your pbs.
Regards,
Tutun -
How to display subtotals in separate column in alv report?
hi,
I am displayed the subtotals for QUantity field BDMNG in Reuse_alv_grid_display in the same column.
but I want to display subtotal in separate column.
How to display subtotals in separate column in alv report?
thanks®ards.
samba.kHi
As far as i know you can't do this,the option you have is to create one more column (subtotal) and populate it by manual calculation at every subtotal (not alv subtotal but yours) .
Best Regards
Yossi -
Adding/Enabling Totals & Subtotals Button in ALV Report Output
Hi Guys,
I would like to know , how to add / enable Totals & Subtotals Button on the application tool bar in alv report output.
Regards,
Kishanok so here i am sending my code....its also interactive...
and in second list i am displaying quantity....
*& Report ZINT_ALV
REPORT zint_alv.
TYPE-POOLS:slis.
TABLES:mara,
makt,
mseg.
DATA:BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF itab.
DATA:BEGIN OF itab1 OCCURS 0,
mblnr LIKE mseg-mblnr,
menge LIKE mseg-menge,
meins LIKE mseg-meins,
werks LIKE mseg-werks,
END OF itab1.
DATA:fcat TYPE slis_t_fieldcat_alv,
fcat1 TYPE slis_t_fieldcat_alv,
eve TYPE slis_t_event,
eve1 TYPE slis_t_event.
DATA:t_mat LIKE mara-matnr,
s_mat LIKE mara-matnr,
g_repid LIKE sy-repid.
SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:mat FOR mara-matnr OBLIGATORY.
SELECTION-SCREEN:END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_fcat USING fcat.
PERFORM build_eve.
START-OF-SELECTION.
PERFORM get_data.
PERFORM dis_data.
*& Form build_fcat
text
-->T_FCAT text
FORM build_fcat USING t_fcat TYPE slis_t_fieldcat_alv.
DATA:wa_fcat TYPE slis_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-ref_fieldname = 'MATNR'.
wa_fcat-ref_tabname = 'MARA'.
wa_fcat-seltext_m = 'Material'.
wa_fcat-input = ' '.
wa_fcat-edit = 'X'.
wa_fcat-input = 'X'.
APPEND wa_fcat TO t_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MAKTX'.
wa_fcat-seltext_m = 'Description'.
APPEND wa_fcat TO t_fcat.
CLEAR wa_fcat.
ENDFORM. "build_fcat
*& Form build_eve
text
FORM build_eve.
DATA:t_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = 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.
ENDFORM. "build_eve
*& Form get_data
text
FORM get_data.
SELECT maramatnr maktmaktx INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara INNER JOIN makt
ON maramatnr = maktmatnr
WHERE mara~matnr IN mat.
ENDFORM. "get_data
*& Form dis_data
text
FORM dis_data.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid "'ZINT_ALV'
i_callback_user_command = 'USER_COMMAND'
i_grid_title = 'Interactive ALV'
it_fieldcat = fcat
it_events = eve
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. "dis_data
*& Form user_command
text
-->U_COM text
FORM user_command USING u_com LIKE sy-ucomm sel_field TYPE slis_selfield.
CLEAR fcat1.
CASE u_com.
WHEN '&IC1'.
READ TABLE itab INDEX sel_field-tabindex.
IF sel_field-fieldname = 'MATNR'.
IF sy-subrc = 0.
t_mat = itab-matnr.
PERFORM build_cat1 USING fcat1.
PERFORM build_eve1.
PERFORM get_data1.
PERFORM dis_data1.
ENDIF.
ENDIF.
SET PARAMETER ID 'MAT' FIELD t_mat.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "user_command
*& Form build_fcat1
text
-->T_FCAT1 text
FORM build_cat1 USING t_fcat1 TYPE slis_t_fieldcat_alv.
DATA:wa_fcat1 TYPE slis_fieldcat_alv.
wa_fcat1-tabname = 'ITAB1'.
wa_fcat1-fieldname = 'MBLNR'.
wa_fcat1-seltext_m = 'Material Doc.'.
APPEND wa_fcat1 TO t_fcat1.
CLEAR wa_fcat1.
wa_fcat1-tabname = 'ITAB1'.
wa_fcat1-fieldname = 'MENGE'.
wa_fcat1-seltext_m = 'Quantity'.
APPEND wa_fcat1 TO t_fcat1.
CLEAR wa_fcat1.
wa_fcat1-tabname = 'ITAB1'.
wa_fcat1-fieldname = 'MEINS'.
wa_fcat1-seltext_m = 'UOM'.
APPEND wa_fcat1 TO t_fcat1.
CLEAR wa_fcat1.
wa_fcat1-tabname = 'ITAB1'.
wa_fcat1-fieldname = 'WERKS'.
wa_fcat1-seltext_m = 'Plant'.
APPEND wa_fcat1 TO t_fcat1.
CLEAR wa_fcat1.
ENDFORM. "build_fcat1
*& Form build_eve1
text
FORM build_eve1.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = eve1
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.
ENDFORM. "build_eve1
*& Form get_data1
text
FORM get_data1.
SELECT mblnr menge meins werks FROM mseg
INTO CORRESPONDING FIELDS OF TABLE itab1
WHERE matnr = t_mat.
ENDFORM. "get_data1
*& Form dis_data1
text
FORM dis_data1.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid "'ZINT_ALV'
i_callback_user_command = 'USER_COMMAND1'
it_fieldcat = fcat1
it_events = eve1
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. "dis_data1 -
Clear the values in the ALV report after calculating Subtotals
Hi All,
In my ALV report, I am displaying subtotals by passing DO_SUM in the Field Catalog.
Now my problem is in the display I do not want the individual values to be displayed, I want to hide the values in the column(Not the whole column) but I want to display the subtotal of these values in the Subtotal Row.
Example:
Item1 10 20
Item2 20 30
Item3 10 50
40 100
As per our requirements, the output should be
Item1
Item2
Item3
40 100
How can this be done? Please suggest.Populate i_sort table for the fields for which u want subtotal as shown below:
*& Form sub_populate_sort
Populate ALV sort table
No Parameter
FORM sub_populate_sort .
Sort on material
wa_sort-spos = '01' .
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
Sort on plant
wa_sort-spos = '02'.
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
ENDFORM. " sub_populate_sort
Then when populating the field catalog tables use:
wa_lfl_fcat-no_out = 'X'. "No output
Then display ur data:
This function module for displaying the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_top_of_page = 'SUB_ALV_TOP_OF_PAGE'
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_sort = i_sort
it_events = i_event
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = i_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
Regards,
Joy. -
Adding new rows after displaying subtotals in an ALV report by using OOABAP
Dear All,
I am creating an ALV report, displaying subtotals and total by using Classes. I have used classes CL_SALV_AGGREGATIONS (Method : add_aggregation) and CL_SALV_AGGREGATIONS (Method : add_sort) for sorting and doing subtotals.
Output of my report as follows :- (I have used * for displaying spaces between fields)
Materia*******Quantity**SerialNo*Equipment**Value***WBS Element
ISM-DBSVR****1********12363****31872565***2165***Q-0040358945.001010
ISM-DBSVR****1********12364****31872566***2165***Q-0040358945.001010
**************************************Subtotal***********4330
-> If the value of "Quantity" is greater than 1 then the value of subtotal for the field "Value" is to be divided by the Quantity for that line item and needs to be displayed Quantity, SerialNo, Value details information after subtotal .
-> Basically I need to add few more rows for displaying above additional information in the ALV grid after displaying subtotal .
Q: Do we have any methods for change the layout for the above requirement.
I Appreciate your early response.
Thank you.
RajaSekhar.Hi,
For such type of requirement you need to use ALV hierchical table.
You can have your main table in master table.
For quantity greater than 1 you need to move the data into a seperate internal table....this internal table will have material as the key between the main table and the second table.
*... §2 create an ALV hierseq table
try.
cl_salv_hierseq_table=>factory(
exporting
t_binding_level1_level2 = lt_binding
importing
r_hierseq = gr_hierseq
changing
t_table_level1 = gt_master
t_table_level2 = gt_slave ).
catch cx_salv_data_error cx_salv_not_found.
endtry.
you can display both the tables together with the subtotals also.
please refer to program SALV_DEMO_HIERSEQ_SIMPLE to see how to display the hierarchical display.
Plr reward points if found helpful.
Regards,
Mayank -
Regd: Calculation of TOTAL field in ALV report
Hi All,
We have a scenario that we are not getting the total value for numeric fields in ALV report.
Below i have given the code used for it.
G_KEY = 'X'.
G_NOKEY = SPACE.
G_SUM = 'X'.
G_NOSUM = SPACE.
PERFORM BUILD_FIELDCAT USING 'VBELN' G_KEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'BLDAT' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'VGBEL' G_KEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'POSNR' G_KEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'MATNR' G_KEY G_NOSUM..
PERFORM BUILD_FIELDCAT USING 'LFIMG' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'VRKME' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'NETPR' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'BRTWR' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'VALUE_INR' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'B_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'S_TOTAL1' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'CV_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'C_CVD' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'S_TOTAL2' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'C_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'S_TOTAL3' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'A_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'T_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_LAYOUT.
PERFORM BUILD_DISPLAY.
*& Form DISPLAY
text
FORM BUILD_DISPLAY.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = TEXT-000
I_GRID_SETTINGS =
IS_LAYOUT = IG_LAYOUT
IT_FIELDCAT = IG_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
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 = IG_INBOUND
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 BUILD_FIELDCAT
text
-->G_FIELDNAME text
-->L_KEY text
-->L_SUM text
FORM BUILD_FIELDCAT USING L_FIELDNAME LIKE DD03L-FIELDNAME L_KEY TYPE C L_SUM TYPE C.
CLEAR WG_FIELDCAT_LN.
ADD 1 TO G_COL_POS.
WG_FIELDCAT_LN-REF_TABNAME = 'IG_INBOUND'.
WG_FIELDCAT_LN-FIELDNAME = L_FIELDNAME.
WG_FIELDCAT_LN-KEY = L_KEY.
WG_FIELDCAT_LN-DO_SUM = L_SUM.
WG_FIELDCAT_LN-COL_POS = G_COL_POS.
WG_FIELDCAT_LN-NO_OUT = SPACE.
WG_FIELDCAT_LN-QFIELDNAME = SPACE.
WG_FIELDCAT_LN-HOTSPOT = SPACE.
APPEND WG_FIELDCAT_LN TO IG_FIELDCAT.
ENDFORM. "BUILD_FIELDCAT
*& Form BUILD_LAYOUT
text
FORM BUILD_LAYOUT.
IG_LAYOUT-TOTALS_TEXT = 'Total Amount'.
*IG_LAYOUT-SUBTOTALS_TEXT = 'A'.
IG_LAYOUT-ZEBRA = 'X'.
ENDFORM.
Help and Sugesstions will be much appreciated.
Thanks & Regds.
Ramesh.This is sample program for the same
REPORT Z_50657_ALV_EX2
NO STANDARD PAGE HEADING
LINE-COUNT 65(3)
LINE-SIZE 220
MESSAGE-ID ZZ.
* Type Pools *
TYPE-POOLS: SLIS, ICON.
* Tables *
TABLES: VBAK. "Sales Document Data
* Internal Tables *
* TABLE TO HOLD DATA OF SALES DOCUMENT
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN, "Sales Document
VBTYP LIKE VBAK-VBTYP, "SD document category
AUDAT LIKE VBAK-AUDAT, "Document date (date received/sent)
AUGRU LIKE VBAK-AUGRU, "Order reason (reason for the business)
AUART LIKE VBAK-AUART, "Sales Document Type
NETWR LIKE VBAK-NETWR, "Net Sales Order in Doc. Currency
WAERK LIKE VBAK-WAERK, "SD document currency
ICON TYPE ICON-ID, "traffic lights
END OF IT_VBAK.
* Work Areas *
*WORK AREAS DEFINED FOR ALV'S
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV, "field catalog
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "field catalog ITAB
WA_SORT TYPE SLIS_SORTINFO_ALV, "SORT work area
IT_SORT TYPE SLIS_T_SORTINFO_ALV, "SORT ITAB
LAYOUT TYPE SLIS_LAYOUT_ALV, "LAYOUT
WA_FCODE TYPE SLIS_EXTAB, "FUN CODE
I_FCODE_EXTAB TYPE SLIS_T_EXTAB,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
* Selection-Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: LIST RADIOBUTTON GROUP G1,
GRID RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
* At Selection-Screen *
*VALIDATION
* Start of Selection *
START-OF-SELECTION.
*POPULATION OF DATA INTO INTERNAL TABLE ITAB
PERFORM GET_DATA.
*DEFINE USER DEFINED FIELDCATALOG
PERFORM DEFINE_FIELDCATALOG.
*SUBTOTALS AND TOTALS DISPLAY USING SORT
PERFORM SORT_LIST.
*CHANGE FCODE OF STATUS
PERFORM CHANGE_FCODE.
*CHECK RADIOBUTTON OPTION AND ACCORDINGLY FINAL DISPLAY
PERFORM CHECK_OPTION.
*& Form GET_DATA
* text
FORM GET_DATA.
SELECT VBELN
VBTYP
AUDAT
AUGRU
AUART
NETWR
WAERK FROM VBAK INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN AND VBTYP = P_VBTYP
AND ERDAT > '01.01.2004' AND NETWR > 0.
LOOP AT IT_VBAK.
IF IT_VBAK-NETWR < 10000.
IT_VBAK-ICON = '@08@'.
ELSEIF IT_VBAK-NETWR > 100000.
IT_VBAK-ICON = '@0A@'.
ELSE.
IT_VBAK-ICON = '@09@'.
ENDIF.
MODIFY IT_VBAK INDEX SY-TABIX.
ENDLOOP.
ENDFORM. "GET_DATA
*& Form CHECK_OPTION
* text
FORM CHECK_OPTION.
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'TOP'.
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
WA_EVENTS-NAME = 'END_OF_LIST'.
WA_EVENTS-FORM = 'END_LIST'.
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
IF LIST = 'X'.
PERFORM LIST_DISP.
ENDIF.
IF GRID = 'X'.
PERFORM GRID_DISP.
ENDIF.
ENDFORM. "CHECK_OPTION
*& Form DEFINE_FIELDCATALOG
* text
FORM DEFINE_FIELDCATALOG.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-FIELDNAME = 'ICON'.
WA_FIELDCAT-SELTEXT_L = 'ICON'.
WA_FIELDCAT-ICON = 'X'.
WA_FIELDCAT-OUTPUTLEN = 8.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_L = 'SALES DOC NO.'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-FIELDNAME = 'AUDAT'.
WA_FIELDCAT-SELTEXT_L = 'CREATED ON'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-FIELDNAME = 'VBTYP'.
WA_FIELDCAT-SELTEXT_L = 'CATEGORY'.
WA_FIELDCAT-OUTPUTLEN = 1.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 6.
WA_FIELDCAT-FIELDNAME = 'AUGRU'.
WA_FIELDCAT-SELTEXT_L = 'REASON'.
WA_FIELDCAT-OUTPUTLEN = 3.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-FIELDNAME = 'AUART'.
WA_FIELDCAT-SELTEXT_L = 'DOC TYPE'.
WA_FIELDCAT-OUTPUTLEN = 4.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 7.
WA_FIELDCAT-FIELDNAME = 'NETWR'.
WA_FIELDCAT-SELTEXT_L = 'NET VALUE'.
WA_FIELDCAT-OUTPUTLEN = 17.
WA_FIELDCAT-DECIMALS_OUT = 2.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 8.
WA_FIELDCAT-FIELDNAME = 'WAERK'.
WA_FIELDCAT-SELTEXT_L = 'UNIT'.
WA_FIELDCAT-OUTPUTLEN = 50.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "DEFINE_FIELDCATALOG
*& Form DEFINE_LAYOUT
* text
FORM DEFINE_LAYOUT.
LAYOUT-ZEBRA = 'X'.
LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL SUM'.
LAYOUT-WINDOW_TITLEBAR = 'EXERCISE 2'.
LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. "DEFINE_LAYOUT
*& Form SORT_LIST
* text
FORM SORT_LIST.
WA_SORT-FIELDNAME = 'VBELN'.
WA_SORT-TABNAME = 'IT_VBAK'.
WA_SORT-SPOS = 1.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'NETWR'.
WA_SORT-TABNAME = 'IT_VBAK'.
WA_SORT-UP = 'X'.
WA_SORT-SPOS = 2.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
ENDFORM. "SORT_LIST
*& Form LIST_DISP
* text
FORM LIST_DISP.
PERFORM DEFINE_LAYOUT.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT
IS_LAYOUT = LAYOUT
IT_SORT = IT_SORT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
IT_EXCLUDING = I_FCODE_EXTAB
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EVENTS = IT_EVENTS[]
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBAK
* 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. "LIST_DISP
*& Form GRID_DISP
* text
FORM GRID_DISP.
PERFORM DEFINE_LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_SORT = IT_SORT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
IT_EXCLUDING = I_FCODE_EXTAB
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EVENTS = IT_EVENTS[]
TABLES
T_OUTTAB = IT_VBAK.
* 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. "GRID_DISP
*& Form STATUS
* text
* -->P_EXTAB text
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.
ENDFORM. "STATUS
*& 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.
WHEN 'BACK' OR 'CANC' OR 'EXIT'.
LEAVE TO SCREEN 0.
WHEN '&IC1'.
SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form CHANGE_FCODE
* text
FORM CHANGE_FCODE.
WA_FCODE = 'PRNT'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&OAD'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&AVE'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&EB9'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&SUM'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&UMC'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&XPA'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&OMP'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
ENDFORM. "CHANGE_FCODE
*& Form TOP
* text
FORM TOP.
IF LIST = 'X'.
WRITE:/ SY-ULINE.
WRITE:/ 'DATE:', SY-DATUM,55 'INTELLIGROUP ASIA PVT LTD'.
WRITE:/ 'TIME:', SY-UZEIT.
WRITE:/ 'USER NAME:', SY-UNAME,60 SY-TITLE.
WRITE:/ 'PAGE', SY-PAGNO.
WRITE:/ SY-ULINE.
ENDIF.
IF GRID = 'X'.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
* Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Summary'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
* Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Intelligroup'.
LS_LINE-INFO = ''.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
LS_LINE-KEY = 'ASIA'.
LS_LINE-INFO = 'PVT LTD'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
* Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'truman'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = E04_LT_TOP_OF_PAGE
I_LOGO = 'ENJOY_SAP_LOGO'.
ENDIF.
ENDFORM. "TOP
*& Form END_LIST
* text
FORM END_LIST.
IF LIST = 'X'.
SKIP 2.
WRITE:/60 'END OF PAGE'.
ENDIF.
IF GRID = 'X'.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
E04_LT_END_OF_LIST TYPE SLIS_T_LISTHEADER.
* Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Summary'.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
* Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Intelligroup'.
LS_LINE-INFO = ''.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
LS_LINE-KEY = 'ASIA'.
LS_LINE-INFO = 'PVT LTD'.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
* Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = TEXT-105.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = E04_LT_END_OF_LIST.
ENDIF.
ENDFORM. "END_LIST -
hi ,
i need to find subtotals in alv
Please suggest me on how to proceed on this.
Any sample code would be appreciated.
thanks n regards,
kalyanHi Kalyan,
Try this sample code. It may help you.
the code below produces alv display with 2 columns: field1 & field2.
field1 is character based & the int. table passed to the alv is sorted on this field.
field2 is numeric, whose subtotals are desired.
so while populating the gt_sort table the option gs_sort-subtot is set for field1 bcoz the subtotals are to be based on the groups existing in this column.whereas the same option is NOT set for field2, even though the subtotal appears in that column.i have marked these 2 statements in the code for your convenience.
execute the code below & you will surely understand what i said above.
bye!!
report zalv10.
type-pools: slis.
data: g_repid like sy-repid,
gs_print type slis_print_alv,
gt_list_top_of_page type slis_t_listheader,
gt_events type slis_t_event,
gt_sort type slis_t_sortinfo_alv,
gs_layout type slis_layout_alv,
gt_fieldcat type slis_t_fieldcat_alv,
fieldcat_ln like line of gt_fieldcat,
col_pos type i.
data: begin of itab,
field1(5) type c,
field2(5) type c,
field3(5) type p decimals 2,
end of itab.
data: begin of itab1 occurs 0.
include structure itab.
data: end of itab1.
data: begin of itab_fieldcat occurs 0.
include structure itab.
data: end of itab_fieldcat.
Print Parameters
parameters:
p_print as checkbox default ' ', "PRINT IMMEDIATE
p_nosinf as checkbox default 'X', "NO SELECTION INFO
p_nocove as checkbox default ' ', "NO COVER PAGE
p_nonewp as checkbox default ' ', "NO NEW PAGE
p_nolinf as checkbox default 'X', "NO PRINT LIST INFO
p_reserv type i. "NO OF FOOTER LINE
initialization.
g_repid = sy-repid.
perform print_build using gs_print. "Print PARAMETERS
start-of-selection.
TEST DATA
move 'TEST1' to itab1-field1.
move 'TEST1' to itab1-field2.
move '10.00' to itab1-field3.
append itab1.
move 'TEST2' to itab1-field1.
move 'TEST2' to itab1-field2.
move '20.00' to itab1-field3.
append itab1.
do 50 times.
append itab1.
enddo.
end-of-selection.
perform build.
perform eventtab_build changing gt_events.
perform comment_build changing gt_list_top_of_page.
perform call_alv.
form build.
DATA FIELD CATALOG
Explain Field Description to ALV
data: fieldcat_in type slis_fieldcat_alv.
clear fieldcat_in.
fieldcat_ln-fieldname = 'FIELD1'.
fieldcat_ln-tabname = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
fieldcat_ln-key = ' '. "SUBTOTAL KEY
fieldcat_ln-no_out = ' '.
fieldcat_ln-seltext_l = 'HEAD1'.
append fieldcat_ln to gt_fieldcat.
clear fieldcat_in.
fieldcat_ln-fieldname = 'FIELD2'.
fieldcat_ln-tabname = 'ITAB1'.
fieldcat_ln-no_out = 'X'.
fieldcat_ln-seltext_l = 'HEAD2'.
append fieldcat_ln to gt_fieldcat.
clear fieldcat_in.
fieldcat_ln-fieldname = 'FIELD3'.
fieldcat_ln-tabname = 'ITAB1'.
fieldcat_ln-ref_fieldname = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
fieldcat_ln-ref_tabname = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
fieldcat_ln-no_out = ' '.
fieldcat_ln-do_sum = 'X'. "SUM UPON DISPLAY
append fieldcat_ln to gt_fieldcat.
DATA SORTING AND SUBTOTAL
data: gs_sort type slis_sortinfo_alv.
clear gs_sort.
gs_sort-fieldname = 'FIELD1'.
gs_sort-spos = 1.
gs_sort-up = 'X'.
gs_sort-subtot = 'X'.
***CRUCIAL STATEMENT****
append gs_sort to gt_sort.
clear gs_sort.
gs_sort-fieldname = 'FIELD2'.
gs_sort-spos = 2.
gs_sort-up = 'X'.
*GS_SORT-SUBTOT = 'X'. **THIS SHOULD NOT BE UNCOMENTED*
append gs_sort to gt_sort.
endform.
form call_alv.
ABAP List Viewer
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = g_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_structure_name = 'ITAB1'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = gt_sort[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = gt_events[]
IT_EVENT_EXIT =
is_print = gs_print
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = itab1
exceptions
program_error = 1
others = 2.
endform.
HEADER FORM
form eventtab_build changing lt_events type slis_t_event.
constants:
gc_formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = lt_events.
read table lt_events with key name = slis_ev_top_of_page
into ls_event.
if sy-subrc = 0.
move gc_formname_top_of_page to ls_event-form.
append ls_event to lt_events.
endif.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
endform.
form comment_build changing gt_top_of_page type slis_t_listheader.
data: gs_line type slis_listheader.
clear gs_line.
gs_line-typ = 'H'.
gs_line-info = 'HEADER 1'.
append gs_line to gt_top_of_page.
clear gs_line.
gs_line-typ = 'S'.
gs_line-key = 'STATUS 1'.
gs_line-info = 'INFO 1'.
append gs_line to gt_top_of_page.
gs_line-key = 'STATUS 2'.
gs_line-info = 'INFO 2'.
append gs_line to gt_top_of_page.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
endform.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = gt_list_top_of_page.
write: sy-datum, 'Page No', sy-pagno left-justified.
endform.
form end_of_page.
write at (sy-linsz) sy-pagno centered.
endform.
PRINT SETTINGS
form print_build using ls_print type slis_print_alv.
ls_print-print = p_print. "PRINT IMMEDIATE
ls_print-no_print_selinfos = p_nosinf. "NO SELECTION INFO
ls_print-no_coverpage = p_nocove. "NO COVER PAGE
ls_print-no_new_page = p_nonewp.
ls_print-no_print_listinfos = p_nolinf. "NO PRINT LIST INFO
ls_print-reserve_lines = p_reserv.
endform. -
How to calculate totals in Blocked ALV Report
Hi All,
Can any body tell how to calculate totals & sub totals in
Blocked ALV Report[Blocked List].
Thanks in advance
Thanks & Regards,
Rayeezuddin.read this it might help
Sums
15. No_sumchoice(1) TYPE c : This parameter allows the choice for summing up
Only by fieldcatalog.
Value set: SPACE, 'X'
'X' = fields which are to be summed, passed by the calling program (FIELDCAT-DO_SUM = 'X'). The user should not be able to change this value interactively.
16. No_totalline(1) TYPE c : Removes the option of having totals after sub-totals.
Value set: SPACE, 'X'
'X' = no total record is to be output. Subtotals can still be calculated and output. The fields in the subtotals are flagged DO_SUM = 'X' in the field list.
17. No_subchoice(1) TYPE c : Does not allow the user to interactively change the field chosen for subtotals.
Value set: SPACE, 'X'
'X' = value whose change triggers subtotals, provided by the calling program. The user should not be able to change this value interactively.
18. No_subtotals(1) TYPE c : No subtotals possible
Value set: SPACE, 'X'
'X' = no subtotals.
19. Numc_sum(1) TYPE c : Totals only possible for NUMC-Fields.
20. No_unit_splitting TYPE c: No separate total lines by inh.units
21.totals_before_items TYPE c: Display totals before the items
22. Totals_only(1) TYPE c : Show only totals
Value set: SPACE, 'X'
'X' = only total records are output.
23. Totals_text(60) TYPE c : Text for 1st col. in totals
Value set: SPACE, string (max.60)
' ' = The first column in the total record contains an appropriate number of '*'s to indicate the total by default. If the first column is wide enough, the string 'Total' is output after the asterisks.
'String = The string passed is output after the total indicated by '*', if the column is wide enough.
24. Subtotals_text(60) TYPE c : Texts for subtotals
Value set: SPACE, string (max.60)
' ' = In the first column of subtotal records, the subtotal is indicated by an appropriate number of '*' by default. If the first column is not a subtotal criterion, the string 'Total' is output after the asterisks, if the column is wide enough.
'String = the string passed is output after the subtotal indicated by '*', if the column is wide enough and the first column is not a subtotal criterion. If it is a subtotal criterion, its value is repeated after the total, if the column is wide enough.
ELSE TELL ME I WILL PASTE COMPLETE HELP
regards -
Summing up a Column in ALV report
Hi All,
I have developed an ALV Report which will display Invoices and other details.
Now i need to display the sum of NETWR column, if user wish to select that column and click the "SUM" icon.
As of now, if i select the NETWR column and click 'SUM" column, i am getting Runtime error.
How to resolve this issue?
Regards
PavanHi Pavan,
ALV GRID CONTROL:
This task is performed by the SAP Control Framework.
The R/3 System allows you to create custom controls using ABAP Objects. The application server is the Automation Client, which drives the custom controls (automation server) at the front end.
If custom controls are to be included on the frontend, then the SAPGUI acts as a container for them.
Custom controls can be ActiveX Controls or JavaBeans.
The system has to use a Remote Function Call (RFC) to transfer methods for creating and using a control to the front end.
ABAP objects are used to implement the controls in programs.
An SAP Container can contain other controls (for example, SAP ALV Grid Control, Tree Control, SAP Picture Control, SAP Splitter Control, and so on). It administers these controls logically in one collection and provides a physical area for the display.
Every control exists in a container. Since containers are themselves controls, they can be nested within one another. The container becomes the parent of its control. SAP containers are divided into five groups:
SAP custom container: Displays within an area defined in Screen Painter on screens or sub screens.
Class: CL_GUI_CUSTOM_CONTAINER
SAP dialog box container: Displays in a modeless dialog box or as a full screen. Class:
CL_GUI_DIALOGBOX_CONTAINER
SAP docking container: Displays as docked, resizable sub-window with the option of displaying it as a modeless dialog box. Class: CL_GUI_DOCKING_CONTAINER
SAP splitter container: Displays and groups several controls in one area - that is, splits the area into cells Class: CL_GUI_SPLITTER_CONTAINER
SAP easy splitter container: Displays controls in two cells, which the user can resize using a split bar. Class: CL_GUI_EASY_SPLITTER_CONTAINER.
In the control, you can adjust the column width by dragging, or use the 'Optimum width' function to adjust the column width to the data currently displayed. You can also change the column sequence by selecting a column and dragging it to a new position.
Standard functions are available in the control toolbar. The details display displays the fields in the line on which the cursor is positioned in a modal dialog box.
The sort function in the ALV Control is available for as many columns as required. You can set complex sort criteria and sort columns in either ascending or descending order.
You can use the 'Search' function to search for a string (generic search without *) within a selected area by line or column.
You can use the 'Sum' function to create totals for one or more numeric columns. You can then use the "Subtotals" function to set up control level lists: You can use the 'Subtotal' function to structure control level lists: select the columns (non-numeric columns only) that you want to use and the corresponding control level totals are displayed.
For 'Print' and 'Download' the whole list is always processed, not just the sections displayed on the screen.
You can define display variants to meet your own specific requirements. For information on saving variants, see 'Advanced Techniques'.
The ALV grid control is a generic tool for displaying lists in screens. The control offers standard functions such as sorting by any column, adding numeric columns, and fixed lead columns .
Data collection is performed in the program (with SELECT statements, for example) or by using a logical database. The data records are saved in an internal table and passed on to the ALV control along with a field description.
The field description contains information about the characteristics of each column, such as the column header and output length. This information can defined either globally in the Dictionary (structure in the Dictionary) or in the field catalog in the program itself. You can also merge both techniques.
The ALV link is a standard function of Query and QuickViewer. If multiline queries or Quick View lists have been defined, they will automatically be compressed to a single line and output in the ALV control as a long, single line list.
Use Screen Painter to create a sub screen container for the ALV grid control. The control requires an area where it can be displayed in the screen. You have to create a container control that determines this area.
Use the corresponding icon in the Screen Painter layout to create the container control. The size of area "MY_CONTROL_AREA" determines the subsequent size of the ALV control.
The valid GUI status must be set at the PBO event in the flow logic of the ALV subscreen container.
The OK_CODE processing for the cancel functions must be programmed at the PAI event.
The reference variables for the custom container and the ALV grid control must be declared.
To create reference variables, use ABAP statement TYPE REF TO .
The global classes you need to do this are called cl_gui_custom_container (for the custom container control) and cl_gui_alv_grid (for the ALV grid control).
The global classes are defined in the Class Builder. You can use the Class Builder to display information for the methods, their parameters, exceptions, and so on.
Use ABAP statement CREATE OBJECT to create the objects for the container and the ALV control. Objects Are instances of a class.
When an object is created (CREATE), method CONSTRUCTOR of the corresponding class is executed. The parameters of method CONSTRUCTOR determine which parameters have to be supplied with data when the object is created. In the above example, object alv_grid is given the name of the container control (g_custom_container) in exporting parameter i_parent, which links the two controls. For information on which parameters method CONSTRUCTOR possesses and which of these parameters are required, see the Class Builder.
Objects should only be created once during the program. To ensure that this is the case, enclose the CREATE OBJECT statement(s) in an IF IS INITIAL. ... ENDIF clause. The objects must be generated before the control is displayed for the first time - that is, during the PBO event of the ALV subscreen container.
To display the requested dataset in the ALV control, the data must be passed on to the control as an internal table, and a field description must exist indicating the order in which the columns will be output.
In the simplest case, the field description can use a structure from the Dictionary. The Dictionary also determines the technical field attributes like type and length, as well as the semantic attributes like short and long texts. The ALV control uses this information to determine the column widths and headers. The column sequence is determined by the field sequence in the structure.
If no suitable structure is active in the Dictionary, or you want to output internal program fields in the control, then you will have to define information like the output length and column header in the field catalog.
In a typical program run, the dataset is read first (SELECT ....), the internal table is filled with the data to display (... INTO TABLE ...), and ABAP statement CALL SCREEN is then used to call the ALV sub screen container.
The data transfer to the ALV control takes place during the call of method
set_table_for_first_display from class cl_gui_alv_grid. The method call must be programmed at the PBO event of the ALV subscreen container.
The name of the Dictionary structure that supplies the field description is specified in exporting parameter i_structure_name. The name of the internal table that contains the data records to display is specified in changing parameter it_outtab.
The field description for the ALV control can be ta ken from an active Dictionary structure (fully automatic), by passing a field catalog (manual), or through a mixture of the two options (merge).
The field catalog is in internal table with type lvc_t_fcat. This type is defined globally in the Dictionary.
Each line in the field catalog table corresponds to a column in the ALV control.
The field characteristics (= column characteristics) are defined in the field catalog. The field catalog is in internal table with type lvc_t_fcat. Each line that is explicitly described in the ALV control corresponds to a column in the field catalog table.
The link to the data records to output that are saved in internal table is established through field name . This name must be specified in column "fieldname" in the field catalog.
This field can be classified through a Dictionary reference (ref_table and ref_field) or by specifying an ABAP data type (inttype).
Column headers and field names in the detail view of an ALV control line can be determined in the field catalog in coltext and seltext, respectively.
The position of a field during output can be determined with col_pos in the field catalog.
If you want to hide a column, fill field no_out with an "X" in the field catalog. Hidden fields can be displayed again in a user display variant.
Icons can be displayed in the ALV control. If you want a column to be interpreted as an icon, then the icon name must be known to the program (include .) and icon = "X" must be specified for this column in the field catalog.
The above example shows a semi-automatic field description: Part of the field description comes from the Dictionary structure (sflight), while another part is explicitly defined in the field catalog (gt_fieldcat).
The field catalog (internal table) is filled in the program and is passed on together with the name of the Dictionary structure during the method call. The information is merged accordingly in method set_table_for_first_display.
For a user to save display variants, parameters is_variant and i_save must be passed on during method call set_table_for_first_screen. To assign display variants uniquely to a program, at least the program name must be supplied in the transferred structure (gs_variant).
Program names can be up to 30 characters long.
If you only pass on the current parameters for is_variant, then existing variants can be loaded, but no new ones can be saved. If you use parameter i_save, you must pass on a variant structure with is_variant.
I_SAVE = SPACE No variants can be saved.
I_SAVE = 'U' The user can only save user-specific variants.
I_SAVE = 'X' The user can only save general (shared) variants.
I_SAVE = 'A' The user can save both user-specific and general (shared) variants.
You can use parameter is_layout of method set_table_for_first_display, for example, to define the header in the ALV control and the detail display.
To do this, define a query area in the program in accordance with Dictionary structure lvc_s_layo, and pass on the text to display in field -grid_title or -detailtitl.
If you want to create print lists with zebra stripes, set field -zebra to "X". You can display a print preview for print lists by requesting standard function "Print".
All parameters of method SET_TABLE_FOR_FIRST_DISPLAY from global class
CL_GUI_ALV_GRID are defined in the Class Builder.
Events are defined in global class cl_gui_alv_grid; you can use these events to implement user interaction within the program. To respond to a double -click on a table line, you must respond to event DOUBLE_CLICK.
You receive control in the program, allowing you to implement interactive reporting - such as a full screen details list. The events for cl_gui_alv_grid are located in the Class Builder.
To define an implement a local class in the program, you use a handler method. In this handler method, you program the functionality to trigger by a double -click in the output table.
To activate a handler method at runtime, a class or an object from that class registers itself with an event using command SET HANDLER. The names of the IMPORTING parameters in the handler method correspond to the names of the EXPORTING parameters of the related event.
In the above example, the local class is LCL_ILS and the handler method is ON_DBLCLICK. An object - ALV_DBLCLICK - is created and registers itself for event DOUBLE_CLICK.
You can query parameter e_row-index to determine which output line was requested by the double -click. This parameter corresponds to the line number of the output table (internal table with the data records to output). If you need information for the selected line, you have to read it with READ TABLE itab INDEX e_row-index.
This subsequent read in the output table generally corresponds to the HIDE area in conventional reporting. You first have to make sure that the user has double -clicked a line in the output table (similar to the valid line selection with the HIDE technique).
A field group can contain global data objects, but not data objects that have been defined locally in a subroutine or function module.
You can use INSERT to specify both fields and field symbols. This makes it possible to dynamically insert a data object referred to by a field symbol into a field group at runtime. Any field symbols that have not been assigned are ignored, which means no new field is inserted into the field group.
The EXTRACT statement writes all the fields of a field group as one record to a sequential dataset (transport takes place with similarly named fields). If a HEADER field group is defined, then its fields are placed ahead of each record as sort keys. You can then sort the dataset with SORT and process it with LOOP ...ENDLOOP. In this case, no further EXTRACT is possible.
The INSERT statement is not a declarative statement: This means field groups can also be expanded in the program flow section.
As soon as the first dataset of a field group has been extracted with EXTRACT, that field group can no longer be expanded with INSERT. In particular, the HEADER field group cannot be expanded after the first EXTRACT (regardless of the field group).
When the GET events are processed, the logical database automatically writes hexadecimal zeros in all the fields of a node when it returns to an upper-level node in the hierarchy. Since the HEADER normally contains sort fields for all field groups, these hexadecimal zeros in the HEADER serve as a type of hierarchy key: The more zeros there are, the further up in the control level hierarchy you go.
The SORT statement sorts the extract dataset in accordance with the defined field sequence in field group HEADER. The addition BY ... sets a new sort key.
Each must be either a field of field group HEADER or a field group that consists only of fields of the field group HEADER. You can use the additions ASCENDING and DESCENDING to determine whether the fields are sorted in ascending (default) or descending order.
Fields containing X'00' in the logical databases are always displayed before all other values during a SORT.
Processing of an extract dataset always takes places within a LOOP. The contents of the extract dataset field are placed in program fields with the same names.
The group change always involves the fields of the HEADER. Single record processing for extract datasets is performed using language element AT ( = field group).
CNT() is not a statement, but instead a field that is automatically create d and filled when is a non-numeric field from field group HEADER and is part of the sort key. At the end of the group, CNT() contains the number of different values that the field recorded in this group level.
SUM() is not a statement, but instead a field that is automatically created and filled when is a numeric field of an extract dataset. At the end of the group, SUM() contains the control total of field .
*** and CNT are only available at the end of the group level or at AT LAST.
Single record processing for extract datasets AT WITH is only performed when field group is immediately followed by field group in the temporary dataset.
Loops over an extract dataset cannot be nested. However, several contiguous loops are permitted.
The sequence of the control level changes within the LOOP must correspond to the sort sequence.
Totals can only be calculated within control footer processing.
Extracts allow only appends (EXTRACT), sorting (SORT) and sequential processing (LOOP).
Once a SORT or LOOP has occurred, the intermediate dataset is frozen and cannot be expanded with EXTRACT. Operations that insert into or delete from EXTRACT datasets are not supported.
Extracts allow for several record types (FIELD-GROUPS) with fields that can be set dynamically (INSERT is not a declarative statement!). Internal tables have a single, statically-defined line type.
Internal tables use the sequence of table fields according to the declaration for the hierarchy of the control leve l. The control level structure for internal tables is therefore static, and is independent of which criteria were used to sort the internal table.
Extracts do not depend on the field sequence for control level processing: a re-sort or a completely different control level process can take place. The control level structure for extract datasets is therefore dynamic. It corresponds exactly to the sort key of the extract dataset. The sort key is the sequence of fields from the field group HEADER, and is used to sort the extract dataset.
Extracts rely on the compiler to determine which combinations of group levels and a cumulating field the control level totals desire. The desired control level totals are determined by the processing of LOOP ... ENDLOOP blocks. Internal tables build the control level total with the SUM statement.
This procedure leads to high resource depletion for totaling control levels in internal tables.
Regards,
Chandru -
Sub total in ALV report.
hello everyone,
i am developing one ALV report and one problem is there.
i want Material Group wise total on 1.Quantity 2. Asssessable value 3. Basic duty 4. Edu cess.
Problem is all total are correct but when material group is different it repeat same total again. how to do total different material group wise?
i am using this code...............
*& Report ZHP_EXCISE_INVOICE
REPORT zhp_excise_invoice NO STANDARD PAGE HEADING LINE-SIZE 150 MESSAGE-ID 00.
TYPE-POOLS: slis.
TABLES: j_1iexchdr,vbrk,vbrp,t001w,t023t,konv.
DATA: BEGIN OF ithp_j_1iexchdr OCCURS 0,
docyr LIKE j_1iexchdr-docyr, "Year
bukrs LIKE j_1iexchdr-bukrs, "Company Code
werks LIKE j_1iexchdr-werks, "PLANT
exdat LIKE j_1iexchdr-exdat, "Excise Document Date
rdoc LIKE j_1iexchdr-rdoc, "Reference Document 1
preprn LIKE j_1iexchdr-preprn, "Preprinted Serial Number
kunag LIKE j_1iexchdr-kunag, "Sold-to party
kunwe LIKE j_1iexchdr-kunwe, "Ship-to party
exbed LIKE j_1iexchdr-exbed, "Basic Excise Duty
ecs LIKE j_1iexchdr-ecs, "Edu Cess amount
status LIKE j_1iexchdr-status, "Excise Document Status
censtat LIKE j_1iexchdr-censtat, "CENVAT Utilization status
exccd LIKE j_1iexchdr-exccd, "ECC Number
trntyp LIKE j_1iexchdr-trntyp, "Excise Transaction Type
vbeln LIKE vbrk-vbeln, "Billing Document
kzwi2 LIKE vbrp-kzwi2, "Assessable value
fkimg LIKE vbrp-fkimg, "Actual billed quantity
matkl LIKE vbrp-matkl, "Material group
netwr LIKE vbrp-netwr, "Net value
name1 LIKE t001w-name1, "Plant Name
wgbez LIKE t023t-wgbez, "Material Group Desc.
serial_no TYPE i,
subtot1 TYPE vbrp-fkimg,
price_per TYPE konv-kbetr,
cash_disc TYPE konv-kwert,
vol_disc TYPE konv-kwert,
***_value TYPE konv-kbetr,
***_value1 TYPE konv-kbetr,
BASIC_DUTY1 TYPE konv-kwert,
EDU_CESS1 TYPE konv-kwert,
END OF ithp_j_1iexchdr.
DATA : x TYPE i VALUE 0,
y TYPE i VALUE 0.
DATA: t_fillcat TYPE slis_t_fieldcat_alv,
w_fillcat TYPE slis_fieldcat_alv,
layout TYPE slis_layout_alv,
repid LIKE sy-repid.
TYPES: BEGIN OF ty_itab,
price_per TYPE konv-kbetr,
basic_prc TYPE konv-kbetr,
cash_disc TYPE konv-kwert,
vol_disc TYPE konv-kwert,
***_value TYPE konv-kbetr,
END OF ty_itab.
DATA:it_itab TYPE ty_itab OCCURS 0 WITH HEADER LINE,
wa_itab TYPE ty_itab.
TYPES: BEGIN OF ty_konv,
kschl TYPE konv-kschl,
kbetr TYPE konv-kbetr,
kwert TYPE konv-kwert,
mwsk1 TYPE konv-mwsk1,
knumv TYPE konv-knumv,
kposn TYPE konv-kposn,
END OF ty_konv.
DATA: it_konv TYPE ty_konv OCCURS 0 WITH HEADER LINE,
wa_konv TYPE ty_konv .
TYPES: BEGIN OF ty_vbrk,
fkdat TYPE vbrk-fkdat,
fkart TYPE vbrk-fkart,
knumv TYPE vbrk-knumv,
vbeln TYPE vbrk-vbeln,
vbtyp TYPE vbrk-vbtyp,
bukrs TYPE vbrk-bukrs,
kunrg TYPE vbrk-kunrg,
END OF ty_vbrk.
DATA: it_vbrk TYPE ty_vbrk OCCURS 0 WITH HEADER LINE,
wa_vbrk TYPE ty_vbrk .
TYPES : BEGIN OF ty_vbrp,
werks TYPE vbrp-werks,
spart TYPE vbrp-spart,
vkbur TYPE vbrp-vkbur,
matkl TYPE vbrp-matkl,
vbeln TYPE vbrp-vbeln,
posnr TYPE vbrp-posnr,
vgbel TYPE vbrp-vgbel,
matnr TYPE vbrp-matnr,
brgew TYPE vbrp-brgew,
fkimg TYPE vbrp-fkimg,
vrkme TYPE vbrp-vrkme,
netwr TYPE vbrp-netwr,
arktx TYPE vbrp-arktx,
aubel TYPE vbrp-aubel,
kzwi1 TYPE vbrp-kzwi1,
kzwi2 TYPE vbrp-kzwi2,
kzwi4 TYPE vbrp-kzwi4,
kzwi5 TYPE vbrp-kzwi5,
kzwi6 TYPE vbrp-kzwi6,
END OF ty_vbrp.
DATA: it_vbrp TYPE ty_vbrp OCCURS 0 WITH HEADER LINE,
wa_vbrp TYPE ty_vbrp.
DATA: events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader.
top_of_page type slis_formname value 'TOP_OF_PAGE'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: p_bukrs FOR j_1iexchdr-bukrs.
SELECT-OPTIONS: p_exgrp FOR j_1iexchdr-exgrp.
SELECT-OPTIONS: p_werks FOR j_1iexchdr-werks.
SELECT-OPTIONS: p_matkl FOR vbrp-matkl.
SELECT-OPTIONS: p_trntyp FOR j_1iexchdr-trntyp DEFAULT 'DLFC' NO INTERVALS.
SELECT-OPTIONS: p_status FOR j_1iexchdr-status DEFAULT 'C' NO INTERVALS.
SELECT-OPTIONS: p_cnstat FOR j_1iexchdr-censtat DEFAULT 'P' NO INTERVALS.
SELECT-OPTIONS: p_exdat FOR j_1iexchdr-exdat OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
repid = sy-repid.
AT SELECTION-SCREEN ON p_bukrs.
SELECT SINGLE * FROM j_1iexchdr WHERE bukrs IN p_bukrs.
IF sy-subrc <> 0.
MESSAGE e001 WITH 'No Table Entries Found'.
EXIT.
ENDIF.
AT SELECTION-SCREEN ON p_werks.
SELECT SINGLE * FROM j_1iexchdr WHERE werks IN p_werks.
IF sy-subrc <> 0.
MESSAGE e001 WITH 'No Table Entries Found'.
EXIT.
ENDIF.
AT SELECTION-SCREEN ON p_matkl.
SELECT SINGLE * FROM vbrp WHERE matkl IN p_matkl.
IF sy-subrc <> 0.
MESSAGE e001 WITH 'No Table Entries Found'.
EXIT.
ENDIF.
AT SELECTION-SCREEN ON p_exdat.
SELECT SINGLE * FROM j_1iexchdr WHERE exdat IN p_exdat.
IF sy-subrc <> 0.
MESSAGE e001 WITH 'No Table Entries Found'.
EXIT.
ENDIF.
START-OF-SELECTION.
PERFORM select.
PERFORM fillcat.
PERFORM display.
END-OF-SELECTION.
*& Form SELECT
text
--> p1 text
<-- p2 text
FORM select .
SELECT DOCYR
BUKRS
WERKS
EXDAT
RDOC
PREPRN
KUNAG
KUNWE
EXBED
ECS
STATUS
CENSTAT
INTO CORRESPONDING FIELDS OF TABLE ITHP_J_1IEXCHDR
FROM J_1IEXCHDR
WHERE BUKRS IN P_BUKRS AND
EXGRP IN P_EXGRP AND
WERKS IN P_WERKS AND
EXDAT IN P_EXDAT.
SELECT VBELN
NETWR
INTO CORRESPONDING FIELDS OF TABLE ITHP_VBRK
FROM VBRK
FOR ALL ENTRIES IN ITHP_J_1IEXCHDR
WHERE VBELN EQ ITHP_J_1IEXCHDR-RDOC AND
BUKRS EQ ITHP_J_1IEXCHDR-BUKRS AND
KUNAG EQ ITHP_J_1IEXCHDR-KUNAG.
SORT ITHP_J_1IEXCHDR BY DOCYR BUKRS WERKS EXDAT RDOC.
SORT ITHP_VBRK BY VBELN.
SELECT a~docyr
a~bukrs
a~werks
a~exdat
a~rdoc
a~preprn
a~kunag
a~kunwe
a~exbed
a~ecs
a~status
a~censtat
a~exccd
a~trntyp
c~netwr
c~kzwi2
c~fkimg
c~matkl
d~name1
e~wgbez
INTO CORRESPONDING FIELDS OF TABLE ithp_j_1iexchdr
FROM j_1iexchdr AS a INNER JOIN vbrk AS b ON ardoc = bvbeln
INNER JOIN vbrp AS c ON bvbeln = cvbeln
INNER JOIN t001w AS d ON awerks = dwerks
INNER JOIN t023t AS e ON cmatkl = ematkl
WHERE a~bukrs IN p_bukrs AND
a~exgrp IN p_exgrp AND
a~werks IN p_werks AND
c~matkl IN p_matkl AND
a~trntyp IN p_trntyp AND
a~status IN p_status AND
a~censtat IN p_cnstat AND
a~exdat IN p_exdat.
SORT ithp_j_1iexchdr BY docyr bukrs werks exdat rdoc matkl.
ENDFORM. " SELECT
*& Form FILLCAT
text
--> p1 text
<-- p2 text
FORM fillcat .
DATA: subtot TYPE vbrp-fkimg.
DATA: BASIC_DUTY TYPE konv-kwert.
DATA: EDU_CESS TYPE konv-kwert.
REFRESH it_vbrk.
REFRESH it_konv.
REFRESH it_vbrp.
LOOP AT ithp_j_1iexchdr.
SELECT fkdat fkart knumv vbeln vbtyp bukrs kunrg
FROM vbrk INTO TABLE it_vbrk
WHERE vbeln EQ ithp_j_1iexchdr-rdoc.
SELECT kschl kbetr kwert mwsk1 knumv kposn FROM konv
INTO TABLE it_konv FOR ALL ENTRIES IN it_vbrk
WHERE knumv EQ it_vbrk-knumv.
SELECT werks spart vkbur matkl vbeln posnr
vgbel matnr brgew fkimg vrkme netwr
arktx aubel kzwi1 kzwi2 kzwi4 kzwi5
kzwi6 FROM vbrp INTO TABLE it_vbrp FOR ALL
ENTRIES IN it_vbrk
WHERE vbeln EQ it_vbrk-vbeln.
SORT it_vbrk BY vbeln knumv.
SORT it_konv BY KSCHL knumv.
SORT it_vbrp BY vbeln.
LOOP AT it_konv.
IF it_konv-kschl = 'ZASS'.
LOOP AT it_konv.
IF it_konv-kschl = 'ZPR0'.
it_itab-***_value = it_konv-kwert.
ithp_j_1iexchdr-***_value = it_itab-***_value.
ADD ithp_j_1iexchdr-***_value TO ithp_j_1iexchdr-***_value1.
ithp_j_1iexchdr-***_value1 = ithp_j_1iexchdr-***_value1 - ithp_j_1iexchdr-***_value.
MODIFY ithp_j_1iexchdr.
ENDIF.
IF it_konv-kschl = 'ZASS'.
it_itab-***_value = it_konv-kwert.
ithp_j_1iexchdr-***_value = it_itab-***_value.
ADD ithp_j_1iexchdr-***_value TO ithp_j_1iexchdr-***_value1.
MODIFY ithp_j_1iexchdr.
ENDIF.
ENDLOOP.
EXIT.
ENDIF.
IF it_konv-kschl = 'PR00'.
it_itab-***_value = it_konv-kwert.
ithp_j_1iexchdr-***_value = it_itab-***_value.
ADD ithp_j_1iexchdr-***_value TO ithp_j_1iexchdr-***_value1.
MODIFY ithp_j_1iexchdr.
ENDIF.
IF it_konv-kschl = 'ZPR0'.
LOOP AT it_konv.
IF it_konv-kschl = 'ZASS'.
EXIT.
ENDIF.
it_itab-***_value = it_konv-kwert.
ithp_j_1iexchdr-***_value = it_itab-***_value.
ADD ithp_j_1iexchdr-***_value TO ithp_j_1iexchdr-***_value1.
ithp_j_1iexchdr-***_value1 = ithp_j_1iexchdr-***_value1 - ithp_j_1iexchdr-***_value.
MODIFY ithp_j_1iexchdr.
ENDIF.
IF it_konv-kschl = 'ZPR0'.
it_itab-***_value = it_konv-kwert.
ithp_j_1iexchdr-***_value = it_itab-***_value.
ADD ithp_j_1iexchdr-***_value TO ithp_j_1iexchdr-***_value1.
MODIFY ithp_j_1iexchdr.
ENDIF.
ENDLOOP.
EXIT.
ENDIF.
IF it_konv-kschl = 'JEXP'.
BASIC_DUTY = it_konv-kwert.
ADD BASIC_DUTY TO ithp_j_1iexchdr-BASIC_DUTY1.
MODIFY ithp_j_1iexchdr.
ENDIF.
IF it_konv-kschl = 'JECS'.
EDU_CESS = it_konv-kwert.
ADD EDU_CESS TO ithp_j_1iexchdr-EDU_CESS1.
MODIFY ithp_j_1iexchdr.
ENDIF.
ENDLOOP.
ENDLOOP.
LOOP AT ithp_j_1iexchdr.
AT NEW rdoc.
SUM.
subtot = ithp_j_1iexchdr-fkimg.
ENDAT.
ithp_j_1iexchdr-subtot1 = subtot.
MODIFY ithp_j_1iexchdr.
AT NEW MATKL.
ENDAT.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM ithp_j_1iexchdr.
LOOP AT ithp_j_1iexchdr.
x = x + 1.
ithp_j_1iexchdr-serial_no = x.
MODIFY ithp_j_1iexchdr.
ENDLOOP.
repid = sy-repid.
DATA: col_pos TYPE i VALUE 0.
col_pos = col_pos + 1.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'SERIAL_NO'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Serial No'.
w_fillcat-seltext_m = 'Serial No'.
w_fillcat-seltext_l = 'Serial No'.
w_fillcat-outputlen = 8.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'DOCYR'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Year'.
w_fillcat-seltext_m = 'Year'.
w_fillcat-seltext_l = 'Year'.
w_fillcat-outputlen = 5.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'WERKS'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Plant'.
w_fillcat-seltext_m = 'Plant'.
w_fillcat-seltext_l = 'Plant'.
w_fillcat-outputlen = 5.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'EXDAT'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Doc. Date'.
w_fillcat-seltext_m = 'Doc. Date'.
w_fillcat-seltext_l = 'Doc. Date'.
w_fillcat-outputlen = 10.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'RDOC'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Ref. Document'.
w_fillcat-seltext_m = 'Ref. Document'.
w_fillcat-seltext_l = 'Ref. Document'.
w_fillcat-outputlen = 11.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'PREPRN'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Invoice No'.
w_fillcat-seltext_m = 'Invoice No'.
w_fillcat-seltext_l = 'Invoice No'.
w_fillcat-outputlen = 11.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'SUBTOT1'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-do_sum = 'X'.
w_fillcat-seltext_s = 'Quantity'.
w_fillcat-seltext_m = 'Quantity'.
w_fillcat-seltext_l = 'Quantity'.
w_fillcat-outputlen = 13.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = '***_VALUE1'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-do_sum = 'X'.
w_fillcat-seltext_s = 'Assessable value'.
w_fillcat-seltext_m = 'Assessable value'.
w_fillcat-seltext_l = 'Assessable value'.
w_fillcat-outputlen = 15.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'BASIC_DUTY1'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-do_sum = 'X'.
w_fillcat-seltext_s = 'Basic Duty'.
w_fillcat-seltext_m = 'Basic Duty'.
w_fillcat-seltext_l = 'Basic Duty'.
w_fillcat-outputlen = 13.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'EDU_CESS1'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-do_sum = 'X'.
w_fillcat-seltext_s = 'Edu Cess'.
w_fillcat-seltext_m = 'Edu Cess'.
w_fillcat-seltext_l = 'Edu Cess'.
w_fillcat-outputlen = 13.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'KUNAG'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Sold-to pt'.
w_fillcat-seltext_m = 'Sold-to pt'.
w_fillcat-seltext_l = 'Sold-to pt'.
w_fillcat-outputlen = 10.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'KUNWE'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Ship-to pt'.
w_fillcat-seltext_m = 'Ship-to pt'.
w_fillcat-seltext_l = 'Ship-to pt'.
w_fillcat-outputlen = 10.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'STATUS'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Doc. Status'.
w_fillcat-seltext_m = 'Doc. Status'.
w_fillcat-seltext_l = 'Doc. Status'.
w_fillcat-outputlen = 8.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'CENSTAT'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Cenvet status'.
w_fillcat-seltext_m = 'Cenvet status'.
w_fillcat-seltext_l = 'Cenvet status'.
w_fillcat-outputlen = 8.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'MATKL'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Mat. Grp'.
w_fillcat-seltext_m = 'Mat. Grp'.
w_fillcat-seltext_l = 'Mat. Grp'.
w_fillcat-outputlen = 9.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
col_pos = col_pos + 1.
w_fillcat-fieldname = 'WGBEZ'.
w_fillcat-tabname = 'ITHP_J_1IEXCHDR'.
w_fillcat-col_pos = col_pos.
w_fillcat-seltext_s = 'Mat. Grp Desc.'.
w_fillcat-seltext_m = 'Mat. Grp Desc.'.
w_fillcat-seltext_l = 'Mat. Grp Desc.'.
w_fillcat-outputlen = 20.
APPEND w_fillcat TO t_fillcat.
CLEAR w_fillcat.
ENDFORM. " FILLCAT
*& Form DISPLAY
text
--> p1 text
<-- p2 text
FORM display .
DATA : lv_grid_title TYPE lvc_title.
DATA: date1(10) TYPE c.
DATA: tperiod(500) TYPE c,
tperiod1(40) TYPE c,
tperiod2(30) TYPE c,
temp(25) TYPE c,
temp1(35) TYPE c,
temp2(25) TYPE c,
temp3(25) TYPE c,
temp4(60) TYPE c,
temp5(100) TYPE c.
CONCATENATE sy-datum6(2) sy-datum4(2) sy-datum+0(4)
INTO date1 SEPARATED BY '/'.
CONCATENATE p_exdat-low6(2) p_exdat-low4(2) p_exdat-low+0(4)
INTO temp1 SEPARATED BY '/'.
CONCATENATE p_exdat-high6(2) p_exdat-high4(2) p_exdat-high+0(4)
INTO temp2 SEPARATED BY '/'.
CONCATENATE 'DUTY DEBIT STMT:'
temp1 'TO' temp2
INTO tperiod
SEPARATED BY space.
IF ithp_j_1iexchdr-werks = '1000'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1101'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1102'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1103'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1104'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1201'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1202'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1203'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1204'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1205'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1261'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1301'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '1901'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '2000'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '2101'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '3000'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSEIF ithp_j_1iexchdr-werks = '3101'.
CONCATENATE tperiod 'Plant :' ithp_j_1iexchdr-name1 'Ecc No :' ithp_j_1iexchdr-exccd INTO lv_grid_title
SEPARATED BY space.
ELSE.
CONCATENATE tperiod ' ' INTO lv_grid_title
SEPARATED BY space.
ENDIF.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = 100
text = 'Generating Report ... '.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = 'REPID'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_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 = lv_grid_title
I_GRID_SETTINGS =
is_layout = layout
it_fieldcat = t_fillcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = 'X'
IS_VARIANT =
IT_EVENTS = 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 = ithp_j_1iexchdr
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
Thanks in Advance.....Hi himanshu,
here i am sending some solution.
just create a internal table and wa for IT_SORT in grid display(just like for field cat).
Then u have to populate the internal table by fields for which u want subtotals.
just follow this code.
data: i_sort type SLIS_T_SORTINFO_ALV,
wa_sort type SLIS_SORTINFO_ALV.
wa_sort-fieldname = 'quantity'.
wa_sort-up = 'X'.
wa_sort-subtotal = 'X'.
append wa_sort to i_sort.
Do the same thing for all fields.
mention the internal table name in Grid display.
I think this some what useful to u,
Bye. -
Hi ,
have been working on a ALV report using the class SALV cl_salv_hierseq_table
I am facing few issues pertaining to two things:
1. Displaying some subtotal text along with the subtotals.
Example refer the standard demo example: SALV_DEMO_HIERSEQ_FORM_EVENTS
Now instead of A 17 and A26 I would like to show text like Subtotal for the Carrid.for subtotals and grand totals
Like Subtotal for A 17 is : XXXXXXX
GrandTotal is : YYYYYY
2. We have a page break and a new page for every purchasing group as in the standard example SALV_DEMO_HIERSEQ_FORM_EVENTS for CARRID.
I need to display some variable values as number of documents ,total number of records etc at the end of each CARRID group before a new page starts for the next CARRID.Please note i do not want it on every page.it should only be diaplyed at the end of page whose next page would be for next CARRID.[basically at end of every carrid]Example:after displaying all details for AA need to display the number of records for that carrid at the end of the page[as page break is based on CARRID]/
Thanks
Jyotsnaat end of page event, for CL_SALV_EVENTS_HIERSEQ, has some useful parameters allowing to know where you are at the time of event
parameter VALUE is of type CL_SALV_FORM which contains public attribute IF_SALV_FORM~ACCDESCRIPTION; you can slo get contents of it
about text of total/subtotal, this is normally set in the layout
Maybe you are looking for
-
How can I put songs on my Iphone?
Apparently ITunes match/cloud will only let me download full albums and not indivudial songs which it used to. So I'm trying to put on songs one by one the old school style, yet several non-itunes purchased songs won't go on to the phone? Seems odd t
-
Zoom Control not appearing in Standard Toolbar (CR2008 - SP1)
In Crystal XI (and prior versions), the Zoom control would appear in the standard toolbar. I was able to either select (from the drop down list) or type in the level of zoom. Now this control is no longer showing on the toolbar. Is there a setting
-
Mail icon doesn't work??
I recently downloaded iOS 6.1. My mail no longer loads when I click on the icon. A white screen comes up for a few seconds and it shuts down. I have tried everything. I have tried to delete my mail accounts but they won't delete. They just come back.
-
Visio 2013: File Locations option doesn't work
Has there been any reporting of a bug in Visio 2013's File Locations option? Entering a folder path appears to have no effect on Open and Save dialog boxes for me. This option works fine in all the other Office 2013 applications I have used, but not
-
Unable call the bw screen in webdynpro
i had a function module RSHIER_HIER_SELECT_START in bw which give infoobjects with Hierarchy . so as i have called the function module in my webdynpro . when i executed it it is giving me the short dump . i think it is sap bw screen is uable to call